me-web? 0.5: the shared exit measured, the route from the server, the network's upstreams
- Behind your provider's shared address, me-web? now shows how its exit hands out ports (kept, one after another, from one block, or at random), the range it gave this device, and how many customers may share the address at most; the estimate sharpens with each check on the same address. - It tests whether two devices behind the same address can reach each other (hairpin), and how long an unused connection stays open: the card says "measuring" for about two minutes after the check, then the answer. - With the test from outside, the publisher's server also traces the route back to your address: your provider's routers and the networks in between appear on the path, with their names. - The provider card says which networks your provider reaches the internet through. - On mobile data, the path shows the operator and the type of network (5G, 4G) read from the phone; on Android 13 and later the phone asks once for permission to read the network type. - The speed card adds the round trip to the publisher's server. - The network data now comes from the publisher's server, refreshed there from open sources: iptoasn.com, DB-IP Lite (CC BY 4.0), the University of Oregon Route Views Project (CC BY 4.0) and the Android Open Source Project's list of mobile operators (Apache 2.0); the release notes list each source's date and checksum. - Source links in the cards wrap instead of being cut off. - New strings, drafted in every language. 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
8caed6b28d
commit
eb8be87284
145 files changed
+3704
-193
No files matched your search
@@ -3,6 +3,7 @@ using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Net;
|
||||
using Android.Net.Wifi;
|
||||
using Android.Telephony;
|
||||
|
||||
using MeWeb.Core.Net;
|
||||
|
||||
@@ -43,6 +44,86 @@ public class AndroidPlatform : SystemPlatform
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task<CellularReport> ReadCellular(CancellationToken ct)
|
||||
{
|
||||
if (Context.GetSystemService(Context.TelephonyService) is not TelephonyManager phone) return null;
|
||||
var report = new CellularReport
|
||||
{
|
||||
Operator = phone.NetworkOperatorName,
|
||||
NetworkCode = phone.NetworkOperator,
|
||||
Roaming = phone.IsNetworkRoaming,
|
||||
};
|
||||
if (OperatingSystem.IsAndroidVersionAtLeast(28)) report.Carrier = phone.SimCarrierIdName;
|
||||
if (OperatingSystem.IsAndroidVersionAtLeast(33) && await Allowed(global::Android.Manifest.Permission.ReadBasicPhoneState, ct))
|
||||
{
|
||||
try
|
||||
{
|
||||
report.Radio = phone.DataNetworkType switch
|
||||
{
|
||||
NetworkType.Nr => "5G",
|
||||
NetworkType.Lte or NetworkType.Iwlan => "4G (LTE)",
|
||||
NetworkType.Hspap or NetworkType.Hspa or NetworkType.Hsdpa or NetworkType.Hsupa or NetworkType.Umts or NetworkType.Evdo0 or NetworkType.EvdoA or NetworkType.EvdoB or NetworkType.Ehrpd => "3G",
|
||||
NetworkType.Edge or NetworkType.Gprs or NetworkType.Cdma or NetworkType.OneXrtt or NetworkType.Gsm or NetworkType.Iden => "2G",
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
catch (Java.Lang.SecurityException)
|
||||
{
|
||||
}
|
||||
}
|
||||
if (OperatingSystem.IsAndroidVersionAtLeast(31) && report.Radio is null or "4G (LTE)" && await FiveGShown(phone, ct)) report.Radio = "5G";
|
||||
return report;
|
||||
}
|
||||
|
||||
[System.Runtime.Versioning.SupportedOSPlatform("android31.0")]
|
||||
static async Task<bool> FiveGShown(TelephonyManager phone, CancellationToken ct)
|
||||
{
|
||||
var listener = new DisplayListener();
|
||||
try
|
||||
{
|
||||
phone.RegisterTelephonyCallback(Context.MainExecutor, listener);
|
||||
var shown = await listener.Shown.Task.WaitAsync(TimeSpan.FromSeconds(1.5), ct);
|
||||
return shown is (int)OverrideNetworkType.NrNsa or (int)OverrideNetworkType.NrAdvanced;
|
||||
}
|
||||
catch (Exception ex) when (ex is TimeoutException or Java.Lang.SecurityException or Java.Lang.IllegalStateException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
phone.UnregisterTelephonyCallback(listener);
|
||||
}
|
||||
catch (Java.Lang.IllegalStateException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.Versioning.SupportedOSPlatform("android31.0")]
|
||||
sealed class DisplayListener : TelephonyCallback, TelephonyCallback.IDisplayInfoListener
|
||||
{
|
||||
public TaskCompletionSource<int> Shown { get; } = new(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
public void OnDisplayInfoChanged(TelephonyDisplayInfo telephonyDisplayInfo) => Shown.TrySetResult((int)telephonyDisplayInfo.OverrideNetworkType);
|
||||
}
|
||||
|
||||
static async Task<bool> Allowed(string permission, CancellationToken ct)
|
||||
{
|
||||
if (Context.CheckSelfPermission(permission) == global::Android.Content.PM.Permission.Granted) return true;
|
||||
var activity = MainActivity.Current;
|
||||
if (activity is null) return false;
|
||||
try
|
||||
{
|
||||
return await activity.Ask(permission).WaitAsync(TimeSpan.FromMinutes(2), ct);
|
||||
}
|
||||
catch (TimeoutException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool ShareLink(string url, string title)
|
||||
{
|
||||
var send = new Intent(Intent.ActionSend);
|
||||
|
||||
Reference in new issue
Block a user