Publish Zonghengjia Windows 0.3.13 client source
This commit is contained in:
@@ -17,8 +17,8 @@ internal static class LearningSelfTest
|
||||
checks["acceptance_is_not_success"] = Parse("from tcp:127.0.0.1:777 accepted tcp:learn.example.com:443 [socks-in -> direct]") is null;
|
||||
checks["http_auth_status_is_not_failure"] = Parse("HTTP 401 / 403 / 429 direct learn.example.com:443") is null;
|
||||
checks["proxy_failures_not_direct"] = Parse(line.Replace("proxy/freedom", "proxy/vless/outbound")) is null;
|
||||
checks["private_failures_not_collected"] = Parse(line.Replace("learn.example.com", "192.168.50.111")) is null;
|
||||
checks["company_not_collected"] = Parse(line.Replace("learn.example.com", "vpn.example.invalid")) is null;
|
||||
checks["private_failures_not_collected"] = Parse(line.Replace("learn.example.com", "172.16.0.111")) is null;
|
||||
checks["company_not_collected"] = Parse(line.Replace("learn.example.com", "vpn.toplc.cn")) is null;
|
||||
checks["source_not_misidentified"] = Parse("tcp:127.0.0.1:777 " + line)?.Target == "learn.example.com";
|
||||
checks["oversized_line_rejected"] = Parse(new string('x', 8193) + line) is null;
|
||||
const string attempt = "[Info] [1753901314] app/dispatcher: taking detour [direct] for [tcp:tls-gap.example.com:443]";
|
||||
@@ -32,7 +32,7 @@ internal static class LearningSelfTest
|
||||
checks["attempt_is_not_failure_evidence"] = Parse(attempt) is null;
|
||||
checks["probe_not_recursively_observed"] = LearningPolicy.ParseAttempt(attempt.Replace("[direct]","[ucvl-learning-direct]"),"fixture","public") is null;
|
||||
checks["proxy_attempt_not_observed"] = LearningPolicy.ParseAttempt(attempt.Replace("[direct]","[proxy]"),"fixture","public") is null;
|
||||
checks["private_attempt_not_observed"] = LearningPolicy.ParseAttempt(attempt.Replace("tls-gap.example.com","192.168.50.111"),"fixture","public") is null;
|
||||
checks["private_attempt_not_observed"] = LearningPolicy.ParseAttempt(attempt.Replace("tls-gap.example.com","172.16.0.111"),"fixture","public") is null;
|
||||
checks["non_tls_attempt_not_observed"] = LearningPolicy.ParseAttempt(attempt.Replace(":443]",":80]"),"fixture","public") is null;
|
||||
checks["no_url_collection"] = LearningPolicy.ParseAttempt(attempt.Replace("tls-gap.example.com","example.com/path?token=x"),"fixture","public") is null;
|
||||
foreach (bool? directTls in new bool?[] { true, false, null })
|
||||
@@ -54,7 +54,7 @@ internal static class LearningSelfTest
|
||||
checks["rate_window_recovers"] = rate.TryEnter("new",160_001);
|
||||
foreach (var host in new[] { "127.0.0.1", "100.100.1.1", "192.168.1.1", "169.254.169.254", "::1", "::ffff:127.0.0.1", "203.0.113.1" })
|
||||
checks["nonpublic_ip_" + host] = !LearningPolicy.Allowed("ip", host);
|
||||
foreach (var host in new[] { "192.168.50.111", "a.local", "a.invalid", "x.toplc.cn", "a.com/path", "a.com?secret=1", "bad_.com", "-bad.com" })
|
||||
foreach (var host in new[] { "172.16.0.111", "a.local", "a.invalid", "x.toplc.cn", "a.com/path", "a.com?secret=1", "bad_.com", "-bad.com" })
|
||||
checks["unsafe_domain_" + host] = !LearningPolicy.Allowed("domain", host);
|
||||
checks["public_ip_allowed"] = LearningPolicy.Allowed("ip", "8.8.8.8");
|
||||
var direct = LearningPolicy.DirectFirst(baseConfig);
|
||||
@@ -71,7 +71,7 @@ internal static class LearningSelfTest
|
||||
checks["private_precedes_learned"] = JsonNode.Parse(verified)!["routing"]!["rules"]![0]!["ip"]![0]!.GetValue<string>() == "geoip:private";
|
||||
checks["expiry_restores_direct"] = !LearningPolicy.Merge(verified, new() { Contract=1, Revision=new string('b',64) }).Contains("learn.example.com");
|
||||
checks["network_change_restores_direct"] = !LearningPolicy.DirectFirst(verified).Contains("learn.example.com");
|
||||
checks["unsafe_manifest_rejected"] = Throws(() => LearningPolicy.Merge(direct, Rules("vpn.example.invalid")));
|
||||
checks["unsafe_manifest_rejected"] = Throws(() => LearningPolicy.Merge(direct, Rules("vpn.toplc.cn")));
|
||||
checks["invalid_manifest_contract_rejected"] = Throws(() => LearningPolicy.Merge(direct, new() { Contract=99, Revision=new string('a',64) }));
|
||||
var runtime = JsonNode.Parse(TunConfigBuilder.Build(direct, "Ethernet", true, includeTun:false, routingApiPort:18090, learningProbePort:18091))!;
|
||||
checks["info_in_memory_access_disabled"] = runtime["log"]!["loglevel"]!.GetValue<string>() == "info" && runtime["log"]!["access"]!.GetValue<string>() == "none";
|
||||
|
||||
Reference in New Issue
Block a user