"me-web?" 0.12.0: every address block travels with the app
- The app now carries the whole RIPE Database list of address blocks, all five million, small single-customer blocks included, so the provider card and the path can name the block your connection belongs to without a connection to the publisher's server. The downloads are about 25 MB larger for it. - When the publisher's server can't be reached, the provider card still names your network and its block, from the public address your router reports or the one the STUN test sees. - The table is read a small piece at a time, so it takes almost no memory on a phone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB
This commit is contained in:
1 parent
aa031c6012
commit
50c40195d3
19 files changed
+318
-256
No files matched your search
@@ -15,11 +15,6 @@ public class Carrier
|
||||
public static class Sources
|
||||
{
|
||||
static readonly HashSet<string> Allocations = ["ALLOCATED PA", "ALLOCATED UNSPECIFIED", "ALLOCATED-BY-RIR"];
|
||||
static readonly UInt128 WideV4 = 2048;
|
||||
static readonly UInt128 NarrowV4 = 256;
|
||||
static readonly UInt128 WideV6 = UInt128.One << 88;
|
||||
static readonly UInt128 NarrowV6 = UInt128.One << 80;
|
||||
const int Repeated = 3;
|
||||
|
||||
public static IEnumerable<AsnRange> IpToAsn(Stream gzip)
|
||||
{
|
||||
@@ -82,24 +77,6 @@ public static class Sources
|
||||
if (range?.Name is not null && !Allocations.Contains(status ?? "")) yield return range;
|
||||
}
|
||||
|
||||
public static List<RegistryRange> RipeSelection(IEnumerable<RegistryRange> blocks)
|
||||
{
|
||||
var counts = new Dictionary<string, int>(StringComparer.Ordinal);
|
||||
foreach (var block in blocks)
|
||||
if (block.End - block.Start >= (block.V6 ? NarrowV6 : NarrowV4) - 1) counts[block.Name] = counts.GetValueOrDefault(block.Name) + 1;
|
||||
var names = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||
var kept = new List<RegistryRange>();
|
||||
foreach (var block in blocks)
|
||||
{
|
||||
var size = block.End - block.Start;
|
||||
if (size < (block.V6 ? NarrowV6 : NarrowV4) - 1 || (size < (block.V6 ? WideV6 : WideV4) - 1 && counts[block.Name] < Repeated)) continue;
|
||||
block.Name = Intern(names, block.Name);
|
||||
block.Country = Intern(names, block.Country ?? "");
|
||||
kept.Add(block);
|
||||
}
|
||||
return kept;
|
||||
}
|
||||
|
||||
static RegistryRange RipeRange(string line)
|
||||
{
|
||||
if (line.StartsWith("inetnum:", StringComparison.Ordinal))
|
||||
|
||||
Reference in new issue
Block a user