fix(app): the proxy refuses IPv6 outside global unicast and its stop closes open tunnels

- IPv6 counts as public only in 2000::/3 (without 2001::/23, documentation and 6to4), so site
  local fec0::/10 and IPv4-compatible addresses are refused; the collector uses the same rule
- every proxy connection is a task of one set: a stop ends the open CONNECT tunnels and waits
  until their sockets are gone

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-13 22:07:50 +09:00
parent b20b5795b6
commit 55d19364a0
5 changed files with 111 additions and 23 deletions

View File

@@ -383,3 +383,10 @@ def test_the_fetcher_gives_up_on_a_slow_name_lookup(monkeypatch):
took = time.monotonic() - t0
print(f"slow lookup: failed after {took:.2f}s")
assert took < 1.5
def test_only_global_unicast_ipv6_counts_as_public():
for a in ("fec0::1", "::1.2.3.4", "100::1", "2001:2::1", "2002:c0a8::1", "fe80::1", "fd00::1", "::ffff:10.0.0.1"):
assert not collect._is_public_ip(ipaddress.ip_address(a)), a
for a in ("2606:4700:4700::1111", "2001:4860:4860::8888", "8.8.8.8"):
assert collect._is_public_ip(ipaddress.ip_address(a)), a