fix(auth): an IPv6 visitor counts by their /64
One household's line or one server gets a whole /64 of IPv6 addresses, and could turn through them past every per-network limit (the second reading's M5). networkOf now counts an IPv6 visitor by their /64 (networkKeyOf), an IPv4 visitor by their address as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
4a32f150db
commit
4007041c9e
1 changed files with 50 additions and 9 deletions
|
|
@ -122,6 +122,25 @@ void main() {
|
|||
}
|
||||
});
|
||||
|
||||
test("is an IPv6 visitor's /64, as one household or server holds a "
|
||||
'whole /64 and could turn through its addresses past every limit; '
|
||||
'an IPv4 visitor its address', () {
|
||||
expect(
|
||||
networkKeyOf('2001:db8:1:2:aaaa:bbbb:cccc:1'),
|
||||
'2001:db8:1:2::/64',
|
||||
);
|
||||
expect(
|
||||
networkKeyOf('2001:db8:1:2::ffff'),
|
||||
networkKeyOf('2001:db8:1:2:9::1'),
|
||||
);
|
||||
expect(
|
||||
networkKeyOf('2001:db8:1:3::1'),
|
||||
isNot(networkKeyOf('2001:db8:1:2::1')),
|
||||
);
|
||||
expect(networkKeyOf('198.51.100.7'), '198.51.100.7');
|
||||
expect(networkKeyOf(null), 'null');
|
||||
});
|
||||
|
||||
test('is none without a connection (tests, future calls)', () {
|
||||
expect(
|
||||
visitorAddress(
|
||||
|
|
|
|||
Loading…
Reference in a new issue