@@ -1,5 +1,4 @@ | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text.Json.Serialization; | |||||
namespace Shadowsocks.Interop.V2Ray | namespace Shadowsocks.Interop.V2Ray | ||||
{ | { | ||||
@@ -16,6 +16,12 @@ namespace Shadowsocks.Interop.V2Ray.Dns | |||||
/// </summary> | /// </summary> | ||||
public int Port { get; set; } | public int Port { get; set; } | ||||
/// <summary> | |||||
/// Gets or sets the client IP | |||||
/// to include in DNS queries. | |||||
/// </summary> | |||||
public string? ClientIp { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// Gets or sets the list of domains | /// Gets or sets the list of domains | ||||
/// that prefers this DNS server. | /// that prefers this DNS server. | ||||
@@ -23,6 +23,15 @@ namespace Shadowsocks.Interop.V2Ray | |||||
/// </summary> | /// </summary> | ||||
public string? ClientIp { get; set; } | public string? ClientIp { get; set; } | ||||
/// <summary> | |||||
/// Gets or sets whether to disable internal DNS cache. | |||||
/// Defaults to false, or DNS cache is enabled. | |||||
/// </summary> | |||||
public bool DisableCache { get; set; } | |||||
/// <summary> | |||||
/// Gets or sets the inbound tag for DNS traffic. | |||||
/// </summary> | |||||
public string? Tag { get; set; } | public string? Tag { get; set; } | ||||
public DnsObject() | public DnsObject() | ||||
@@ -0,0 +1,15 @@ | |||||
namespace Shadowsocks.Interop.V2Ray | |||||
{ | |||||
public class FakeDnsObject | |||||
{ | |||||
/// <summary> | |||||
/// Gets or sets the IP pool CIDR. | |||||
/// </summary> | |||||
public string IpPool { get; set; } = "240.0.0.0/8"; | |||||
/// <summary> | |||||
/// Gets or sets the IP pool size. | |||||
/// </summary> | |||||
public long PoolSize { get; set; } = 65535L; | |||||
} | |||||
} |
@@ -15,6 +15,14 @@ namespace Shadowsocks.Interop.V2Ray.Inbound | |||||
/// </summary> | /// </summary> | ||||
public List<string> DestOverride { get; set; } | public List<string> DestOverride { get; set; } | ||||
/// <summary> | |||||
/// Gets or sets whether the target address is sniffed | |||||
/// solely based on metadata. | |||||
/// Defaults to false. | |||||
/// Change to true to use FakeDNS. | |||||
/// </summary> | |||||
public bool MetadataOnly { get; set; } | |||||
public SniffingObject() | public SniffingObject() | ||||
{ | { | ||||
Enabled = true; | Enabled = true; | ||||
@@ -24,5 +32,27 @@ namespace Shadowsocks.Interop.V2Ray.Inbound | |||||
"tls", | "tls", | ||||
}; | }; | ||||
} | } | ||||
public static SniffingObject Default => new() | |||||
{ | |||||
Enabled = false, | |||||
DestOverride = new() | |||||
{ | |||||
"http", | |||||
"tls", | |||||
}, | |||||
}; | |||||
public static SniffingObject DefaultFakeDns => new() | |||||
{ | |||||
Enabled = true, | |||||
DestOverride = new() | |||||
{ | |||||
"http", | |||||
"tls", | |||||
"fakedns", | |||||
}, | |||||
MetadataOnly = true, | |||||
}; | |||||
} | } | ||||
} | } |
@@ -27,10 +27,7 @@ namespace Shadowsocks.Interop.V2Ray | |||||
Port = 1080, | Port = 1080, | ||||
Protocol = "socks", | Protocol = "socks", | ||||
Settings = Protocols.Socks.InboundConfigurationObject.Default, | Settings = Protocols.Socks.InboundConfigurationObject.Default, | ||||
Sniffing = new() | |||||
{ | |||||
Enabled = false, | |||||
}, | |||||
Sniffing = SniffingObject.Default, | |||||
}; | }; | ||||
public static InboundObject DefaultLocalHttp => new() | public static InboundObject DefaultLocalHttp => new() | ||||
@@ -39,10 +36,7 @@ namespace Shadowsocks.Interop.V2Ray | |||||
Listen = "127.0.0.1", | Listen = "127.0.0.1", | ||||
Port = 8080, | Port = 8080, | ||||
Protocol = "http", | Protocol = "http", | ||||
Sniffing = new() | |||||
{ | |||||
Enabled = false, | |||||
}, | |||||
Sniffing = SniffingObject.Default, | |||||
}; | }; | ||||
} | } | ||||
} | } |
@@ -8,9 +8,23 @@ namespace Shadowsocks.Interop.V2Ray.Outbound | |||||
/// </summary> | /// </summary> | ||||
public string Tag { get; set; } | public string Tag { get; set; } | ||||
/// <summary> | |||||
/// Gets or sets whether to keep the protocol | |||||
/// itself's transport layer intact. | |||||
/// Defaults to false, or only proxy internal TCP traffic. | |||||
/// Set to true to proxy the protocol. | |||||
/// The tag will act as a forward proxy. | |||||
/// </summary> | |||||
public bool TransportLayer { get; set; } | |||||
public ProxySettingsObject() | public ProxySettingsObject() | ||||
{ | { | ||||
Tag = ""; | Tag = ""; | ||||
} | } | ||||
public static ProxySettingsObject Default => new() | |||||
{ | |||||
TransportLayer = true, | |||||
}; | |||||
} | } | ||||
} | } |
@@ -12,6 +12,13 @@ namespace Shadowsocks.Interop.V2Ray | |||||
/// </summary> | /// </summary> | ||||
public string DomainStrategy { get; set; } | public string DomainStrategy { get; set; } | ||||
/// <summary> | |||||
/// Gets or sets the domain matcher used for routing. | |||||
/// Default value: "" (binary search). | |||||
/// Available values: "" | "hybrid" | |||||
/// </summary> | |||||
public string DomainMatcher { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// Gets or sets the list of routing rules. | /// Gets or sets the list of routing rules. | ||||
/// </summary> | /// </summary> | ||||
@@ -25,9 +32,16 @@ namespace Shadowsocks.Interop.V2Ray | |||||
public RoutingObject() | public RoutingObject() | ||||
{ | { | ||||
DomainStrategy = "AsIs"; | DomainStrategy = "AsIs"; | ||||
DomainMatcher = ""; | |||||
Rules = new(); | Rules = new(); | ||||
} | } | ||||
public static RoutingObject Default => new() | |||||
{ | |||||
DomainStrategy = "IPOnDemand", | |||||
DomainMatcher = "hybrid", | |||||
}; | |||||
public static RoutingObject DefaultBalancers => new() | public static RoutingObject DefaultBalancers => new() | ||||
{ | { | ||||
Balancers = new(), | Balancers = new(), | ||||