diff --git a/v2rayN/ServiceLib/Common/JsonUtils.cs b/v2rayN/ServiceLib/Common/JsonUtils.cs
index 773ba79c..6954e124 100644
--- a/v2rayN/ServiceLib/Common/JsonUtils.cs
+++ b/v2rayN/ServiceLib/Common/JsonUtils.cs
@@ -128,5 +128,8 @@ public class JsonUtils
///
///
///
- public static JsonNode? SerializeToNode(object? obj) => JsonSerializer.SerializeToNode(obj);
+ public static JsonNode? SerializeToNode(object? obj, JsonSerializerOptions? options = null)
+ {
+ return JsonSerializer.SerializeToNode(obj, options);
+ }
}
diff --git a/v2rayN/ServiceLib/Common/Utils.cs b/v2rayN/ServiceLib/Common/Utils.cs
index c5b670cf..b0d3827b 100644
--- a/v2rayN/ServiceLib/Common/Utils.cs
+++ b/v2rayN/ServiceLib/Common/Utils.cs
@@ -435,11 +435,11 @@ public class Utils
return false;
}
- public static int GetFreePort(int defaultPort = 9090)
+ public static int GetFreePort(int defaultPort = 0)
{
try
{
- if (!Utils.PortInUse(defaultPort))
+ if (!(defaultPort == 0 || Utils.PortInUse(defaultPort)))
{
return defaultPort;
}
diff --git a/v2rayN/ServiceLib/Enums/EConfigType.cs b/v2rayN/ServiceLib/Enums/EConfigType.cs
index f56d0e0f..6698f962 100644
--- a/v2rayN/ServiceLib/Enums/EConfigType.cs
+++ b/v2rayN/ServiceLib/Enums/EConfigType.cs
@@ -11,5 +11,6 @@ public enum EConfigType
Hysteria2 = 7,
TUIC = 8,
WireGuard = 9,
- HTTP = 10
+ HTTP = 10,
+ Anytls = 11
}
diff --git a/v2rayN/ServiceLib/Global.cs b/v2rayN/ServiceLib/Global.cs
index 5592fa2e..180bd90c 100644
--- a/v2rayN/ServiceLib/Global.cs
+++ b/v2rayN/ServiceLib/Global.cs
@@ -167,7 +167,8 @@ public class Global
{ EConfigType.Trojan, "trojan://" },
{ EConfigType.Hysteria2, "hysteria2://" },
{ EConfigType.TUIC, "tuic://" },
- { EConfigType.WireGuard, "wireguard://" }
+ { EConfigType.WireGuard, "wireguard://" },
+ { EConfigType.Anytls, "anytls://" }
};
public static readonly Dictionary ProtocolTypes = new()
@@ -180,7 +181,8 @@ public class Global
{ EConfigType.Trojan, "trojan" },
{ EConfigType.Hysteria2, "hysteria2" },
{ EConfigType.TUIC, "tuic" },
- { EConfigType.WireGuard, "wireguard" }
+ { EConfigType.WireGuard, "wireguard" },
+ { EConfigType.Anytls, "anytls" }
};
public static readonly List VmessSecurities =
@@ -347,25 +349,42 @@ public class Global
public static readonly List SingboxDomainStrategy4Out =
[
- "ipv4_only",
+ "",
+ "ipv4_only",
"prefer_ipv4",
"prefer_ipv6",
- "ipv6_only",
- ""
+ "ipv6_only"
];
- public static readonly List DomainDNSAddress =
+ public static readonly List DomainDirectDNSAddress =
[
- "223.5.5.5",
- "223.6.6.6",
+ "https://dns.alidns.com/dns-query",
+ "https://doh.pub/dns-query",
+ "223.5.5.5",
+ "119.29.29.29",
"localhost"
];
- public static readonly List SingboxDomainDNSAddress =
+ public static readonly List DomainRemoteDNSAddress =
+ [
+ "https://cloudflare-dns.com/dns-query",
+ "https://dns.cloudflare.com/dns-query",
+ "https://dns.google/dns-query",
+ "https://doh.dns.sb/dns-query",
+ "https://doh.opendns.com/dns-query",
+ "https://common.dot.dns.yandex.net",
+ "8.8.8.8",
+ "1.1.1.1",
+ "185.222.222.222",
+ "208.67.222.222",
+ "77.88.8.8"
+ ];
+
+ public static readonly List DomainPureIPDNSAddress =
[
"223.5.5.5",
- "223.6.6.6",
- "dhcp://auto"
+ "119.29.29.29",
+ "localhost"
];
public static readonly List Languages =
@@ -535,5 +554,30 @@ public class Global
BlockTag
];
+ public static readonly Dictionary> PredefinedHosts = new()
+ {
+ { "dns.google", new List { "8.8.8.8", "8.8.4.4", "2001:4860:4860::8888", "2001:4860:4860::8844" } },
+ { "dns.alidns.com", new List { "223.5.5.5", "223.6.6.6", "2400:3200::1", "2400:3200:baba::1" } },
+ { "one.one.one.one", new List { "1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001" } },
+ { "1dot1dot1dot1.cloudflare-dns.com", new List { "1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001" } },
+ { "cloudflare-dns.com", new List { "104.16.249.249", "104.16.248.249", "2606:4700::6810:f8f9", "2606:4700::6810:f9f9" } },
+ { "dns.cloudflare.com", new List { "104.16.132.229", "104.16.133.229", "2606:4700::6810:84e5", "2606:4700::6810:85e5" } },
+ { "dot.pub", new List { "1.12.12.12", "120.53.53.53" } },
+ { "dns.quad9.net", new List { "9.9.9.9", "149.112.112.112", "2620:fe::fe", "2620:fe::9" } },
+ { "dns.yandex.net", new List { "77.88.8.8", "77.88.8.1", "2a02:6b8::feed:0ff", "2a02:6b8:0:1::feed:0ff" } },
+ { "dns.sb", new List { "185.222.222.222", "2a09::" } },
+ { "dns.umbrella.com", new List { "208.67.220.220", "208.67.222.222", "2620:119:35::35", "2620:119:53::53" } },
+ { "dns.sse.cisco.com", new List { "208.67.220.220", "208.67.222.222", "2620:119:35::35", "2620:119:53::53" } },
+ { "engage.cloudflareclient.com", new List { "162.159.192.1", "2606:4700:d0::a29f:c001" } }
+ };
+
+ public static readonly List ExpectedIPs =
+ [
+ "geoip:cn",
+ "geoip:ir",
+ "geoip:ru",
+ ""
+ ];
+
#endregion const
}
diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
index c08ca28e..9040d70c 100644
--- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs
+++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs
@@ -112,6 +112,11 @@ public class ConfigHandler
config.ConstItem ??= new ConstItem();
+ if (config.SimpleDNSItem == null)
+ {
+ InitBuiltinSimpleDNS(config);
+ }
+
config.SpeedTestItem ??= new();
if (config.SpeedTestItem.SpeedTestTimeout < 10)
{
@@ -261,6 +266,7 @@ public class ConfigHandler
EConfigType.Hysteria2 => await AddHysteria2Server(config, item),
EConfigType.TUIC => await AddTuicServer(config, item),
EConfigType.WireGuard => await AddWireguardServer(config, item),
+ EConfigType.Anytls => await AddAnytlsServer(config, item),
_ => -1,
};
return ret;
@@ -785,6 +791,35 @@ public class ConfigHandler
return 0;
}
+ ///
+ /// Add or edit a Anytls server
+ /// Validates and processes Anytls-specific settings
+ ///
+ /// Current configuration
+ /// Anytls profile to add
+ /// Whether to save to file
+ /// 0 if successful, -1 if failed
+ public static async Task AddAnytlsServer(Config config, ProfileItem profileItem, bool toFile = true)
+ {
+ profileItem.ConfigType = EConfigType.Anytls;
+ profileItem.CoreType = ECoreType.sing_box;
+
+ profileItem.Address = profileItem.Address.TrimEx();
+ profileItem.Id = profileItem.Id.TrimEx();
+ profileItem.Security = profileItem.Security.TrimEx();
+ profileItem.Network = string.Empty;
+ if (profileItem.StreamSecurity.IsNullOrEmpty())
+ {
+ profileItem.StreamSecurity = Global.StreamSecurity;
+ }
+ if (profileItem.Id.IsNullOrEmpty())
+ {
+ return -1;
+ }
+ await AddServerCommon(config, profileItem, toFile);
+ return 0;
+ }
+
///
/// Sort the server list by the specified column
/// Updates the sort order in the profile extension data
@@ -1294,6 +1329,7 @@ public class ConfigHandler
EConfigType.Hysteria2 => await AddHysteria2Server(config, profileItem, false),
EConfigType.TUIC => await AddTuicServer(config, profileItem, false),
EConfigType.WireGuard => await AddWireguardServer(config, profileItem, false),
+ EConfigType.Anytls => await AddAnytlsServer(config, profileItem, false),
_ => -1,
};
@@ -2152,6 +2188,38 @@ public class ConfigHandler
#endregion DNS
+ #region Simple DNS
+
+ public static int InitBuiltinSimpleDNS(Config config)
+ {
+ config.SimpleDNSItem = new SimpleDNSItem()
+ {
+ UseSystemHosts = false,
+ AddCommonHosts = true,
+ FakeIP = false,
+ BlockBindingQuery = true,
+ DirectDNS = Global.DomainDirectDNSAddress.FirstOrDefault(),
+ RemoteDNS = Global.DomainRemoteDNSAddress.FirstOrDefault(),
+ SingboxOutboundsResolveDNS = Global.DomainDirectDNSAddress.FirstOrDefault(),
+ SingboxFinalResolveDNS = Global.DomainPureIPDNSAddress.FirstOrDefault()
+ };
+ return 0;
+ }
+
+ public static async Task GetExternalSimpleDNSItem(string url)
+ {
+ var downloadHandle = new DownloadService();
+ var templateContent = await downloadHandle.TryDownloadString(url, true, "");
+ if (templateContent.IsNullOrEmpty())
+ return null;
+ var template = JsonUtils.Deserialize(templateContent);
+ if (template == null)
+ return null;
+ return template;
+ }
+
+ #endregion Simple DNS
+
#region Regional Presets
///
@@ -2173,6 +2241,8 @@ public class ConfigHandler
await SQLiteHelper.Instance.DeleteAllAsync();
await InitBuiltinDNS(config);
+ InitBuiltinSimpleDNS(config);
+
return true;
case EPresetType.Russia:
@@ -2183,6 +2253,8 @@ public class ConfigHandler
await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.Xray, Global.DNSTemplateSources[1] + "v2ray.json"));
await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.sing_box, Global.DNSTemplateSources[1] + "sing_box.json"));
+ config.SimpleDNSItem = await GetExternalSimpleDNSItem(Global.DNSTemplateSources[1] + "simple_dns.json");
+
return true;
case EPresetType.Iran:
@@ -2193,6 +2265,8 @@ public class ConfigHandler
await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.Xray, Global.DNSTemplateSources[2] + "v2ray.json"));
await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.sing_box, Global.DNSTemplateSources[2] + "sing_box.json"));
+ config.SimpleDNSItem = await GetExternalSimpleDNSItem(Global.DNSTemplateSources[2] + "simple_dns.json");
+
return true;
}
diff --git a/v2rayN/ServiceLib/Handler/CoreHandler.cs b/v2rayN/ServiceLib/Handler/CoreHandler.cs
index 92c30171..f66d3700 100644
--- a/v2rayN/ServiceLib/Handler/CoreHandler.cs
+++ b/v2rayN/ServiceLib/Handler/CoreHandler.cs
@@ -101,7 +101,7 @@ public class CoreHandler
public async Task LoadCoreConfigSpeedtest(List selecteds)
{
- var coreType = selecteds.Exists(t => t.ConfigType is EConfigType.Hysteria2 or EConfigType.TUIC) ? ECoreType.sing_box : ECoreType.Xray;
+ var coreType = selecteds.Exists(t => t.ConfigType is EConfigType.Hysteria2 or EConfigType.TUIC or EConfigType.Anytls) ? ECoreType.sing_box : ECoreType.Xray;
var fileName = string.Format(Global.CoreSpeedtestConfigFileName, Utils.GetGuid(false));
var configPath = Utils.GetBinConfigPath(fileName);
var result = await CoreConfigHandler.GenerateClientSpeedtestConfig(_config, configPath, selecteds, coreType);
diff --git a/v2rayN/ServiceLib/Handler/Fmt/AnytlsFmt.cs b/v2rayN/ServiceLib/Handler/Fmt/AnytlsFmt.cs
new file mode 100644
index 00000000..3f1d40dc
--- /dev/null
+++ b/v2rayN/ServiceLib/Handler/Fmt/AnytlsFmt.cs
@@ -0,0 +1,49 @@
+using static QRCoder.PayloadGenerator;
+
+namespace ServiceLib.Handler.Fmt;
+public class AnytlsFmt : BaseFmt
+{
+ public static ProfileItem? Resolve(string str, out string msg)
+ {
+ msg = ResUI.ConfigurationFormatIncorrect;
+
+ var parsedUrl = Utils.TryUri(str);
+ if (parsedUrl == null)
+ {
+ return null;
+ }
+
+ ProfileItem item = new()
+ {
+ ConfigType = EConfigType.Anytls,
+ Remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped),
+ Address = parsedUrl.IdnHost,
+ Port = parsedUrl.Port,
+ };
+ var rawUserInfo = Utils.UrlDecode(parsedUrl.UserInfo);
+ item.Id = rawUserInfo;
+
+ var query = Utils.ParseQueryString(parsedUrl.Query);
+ _ = ResolveStdTransport(query, ref item);
+
+ return item;
+ }
+
+ public static string? ToUri(ProfileItem? item)
+ {
+ if (item == null)
+ {
+ return null;
+ }
+ var remark = string.Empty;
+ if (item.Remarks.IsNotEmpty())
+ {
+ remark = "#" + Utils.UrlEncode(item.Remarks);
+ }
+ var pw = item.Id;
+ var dicQuery = new Dictionary();
+ _ = GetStdTransport(item, Global.None, ref dicQuery);
+
+ return ToUri(EConfigType.Anytls, item.Address, item.Port, pw, dicQuery, remark);
+ }
+}
diff --git a/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs b/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs
index 3e8ab2ae..814d753d 100644
--- a/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs
+++ b/v2rayN/ServiceLib/Handler/Fmt/FmtHandler.cs
@@ -18,6 +18,7 @@ public class FmtHandler
EConfigType.Hysteria2 => Hysteria2Fmt.ToUri(item),
EConfigType.TUIC => TuicFmt.ToUri(item),
EConfigType.WireGuard => WireguardFmt.ToUri(item),
+ EConfigType.Anytls => AnytlsFmt.ToUri(item),
_ => null,
};
@@ -75,6 +76,10 @@ public class FmtHandler
{
return WireguardFmt.Resolve(str, out msg);
}
+ else if (str.StartsWith(Global.ProtocolShares[EConfigType.Anytls]))
+ {
+ return AnytlsFmt.Resolve(str, out msg);
+ }
else
{
msg = ResUI.NonvmessOrssProtocol;
diff --git a/v2rayN/ServiceLib/Models/Config.cs b/v2rayN/ServiceLib/Models/Config.cs
index 15996608..91b49b29 100644
--- a/v2rayN/ServiceLib/Models/Config.cs
+++ b/v2rayN/ServiceLib/Models/Config.cs
@@ -48,6 +48,7 @@ public class Config
public List Inbound { get; set; }
public List GlobalHotkeys { get; set; }
public List CoreTypeItem { get; set; }
+ public SimpleDNSItem SimpleDNSItem { get; set; }
#endregion other entities
}
diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs
index c6254b9f..998b49f1 100644
--- a/v2rayN/ServiceLib/Models/ConfigItems.cs
+++ b/v2rayN/ServiceLib/Models/ConfigItems.cs
@@ -253,3 +253,21 @@ public class WindowSizeItem
public int Width { get; set; }
public int Height { get; set; }
}
+
+[Serializable]
+public class SimpleDNSItem
+{
+ public bool? UseSystemHosts { get; set; }
+ public bool? AddCommonHosts { get; set; }
+ public bool? FakeIP { get; set; }
+ public bool? BlockBindingQuery { get; set; }
+ public string? DirectDNS { get; set; }
+ public string? RemoteDNS { get; set; }
+ public string? SingboxOutboundsResolveDNS { get; set; }
+ public string? SingboxFinalResolveDNS { get; set; }
+ public string? RayStrategy4Freedom { get; set; }
+ public string? SingboxStrategy4Direct { get; set; }
+ public string? SingboxStrategy4Proxy { get; set; }
+ public string? Hosts { get; set; }
+ public string? DirectExpectedIPs { get; set; }
+}
diff --git a/v2rayN/ServiceLib/Models/DNSItem.cs b/v2rayN/ServiceLib/Models/DNSItem.cs
index 59ab9c9b..9474d906 100644
--- a/v2rayN/ServiceLib/Models/DNSItem.cs
+++ b/v2rayN/ServiceLib/Models/DNSItem.cs
@@ -9,7 +9,7 @@ public class DNSItem
public string Id { get; set; }
public string Remarks { get; set; }
- public bool Enabled { get; set; } = true;
+ public bool Enabled { get; set; } = false;
public ECoreType CoreType { get; set; }
public bool UseSystemHosts { get; set; }
public string? NormalDNS { get; set; }
diff --git a/v2rayN/ServiceLib/Models/SingboxConfig.cs b/v2rayN/ServiceLib/Models/SingboxConfig.cs
index 9ea1157d..cbaf77e6 100644
--- a/v2rayN/ServiceLib/Models/SingboxConfig.cs
+++ b/v2rayN/ServiceLib/Models/SingboxConfig.cs
@@ -1,3 +1,5 @@
+using System.Text.Json.Serialization;
+
namespace ServiceLib.Models;
public class SingboxConfig
@@ -6,6 +8,7 @@ public class SingboxConfig
public Dns4Sbox? dns { get; set; }
public List inbounds { get; set; }
public List outbounds { get; set; }
+ public List? endpoints { get; set; }
public Route4Sbox route { get; set; }
public Experimental4Sbox? experimental { get; set; }
}
@@ -29,14 +32,15 @@ public class Dns4Sbox
public bool? independent_cache { get; set; }
public bool? reverse_mapping { get; set; }
public string? client_subnet { get; set; }
- public Fakeip4Sbox? fakeip { get; set; }
}
public class Route4Sbox
{
+ public Rule4Sbox? default_domain_resolver { get; set; } // or string
public bool? auto_detect_interface { get; set; }
public List rules { get; set; }
public List? rule_set { get; set; }
+ public string? final { get; set; }
}
[Serializable]
@@ -49,6 +53,7 @@ public class Rule4Sbox
public string? mode { get; set; }
public bool? ip_is_private { get; set; }
public string? client_subnet { get; set; }
+ public int? rewrite_ttl { get; set; }
public bool? invert { get; set; }
public string? clash_mode { get; set; }
public List? inbound { get; set; }
@@ -67,6 +72,27 @@ public class Rule4Sbox
public List? process_name { get; set; }
public List? rule_set { get; set; }
public List? rules { get; set; }
+ public string? action { get; set; }
+ public string? strategy { get; set; }
+ public List? sniffer { get; set; }
+ public string? rcode { get; set; }
+ public List? query_type { get; set; }
+ public List? answer { get; set; }
+ public List? ns { get; set; }
+ public List? extra { get; set; }
+ public string? method { get; set; }
+ public bool? no_drop { get; set; }
+ public bool? source_ip_is_private { get; set; }
+ public bool? ip_accept_any { get; set; }
+ public int? source_port { get; set; }
+ public List? source_port_range { get; set; }
+ public List? network_type { get; set; }
+ public bool? network_is_expensive { get; set; }
+ public bool? network_is_constrained { get; set; }
+ public List? wifi_ssid { get; set; }
+ public List? wifi_bssid { get; set; }
+ public bool? rule_set_ip_cidr_match_source { get; set; }
+ public bool? rule_set_ip_cidr_accept_empty { get; set; }
}
[Serializable]
@@ -76,7 +102,6 @@ public class Inbound4Sbox
public string tag { get; set; }
public string listen { get; set; }
public int? listen_port { get; set; }
- public string? domain_strategy { get; set; }
public string interface_name { get; set; }
public List? address { get; set; }
public int? mtu { get; set; }
@@ -84,8 +109,6 @@ public class Inbound4Sbox
public bool? strict_route { get; set; }
public bool? endpoint_independent_nat { get; set; }
public string? stack { get; set; }
- public bool? sniff { get; set; }
- public bool? sniff_override_destination { get; set; }
public List users { get; set; }
}
@@ -95,10 +118,8 @@ public class User4Sbox
public string password { get; set; }
}
-public class Outbound4Sbox
+public class Outbound4Sbox : BaseServer4Sbox
{
- public string type { get; set; }
- public string tag { get; set; }
public string? server { get; set; }
public int? server_port { get; set; }
public List? server_ports { get; set; }
@@ -113,7 +134,6 @@ public class Outbound4Sbox
public int? recv_window_conn { get; set; }
public int? recv_window { get; set; }
public bool? disable_mtu_discovery { get; set; }
- public string? detour { get; set; }
public string? method { get; set; }
public string? username { get; set; }
public string? password { get; set; }
@@ -121,21 +141,36 @@ public class Outbound4Sbox
public string? version { get; set; }
public string? network { get; set; }
public string? packet_encoding { get; set; }
- public List? local_address { get; set; }
- public string? private_key { get; set; }
- public string? peer_public_key { get; set; }
- public List? reserved { get; set; }
- public int? mtu { get; set; }
public string? plugin { get; set; }
public string? plugin_opts { get; set; }
- public Tls4Sbox? tls { get; set; }
- public Multiplex4Sbox? multiplex { get; set; }
- public Transport4Sbox? transport { get; set; }
- public HyObfs4Sbox? obfs { get; set; }
public List? outbounds { get; set; }
public bool? interrupt_exist_connections { get; set; }
}
+public class Endpoints4Sbox : BaseServer4Sbox
+{
+ public bool? system { get; set; }
+ public string? name { get; set; }
+ public int? mtu { get; set; }
+ public List address { get; set; }
+ public string private_key { get; set; }
+ public int? listen_port { get; set; }
+ public string? udp_timeout { get; set; }
+ public int? workers { get; set; }
+ public List peers { get; set; }
+}
+
+public class Peer4Sbox
+{
+ public string address { get; set; }
+ public int port { get; set; }
+ public string public_key { get; set; }
+ public string? pre_shared_key { get; set; }
+ public List allowed_ips { get; set; }
+ public int? persistent_keepalive_interval { get; set; }
+ public List reserved { get; set; }
+}
+
public class Tls4Sbox
{
public bool enabled { get; set; }
@@ -191,15 +226,25 @@ public class HyObfs4Sbox
public string? password { get; set; }
}
-public class Server4Sbox
+public class Server4Sbox : BaseServer4Sbox
{
- public string? tag { get; set; }
+ public string? inet4_range { get; set; }
+ public string? inet6_range { get; set; }
+ public string? client_subnet { get; set; }
+ public string? server { get; set; }
+ public new string? domain_resolver { get; set; }
+ [JsonPropertyName("interface")] public string? Interface { get; set; }
+ public int? server_port { get; set; }
+ public string? path { get; set; }
+ public Headers4Sbox? headers { get; set; }
+ // public List? path { get; set; } // hosts
+ public Dictionary>? predefined { get; set; }
+ // Deprecated
public string? address { get; set; }
public string? address_resolver { get; set; }
public string? address_strategy { get; set; }
public string? strategy { get; set; }
- public string? detour { get; set; }
- public string? client_subnet { get; set; }
+ // Deprecated End
}
public class Experimental4Sbox
@@ -229,13 +274,6 @@ public class Stats4Sbox
public List? users { get; set; }
}
-public class Fakeip4Sbox
-{
- public bool enabled { get; set; }
- public string inet4_range { get; set; }
- public string inet6_range { get; set; }
-}
-
public class CacheFile4Sbox
{
public bool enabled { get; set; }
@@ -254,3 +292,33 @@ public class Ruleset4Sbox
public string? download_detour { get; set; }
public string? update_interval { get; set; }
}
+
+public abstract class DialFields4Sbox
+{
+ public string? detour { get; set; }
+ public string? bind_interface { get; set; }
+ public string? inet4_bind_address { get; set; }
+ public string? inet6_bind_address { get; set; }
+ public int? routing_mark { get; set; }
+ public bool? reuse_addr { get; set; }
+ public string? netns { get; set; }
+ public string? connect_timeout { get; set; }
+ public bool? tcp_fast_open { get; set; }
+ public bool? tcp_multi_path { get; set; }
+ public bool? udp_fragment { get; set; }
+ public Rule4Sbox? domain_resolver { get; set; } // or string
+ public string? network_strategy { get; set; }
+ public List? network_type { get; set; }
+ public List? fallback_network_type { get; set; }
+ public string? fallback_delay { get; set; }
+ public Tls4Sbox? tls { get; set; }
+ public Multiplex4Sbox? multiplex { get; set; }
+ public Transport4Sbox? transport { get; set; }
+ public HyObfs4Sbox? obfs { get; set; }
+}
+
+public abstract class BaseServer4Sbox : DialFields4Sbox
+{
+ public string type { get; set; }
+ public string tag { get; set; }
+}
diff --git a/v2rayN/ServiceLib/Models/V2rayConfig.cs b/v2rayN/ServiceLib/Models/V2rayConfig.cs
index 2e5ed4b4..664ab923 100644
--- a/v2rayN/ServiceLib/Models/V2rayConfig.cs
+++ b/v2rayN/ServiceLib/Models/V2rayConfig.cs
@@ -5,7 +5,7 @@ namespace ServiceLib.Models;
public class V2rayConfig
{
public Log4Ray log { get; set; }
- public object dns { get; set; }
+ public Dns4Ray dns { get; set; }
public List inbounds { get; set; }
public List outbounds { get; set; }
public Routing4Ray routing { get; set; }
@@ -203,7 +203,8 @@ public class Response4Ray
public class Dns4Ray
{
- public List servers { get; set; }
+ public Dictionary>? hosts { get; set; }
+ public List