Browse Source

🐿 Interop: v2ray

pull/3127/head
database64128 3 years ago
parent
commit
fb34b50522
No known key found for this signature in database GPG Key ID: 1CA27546BEDB8B01
8 changed files with 90 additions and 9 deletions
  1. +0
    -1
      Shadowsocks.Interop/V2Ray/Config.cs
  2. +6
    -0
      Shadowsocks.Interop/V2Ray/Dns/ServerObject.cs
  3. +9
    -0
      Shadowsocks.Interop/V2Ray/DnsObject.cs
  4. +15
    -0
      Shadowsocks.Interop/V2Ray/FakeDnsObject.cs
  5. +30
    -0
      Shadowsocks.Interop/V2Ray/Inbound/SniffingObject.cs
  6. +2
    -8
      Shadowsocks.Interop/V2Ray/InboundObject.cs
  7. +14
    -0
      Shadowsocks.Interop/V2Ray/Outbound/ProxySettingsObject.cs
  8. +14
    -0
      Shadowsocks.Interop/V2Ray/RoutingObject.cs

+ 0
- 1
Shadowsocks.Interop/V2Ray/Config.cs View File

@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Shadowsocks.Interop.V2Ray
{


+ 6
- 0
Shadowsocks.Interop/V2Ray/Dns/ServerObject.cs View File

@@ -16,6 +16,12 @@ namespace Shadowsocks.Interop.V2Ray.Dns
/// </summary>
public int Port { get; set; }

/// <summary>
/// Gets or sets the client IP
/// to include in DNS queries.
/// </summary>
public string? ClientIp { get; set; }

/// <summary>
/// Gets or sets the list of domains
/// that prefers this DNS server.


+ 9
- 0
Shadowsocks.Interop/V2Ray/DnsObject.cs View File

@@ -23,6 +23,15 @@ namespace Shadowsocks.Interop.V2Ray
/// </summary>
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 DnsObject()


+ 15
- 0
Shadowsocks.Interop/V2Ray/FakeDnsObject.cs View File

@@ -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;
}
}

+ 30
- 0
Shadowsocks.Interop/V2Ray/Inbound/SniffingObject.cs View File

@@ -15,6 +15,14 @@ namespace Shadowsocks.Interop.V2Ray.Inbound
/// </summary>
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()
{
Enabled = true;
@@ -24,5 +32,27 @@ namespace Shadowsocks.Interop.V2Ray.Inbound
"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,
};
}
}

+ 2
- 8
Shadowsocks.Interop/V2Ray/InboundObject.cs View File

@@ -27,10 +27,7 @@ namespace Shadowsocks.Interop.V2Ray
Port = 1080,
Protocol = "socks",
Settings = Protocols.Socks.InboundConfigurationObject.Default,
Sniffing = new()
{
Enabled = false,
},
Sniffing = SniffingObject.Default,
};

public static InboundObject DefaultLocalHttp => new()
@@ -39,10 +36,7 @@ namespace Shadowsocks.Interop.V2Ray
Listen = "127.0.0.1",
Port = 8080,
Protocol = "http",
Sniffing = new()
{
Enabled = false,
},
Sniffing = SniffingObject.Default,
};
}
}

+ 14
- 0
Shadowsocks.Interop/V2Ray/Outbound/ProxySettingsObject.cs View File

@@ -8,9 +8,23 @@ namespace Shadowsocks.Interop.V2Ray.Outbound
/// </summary>
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()
{
Tag = "";
}

public static ProxySettingsObject Default => new()
{
TransportLayer = true,
};
}
}

+ 14
- 0
Shadowsocks.Interop/V2Ray/RoutingObject.cs View File

@@ -12,6 +12,13 @@ namespace Shadowsocks.Interop.V2Ray
/// </summary>
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>
/// Gets or sets the list of routing rules.
/// </summary>
@@ -25,9 +32,16 @@ namespace Shadowsocks.Interop.V2Ray
public RoutingObject()
{
DomainStrategy = "AsIs";
DomainMatcher = "";
Rules = new();
}

public static RoutingObject Default => new()
{
DomainStrategy = "IPOnDemand",
DomainMatcher = "hybrid",
};

public static RoutingObject DefaultBalancers => new()
{
Balancers = new(),


Loading…
Cancel
Save