Files
omarandClaude Opus 5 5785be4964 Subscriptions: uniqueness by subnet, not just by exit IP
unique_ips collapsed proxies per exit address, so one operator holding many
adjacent addresses counted as many distinct nodes. On the live pool the NL
exit layer looked like 87 unique IPs but was 40 distinct /24s, with 33 of
them in a single block — roughly three of four circuits leaving through one
of two operators.

Add a scope alongside the existing metric, so the two axes are independent:

  unique_ips_scope  = ip | subnet     (ip = previous behaviour, default)
  unique_ips_metric = speed | latency (unchanged)
  unique_subnet_v4  = prefix bits, default 24
  unique_subnet_v6  = prefix bits, default 48

The collapse key generalises from the exit address to a masked netip.Prefix.
Prefix lengths are clamped (v4 8-32, v6 16-128) rather than rejected so a
stored subscription can never render an empty payload, and the API persists
the normalized value so the panel shows what is actually served. Exits that
are empty or unparseable still pass through uncollapsed — dropping them would
discard distinct nodes. IPv4-mapped IPv6 is unmapped before masking.

Schema upgrade is idempotent and defaults reproduce the old behaviour, so
existing subscriptions keep serving the same node set until switched over.

The same scope is exposed on the Proxies tab (and its export) so the effect
can be previewed before it is applied to a subscription.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08 17:48:55 +03:00
..