mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
V2RAY FOR ALL
This commit is contained in:
@@ -57,7 +57,7 @@ public static class MainController
|
||||
// Start Server Controller to get a local socks5 server
|
||||
Log.Debug("Server Information: {Data}", $"{server.Type} {server.MaskedData()}");
|
||||
|
||||
ServerController = ServerHelper.GetUtilByTypeName(server.Type).GetController();
|
||||
ServerController = V2rayController();
|
||||
Global.MainForm.StatusText(i18N.TranslateFormat("Starting {0}", ServerController.Name));
|
||||
|
||||
TryReleaseTcpPort(ServerController.Socks5LocalPort(), "Socks5");
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ShadowsocksServer : Server
|
||||
/// <summary>
|
||||
/// 加密方式
|
||||
/// </summary>
|
||||
public string EncryptMethod { get; set; } = SSGlobal.EncryptMethods[0];
|
||||
public string EncryptMethod { get; set; } = SSGlobal.EncryptMethods[4];
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
@@ -43,24 +43,44 @@ public static class SSGlobal
|
||||
/// </summary>
|
||||
public static readonly List<string> EncryptMethods = new()
|
||||
{
|
||||
"rc4-md5",
|
||||
"aes-128-gcm",
|
||||
"aes-192-gcm",
|
||||
"aes-256-gcm",
|
||||
"aes-128-cfb",
|
||||
"aes-192-cfb",
|
||||
"aes-256-cfb",
|
||||
"aes-128-ctr",
|
||||
"aes-192-ctr",
|
||||
"aes-256-ctr",
|
||||
"camellia-128-cfb",
|
||||
"camellia-192-cfb",
|
||||
"camellia-256-cfb",
|
||||
"bf-cfb",
|
||||
"chacha20-ietf-poly1305",
|
||||
"xchacha20-ietf-poly1305",
|
||||
"salsa20",
|
||||
"chacha20",
|
||||
"chacha20-ietf"
|
||||
'none',
|
||||
'2022-blake3-aes-128-gcm',
|
||||
'2022-blake3-aes-256-gcm',
|
||||
'2022-blake3-chacha20-poly1305',
|
||||
'aes-128-gcm',
|
||||
'aes-192-gcm',
|
||||
'aes-256-gcm',
|
||||
'chacha20-ietf-poly1305',
|
||||
'xchacha20-ietf-poly1305',
|
||||
'rc4',
|
||||
'rc4-md5',
|
||||
'aes-128-ctr',
|
||||
'aes-192-ctr',
|
||||
'aes-256-ctr',
|
||||
'aes-128-cfb',
|
||||
'aes-192-cfb',
|
||||
'aes-256-cfb',
|
||||
'aes-128-cfb8',
|
||||
'aes-192-cfb8',
|
||||
'aes-256-cfb8',
|
||||
'aes-128-ofb',
|
||||
'aes-192-ofb',
|
||||
'aes-256-ofb',
|
||||
'bf-cfb',
|
||||
'cast5-cfb',
|
||||
'des-cfb',
|
||||
'idea-cfb',
|
||||
'rc2-cfb',
|
||||
'seed-cfb',
|
||||
'camellia-128-cfb',
|
||||
'camellia-192-cfb',
|
||||
'camellia-256-cfb',
|
||||
'camellia-128-cfb8',
|
||||
'camellia-192-cfb8',
|
||||
'camellia-256-cfb8',
|
||||
'salsa20',
|
||||
'chacha20',
|
||||
'chacha20-ietf',
|
||||
'xchacha20'
|
||||
};
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class ShadowsocksRServer : Server
|
||||
/// <summary>
|
||||
/// 加密方式
|
||||
/// </summary>
|
||||
public string EncryptMethod { get; set; } = SSRGlobal.EncryptMethods[0];
|
||||
public string EncryptMethod { get; set; } = SSRGlobal.EncryptMethods[4];
|
||||
|
||||
/// <summary>
|
||||
/// 协议
|
||||
@@ -49,11 +49,11 @@ public class SSRGlobal
|
||||
public static readonly List<string> Protocols = new()
|
||||
{
|
||||
"origin",
|
||||
"verify_deflate",
|
||||
"auth_sha1_v4",
|
||||
"auth_aes128_md5",
|
||||
"auth_aes128_sha1",
|
||||
"auth_chain_a"
|
||||
"auth_chain_a",
|
||||
"auth_chain_b"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
@@ -64,36 +64,14 @@ public class SSRGlobal
|
||||
"plain",
|
||||
"http_simple",
|
||||
"http_post",
|
||||
"tls1.2_ticket_auth"
|
||||
"tls_simple",
|
||||
"tls1.2_ticket_auth",
|
||||
"tls1.2_ticket_fastauth",
|
||||
"random_head"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// SS/SSR 加密方式
|
||||
/// </summary>
|
||||
public static readonly List<string> EncryptMethods = new()
|
||||
{
|
||||
"none",
|
||||
"table",
|
||||
"rc4",
|
||||
"rc4-md5",
|
||||
"rc4-md5-6",
|
||||
"aes-128-cfb",
|
||||
"aes-192-cfb",
|
||||
"aes-256-cfb",
|
||||
"aes-128-ctr",
|
||||
"aes-192-ctr",
|
||||
"aes-256-ctr",
|
||||
"bf-cfb",
|
||||
"camellia-128-cfb",
|
||||
"camellia-192-cfb",
|
||||
"camellia-256-cfb",
|
||||
"cast5-cfb",
|
||||
"des-cfb",
|
||||
"idea-cfb",
|
||||
"rc2-cfb",
|
||||
"seed-cfb",
|
||||
"salsa20",
|
||||
"chacha20",
|
||||
"chacha20-ietf"
|
||||
};
|
||||
public static readonly List<string> EncryptMethods = SSGlobal.EncryptMethods;
|
||||
}
|
||||
@@ -29,9 +29,9 @@ public class Outbound
|
||||
|
||||
public OutboundConfiguration settings { get; set; }
|
||||
|
||||
public StreamSettings streamSettings { get; set; }
|
||||
public StreamSettings? streamSettings { get; set; }
|
||||
|
||||
public Mux mux { get; set; }
|
||||
public Mux? mux { get; set; }
|
||||
}
|
||||
|
||||
public class OutboundConfiguration
|
||||
@@ -41,6 +41,12 @@ public class OutboundConfiguration
|
||||
public object[] servers { get; set; }
|
||||
|
||||
public string packetEncoding { get; set; }
|
||||
|
||||
public string plugin { get; set; }
|
||||
|
||||
public string pluginOpts { get; set; }
|
||||
|
||||
public string[] pluginArgs { get; set; }
|
||||
}
|
||||
|
||||
public class VnextItem
|
||||
@@ -52,6 +58,17 @@ public class VnextItem
|
||||
public User[] users { get; set; }
|
||||
}
|
||||
|
||||
public class ShadowsocksServerItem
|
||||
{
|
||||
public string address { get; set; }
|
||||
|
||||
public ushort port { get; set; }
|
||||
|
||||
public string method { get; set; }
|
||||
|
||||
public string password { get; set; }
|
||||
}
|
||||
|
||||
public class Mux
|
||||
{
|
||||
public bool enabled { get; set; }
|
||||
|
||||
@@ -138,6 +138,62 @@ public static class V2rayConfigUtils
|
||||
outbound.mux.concurrency = vmess.UseMux ?? Global.Settings.V2RayConfig.UseMux ? 8 : -1;
|
||||
break;
|
||||
}
|
||||
case ShadowsocksServer ss:
|
||||
outbound.protocol = "shadowsocks";
|
||||
outbound.settings = new OutboundConfiguration
|
||||
{
|
||||
servers = new[]
|
||||
{
|
||||
new ShadowsocksServerItem
|
||||
{
|
||||
address = await server.AutoResolveHostnameAsync(),
|
||||
port = server.Port,
|
||||
method = ss.EncryptMethod,
|
||||
password = ss.Password,
|
||||
}
|
||||
},
|
||||
plugin = ss.Plugin ?? "",
|
||||
pluginOpts = ss.PluginOption ?? ""
|
||||
}
|
||||
break;
|
||||
case ShadowsocksRServer ssr:
|
||||
outbound.protocol = "shadowsocks";
|
||||
outbound.settings = new OutboundConfiguration
|
||||
{
|
||||
servers = new[]
|
||||
{
|
||||
new ShadowsocksServerItem
|
||||
{
|
||||
address = await server.AutoResolveHostnameAsync(),
|
||||
port = server.Port,
|
||||
method = ssr.EncryptMethod,
|
||||
password = ssr.Password,
|
||||
}
|
||||
},
|
||||
plugin = "shadowsocksr",
|
||||
pluginArgs = new string[]
|
||||
{
|
||||
"--obfs=" + ssr.OBFS,
|
||||
"--obfs-param=" + ssr.OBFSParam ?? "",
|
||||
"--protocol=" + ssr.Protocol,
|
||||
"--protocol-param=" + ssr.ProtocolParam ?? ""
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TrojanServer trojan:
|
||||
outbound.protocol = "trojan_sing";
|
||||
outbound.settings.servers = new[]
|
||||
{
|
||||
new ShadowsocksServerItem // I'm not serious
|
||||
{
|
||||
address = await server.AutoResolveHostnameAsync(),
|
||||
port = server.Port,
|
||||
method = "",
|
||||
password = trojan.Password
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return outbound;
|
||||
|
||||
Reference in New Issue
Block a user