The checks engine, the path and the cards: me-web? 0.1 reads the connection
MeWeb.Core runs seven checks concurrently and reports each as it settles:
online or behind a login page, this connection, the public IPv4 and IPv6
seen from v4./v6.meweb, the provider from a built-in map, the router
(UPnP IGD, NAT-PMP and PCP, read-only), address sharing (router WAN
against the echo, TTL hops only as a hint), and the history kept on the
device. The app draws the path from this device to the internet and lights
it node by node, with a card per check and a sheet listing every host it
contacts.
The provider map is iptoasn's table compressed to 2.1 MB by
tools/knowledge.cs and built before every app release; eleven Italian
provider profiles carry each fact with who said it, the source and the
month. The server gains a download page (en, it) and /download/{platform}
from the latest Gitea release.
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
16a1cecaae
commit
0dffbc27d6
61 files changed
+3750
-149
No files matched your search
@@ -0,0 +1,65 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace MeWeb.Core.Knowledge;
|
||||
|
||||
public class ProviderFact
|
||||
{
|
||||
public string Value { get; set; }
|
||||
public decimal? Price { get; set; }
|
||||
public string Currency { get; set; }
|
||||
public string Basis { get; set; }
|
||||
public string Source { get; set; }
|
||||
public string Date { get; set; }
|
||||
}
|
||||
|
||||
public class ProviderProfile
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Country { get; set; }
|
||||
public List<uint> Asns { get; set; } = [];
|
||||
public string Sheet { get; set; }
|
||||
public ProviderFact Ipv4 { get; set; }
|
||||
public ProviderFact PublicAddress { get; set; }
|
||||
public ProviderFact Ipv6 { get; set; }
|
||||
public ProviderFact Port25 { get; set; }
|
||||
}
|
||||
|
||||
[JsonSourceGenerationOptions(JsonSerializerDefaults.Web)]
|
||||
[JsonSerializable(typeof(ProviderProfile))]
|
||||
public partial class KnowledgeJsonContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class KnowledgeBase
|
||||
{
|
||||
readonly Lazy<AsnTable> asn = new(LoadAsn);
|
||||
readonly Lazy<List<ProviderProfile>> providers = new(LoadProviders);
|
||||
|
||||
public bool HasAsnTable => typeof(KnowledgeBase).Assembly.GetManifestResourceInfo("ip2asn.bin") is not null;
|
||||
|
||||
public AsnTable Asn => asn.Value;
|
||||
|
||||
public IReadOnlyList<ProviderProfile> Providers => providers.Value;
|
||||
|
||||
public ProviderProfile ProviderFor(uint number) => number == 0 ? null : Providers.FirstOrDefault(p => p.Asns.Contains(number));
|
||||
|
||||
static AsnTable LoadAsn()
|
||||
{
|
||||
using var stream = typeof(KnowledgeBase).Assembly.GetManifestResourceStream("ip2asn.bin");
|
||||
return stream is null ? null : AsnTable.Read(stream);
|
||||
}
|
||||
|
||||
static List<ProviderProfile> LoadProviders()
|
||||
{
|
||||
var assembly = typeof(KnowledgeBase).Assembly;
|
||||
var list = new List<ProviderProfile>();
|
||||
foreach (var name in assembly.GetManifestResourceNames().Where(n => n.StartsWith("isp.", StringComparison.Ordinal)).Order(StringComparer.Ordinal))
|
||||
{
|
||||
using var stream = assembly.GetManifestResourceStream(name);
|
||||
var profile = JsonSerializer.Deserialize(stream, KnowledgeJsonContext.Default.ProviderProfile);
|
||||
if (profile is not null) list.Add(profile);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user