mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-25 14:46:08 +03:00
add new protocol
This commit is contained in:
parent
d6242fb49b
commit
66b7191394
@ -27,9 +27,16 @@ namespace ProxySU_Core.Models.Developers
|
||||
|
||||
public const int VLESS_TCP_Port = 1110;
|
||||
public const int VLESS_WS_Port = 1111;
|
||||
public const int VLESS_H2_Port = 1112;
|
||||
public const int VLESS_mKCP_Port = 1113;
|
||||
|
||||
public const int VMESS_TCP_Port = 2110;
|
||||
public const int VMESS_WS_Port = 2111;
|
||||
public const int VMESS_H2_Port = 2112;
|
||||
public const int VMESS_mKCP_Port = 2113;
|
||||
|
||||
public const int Trojan_TCP_Port = 3110;
|
||||
public const int Trojan_WS_Port = 3111;
|
||||
|
||||
|
||||
public static dynamic LoadXrayConfig()
|
||||
@ -92,8 +99,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
baseBound.port = parameters.Port;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
dest = 80,
|
||||
xver = 1,
|
||||
dest = 80
|
||||
}));
|
||||
xrayConfig.inbounds.Add(baseBound);
|
||||
baseBound.settings.clients[0].id = parameters.UUID;
|
||||
@ -107,12 +113,30 @@ namespace ProxySU_Core.Models.Developers
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
dest = VLESS_WS_Port,
|
||||
path = parameters.VLESS_WS_Path,
|
||||
xver = 1,
|
||||
path = parameters.VLESS_WS_Path
|
||||
}));
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(wsInbound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VLESS_H2_TLS))
|
||||
{
|
||||
var h2Inbound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_HTTP2_TLS.json"));
|
||||
h2Inbound.port = VLESS_H2_Port;
|
||||
h2Inbound.settings.clients[0].id = parameters.UUID;
|
||||
h2Inbound.streamSettings.httpSettings.path = parameters.VLESS_H2_Path;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
dest = VLESS_H2_Port,
|
||||
path = parameters.VLESS_H2_Path
|
||||
}));
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(h2Inbound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VLESS_mKCP_Speed))
|
||||
{
|
||||
var kcpInbound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_mKCP"));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VMESS_TCP_TLS))
|
||||
{
|
||||
var mtcpBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VMESS_TCP_TLS.json"));
|
||||
@ -143,6 +167,10 @@ namespace ProxySU_Core.Models.Developers
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(mwsBound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VMESS_H2_TLS)) { }
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VMESS_mKCP_Speed)) { }
|
||||
|
||||
if (parameters.Types.Contains(XrayType.Trojan_TCP_TLS))
|
||||
{
|
||||
var trojanTcpBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "Trojan_TCP_TLS.json"));
|
||||
@ -156,6 +184,8 @@ namespace ProxySU_Core.Models.Developers
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.Trojan_WS_TLS)) { }
|
||||
|
||||
return JsonConvert.SerializeObject(
|
||||
xrayConfig,
|
||||
Formatting.Indented,
|
||||
|
@ -46,6 +46,16 @@ namespace ProxySU_Core.Models
|
||||
/// </summary>
|
||||
public string VLESS_TCP_Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// vless http2 path
|
||||
/// </summary>
|
||||
public string VLESS_H2_Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// vless mKcp seed
|
||||
/// </summary>
|
||||
public string VLESS_mKCP_Seed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// vmess ws路径
|
||||
/// </summary>
|
||||
@ -56,11 +66,26 @@ namespace ProxySU_Core.Models
|
||||
/// </summary>
|
||||
public string VMESS_TCP_Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// vmess http2 path
|
||||
/// </summary>
|
||||
public string VMESS_HTTP2_Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// vmess mKcp seed
|
||||
/// </summary>
|
||||
public string VMESS_mKCP_Seed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// trojan密码
|
||||
/// </summary>
|
||||
public string TrojanPassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// trojan ws path
|
||||
/// </summary>
|
||||
public string Trojan_WS_Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 域名
|
||||
/// </summary>
|
||||
@ -87,11 +112,20 @@ namespace ProxySU_Core.Models
|
||||
return VLESS_TCP_Path;
|
||||
case XrayType.VLESS_WS_TLS:
|
||||
return VLESS_WS_Path;
|
||||
case XrayType.VLESS_H2_TLS:
|
||||
return VLESS_H2_Path;
|
||||
|
||||
case XrayType.VMESS_TCP_TLS:
|
||||
return VMESS_TCP_Path;
|
||||
case XrayType.VMESS_WS_TLS:
|
||||
return VMESS_WS_Path;
|
||||
case XrayType.Trojan_WS_TLS:
|
||||
return Trojan_WS_Path;
|
||||
|
||||
// no path
|
||||
case XrayType.VLESS_mKCP_Speed:
|
||||
case XrayType.Trojan_TCP_TLS:
|
||||
case XrayType.VMESS_mKCP_Speed:
|
||||
return string.Empty;
|
||||
default:
|
||||
return string.Empty;
|
||||
@ -103,13 +137,23 @@ namespace ProxySU_Core.Models
|
||||
|
||||
public enum XrayType
|
||||
{
|
||||
VLESS_TCP_TLS,
|
||||
VLESS_TCP_XTLS,
|
||||
VLESS_WS_TLS,
|
||||
// 入口
|
||||
VLESS_TCP_XTLS = 100,
|
||||
|
||||
VMESS_TCP_TLS,
|
||||
VMESS_WS_TLS,
|
||||
// vless 101开头
|
||||
VLESS_TCP_TLS = 101,
|
||||
VLESS_WS_TLS = 102,
|
||||
VLESS_H2_TLS = 103,
|
||||
VLESS_mKCP_Speed = 104,
|
||||
|
||||
Trojan_TCP_TLS,
|
||||
// vmess 201开头
|
||||
VMESS_TCP_TLS = 201,
|
||||
VMESS_WS_TLS = 202,
|
||||
VMESS_H2_TLS = 203,
|
||||
VMESS_mKCP_Speed = 204,
|
||||
|
||||
// trojan 301开头
|
||||
Trojan_TCP_TLS = 301,
|
||||
Trojan_WS_TLS = 302,
|
||||
}
|
||||
}
|
||||
|
@ -244,12 +244,24 @@
|
||||
<None Include="Templates\xray\server\05_inbounds\Trojan_WS_TLS.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VLESS_HTTP2_TLS.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VLESS_mKCP.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VLESS_TCP_XTLS.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VLESS_WS_TLS.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VMESS_HTTP2_TLS.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VMESS_mKCP.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\VMESS_TCP_TLS.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -5,9 +5,7 @@
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"password": "",
|
||||
"level": 0,
|
||||
"email": "love@example.com"
|
||||
"password": ""
|
||||
}
|
||||
],
|
||||
"fallbacks": [
|
||||
|
@ -5,9 +5,7 @@
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"password": "",
|
||||
"level": 0,
|
||||
"email": "love@example.com"
|
||||
"password": ""
|
||||
}
|
||||
],
|
||||
"fallbacks": [
|
||||
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"port": 1234,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"decryption": "none",
|
||||
"clients": [
|
||||
{
|
||||
"id": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "h2",
|
||||
"httpSettings": {
|
||||
"path": ""
|
||||
}
|
||||
}
|
||||
}
|
@ -5,9 +5,7 @@
|
||||
"clients": [
|
||||
{
|
||||
"id": "",
|
||||
"flow": "xtls-rprx-direct",
|
||||
"level": 0,
|
||||
"email": "love@example.com"
|
||||
"flow": "xtls-rprx-direct"
|
||||
}
|
||||
],
|
||||
"decryption": "none",
|
||||
@ -17,9 +15,7 @@
|
||||
"network": "tcp",
|
||||
"security": "xtls",
|
||||
"xtlsSettings": {
|
||||
"alpn": [
|
||||
"http/1.1"
|
||||
],
|
||||
"alpn": [ "h2", "http/1.1" ],
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
|
||||
|
@ -5,9 +5,7 @@
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "",
|
||||
"level": 0,
|
||||
"email": "love@example.com"
|
||||
"id": ""
|
||||
}
|
||||
],
|
||||
"decryption": "none"
|
||||
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"port": 3456,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "mkcp",
|
||||
"kcpSettings": {
|
||||
"uplinkCapacity": 100,
|
||||
"downlinkCapacity": 100,
|
||||
"congestion": true,
|
||||
"header": {
|
||||
"type": "none"
|
||||
},
|
||||
"seed": null
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"port": 1234,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "h2",
|
||||
"httpSettings": {
|
||||
"path": ""
|
||||
}
|
||||
}
|
||||
}
|
@ -5,9 +5,7 @@
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "",
|
||||
"level": 0,
|
||||
"email": "love@example.com"
|
||||
"id": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -5,9 +5,7 @@
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "",
|
||||
"level": 0,
|
||||
"email": "love@example.com"
|
||||
"id": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"port": 3456,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "mkcp",
|
||||
"kcpSettings": {
|
||||
"uplinkCapacity": 100,
|
||||
"downlinkCapacity": 100,
|
||||
"congestion": true,
|
||||
"header": {
|
||||
"type": "none"
|
||||
},
|
||||
"seed": null
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user