mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-21 20:56:08 +03:00
submit kcp ss.
This commit is contained in:
parent
754aff18a4
commit
6d1d45e945
@ -38,6 +38,8 @@ namespace ProxySU_Core.Models.Developers
|
||||
public const int Trojan_TCP_Port = 3110;
|
||||
public const int Trojan_WS_Port = 3111;
|
||||
|
||||
public const int ShadowSocksPort = 4110;
|
||||
|
||||
|
||||
public static dynamic LoadXrayConfig()
|
||||
{
|
||||
@ -95,7 +97,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
public static string BuildXrayConfig(XraySettings parameters)
|
||||
{
|
||||
var xrayConfig = LoadXrayConfig();
|
||||
var baseBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_TCP_XTLS.json"));
|
||||
var baseBound = GetBound("VLESS_TCP_XTLS.json");
|
||||
baseBound.port = parameters.Port;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
@ -106,7 +108,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VLESS_WS))
|
||||
{
|
||||
var wsInbound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VLESS_WS_TLS.json"));
|
||||
var wsInbound = GetBound("VLESS_WS.json");
|
||||
wsInbound.port = VLESS_WS_Port;
|
||||
wsInbound.settings.clients[0].id = parameters.UUID;
|
||||
wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
|
||||
@ -119,26 +121,9 @@ namespace ProxySU_Core.Models.Developers
|
||||
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,
|
||||
// xver = 1,
|
||||
// }));
|
||||
// xrayConfig.inbounds.Add(JToken.FromObject(h2Inbound));
|
||||
//}
|
||||
|
||||
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VMESS_TCP))
|
||||
{
|
||||
var mtcpBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VMESS_TCP_TLS.json"));
|
||||
var mtcpBound = GetBound("VMESS_TCP.json");
|
||||
mtcpBound.port = VMESS_TCP_Port;
|
||||
mtcpBound.settings.clients[0].id = parameters.UUID;
|
||||
mtcpBound.streamSettings.tcpSettings.header.request.path = parameters.VMESS_TCP_Path;
|
||||
@ -153,7 +138,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VMESS_WS))
|
||||
{
|
||||
var mwsBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "VMESS_WS_TLS.json"));
|
||||
var mwsBound = GetBound("VMESS_WS.json");
|
||||
mwsBound.port = VMESS_WS_Port;
|
||||
mwsBound.settings.clients[0].id = parameters.UUID;
|
||||
mwsBound.streamSettings.wsSettings.path = parameters.VMESS_WS_Path;
|
||||
@ -168,7 +153,7 @@ namespace ProxySU_Core.Models.Developers
|
||||
|
||||
if (parameters.Types.Contains(XrayType.Trojan_TCP))
|
||||
{
|
||||
var trojanTcpBound = LoadJsonObj(Path.Combine(ServerInboundsDir, "Trojan_TCP_TLS.json"));
|
||||
var trojanTcpBound = GetBound("Trojan_TCP.json");
|
||||
trojanTcpBound.port = Trojan_TCP_Port;
|
||||
trojanTcpBound.settings.clients[0].password = parameters.TrojanPassword;
|
||||
baseBound.settings.fallbacks[0] = JToken.FromObject(new
|
||||
@ -179,7 +164,25 @@ namespace ProxySU_Core.Models.Developers
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(trojanTcpBound));
|
||||
}
|
||||
|
||||
if (parameters.Types.Contains(XrayType.Trojan_WS)) { }
|
||||
if (parameters.Types.Contains(XrayType.VMESS_KCP))
|
||||
{
|
||||
var kcpBound = GetBound("VMESS_KCP.json");
|
||||
kcpBound.port = VMESS_mKCP_Port;
|
||||
kcpBound.settings.clients[0].id = parameters.UUID;
|
||||
kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
|
||||
kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||
}
|
||||
|
||||
|
||||
if (parameters.Types.Contains(XrayType.ShadowsocksAEAD))
|
||||
{
|
||||
var ssBound = GetBound("Shadowsocks-AEAD.json");
|
||||
ssBound.port = ShadowSocksPort;
|
||||
ssBound.settings.clients[0].password = parameters.ShadowsocksPassword;
|
||||
ssBound.settings.clients[0].method = parameters.ShadowsocksMethod;
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(ssBound));
|
||||
}
|
||||
|
||||
return JsonConvert.SerializeObject(
|
||||
xrayConfig,
|
||||
@ -190,6 +193,11 @@ namespace ProxySU_Core.Models.Developers
|
||||
});
|
||||
}
|
||||
|
||||
private static dynamic GetBound(string name)
|
||||
{
|
||||
return LoadJsonObj(Path.Combine(ServerInboundsDir, name));
|
||||
}
|
||||
|
||||
private static dynamic LoadJsonObj(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
|
@ -1,5 +1,6 @@
|
||||
using Newtonsoft.Json;
|
||||
using ProxySU_Core.Common;
|
||||
using ProxySU_Core.Models.Developers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -13,6 +14,7 @@ namespace ProxySU_Core.Models
|
||||
{
|
||||
public static string Build(XrayType xrayType, XraySettings settings)
|
||||
{
|
||||
|
||||
switch (xrayType)
|
||||
{
|
||||
case XrayType.VLESS_TCP:
|
||||
@ -22,12 +24,25 @@ namespace ProxySU_Core.Models
|
||||
return BuildVlessShareLink(xrayType, settings);
|
||||
case XrayType.VMESS_TCP:
|
||||
case XrayType.VMESS_WS:
|
||||
case XrayType.VMESS_KCP:
|
||||
return BuildVmessShareLink(xrayType, settings);
|
||||
case XrayType.ShadowsocksAEAD:
|
||||
return BuildShadowSocksShareLink(settings);
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
private static string BuildShadowSocksShareLink(XraySettings settings)
|
||||
{
|
||||
var _method = settings.ShadowsocksMethod;
|
||||
var _password = settings.ShadowsocksPassword;
|
||||
var _server = settings.Domain;
|
||||
var _port = ConfigBuilder.ShadowSocksPort;
|
||||
|
||||
var base64URL = Base64.Encode($"{_method}:{_password}@{_server}:{_port}");
|
||||
return "ss://" + base64URL;
|
||||
}
|
||||
|
||||
private static string BuildVmessShareLink(XrayType xrayType, XraySettings settings)
|
||||
{
|
||||
@ -46,7 +61,6 @@ namespace ProxySU_Core.Models
|
||||
ps = "",
|
||||
};
|
||||
|
||||
|
||||
switch (xrayType)
|
||||
{
|
||||
case XrayType.VMESS_TCP:
|
||||
@ -61,6 +75,14 @@ namespace ProxySU_Core.Models
|
||||
vmess.type = "none";
|
||||
vmess.path = settings.VMESS_WS_Path;
|
||||
break;
|
||||
case XrayType.VMESS_KCP:
|
||||
vmess.ps = "vmess-mKCP";
|
||||
vmess.port = ConfigBuilder.VMESS_mKCP_Port.ToString();
|
||||
vmess.net = "kcp";
|
||||
vmess.type = settings.VMESS_KCP_Type;
|
||||
vmess.path = settings.VMESS_KCP_Seed;
|
||||
vmess.tls = "";
|
||||
break;
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
@ -120,6 +142,7 @@ namespace ProxySU_Core.Models
|
||||
break;
|
||||
case XrayType.Trojan_TCP:
|
||||
_protocol = "trojan";
|
||||
_uuid = settings.TrojanPassword;
|
||||
_descriptiveText = "trojan-tcp";
|
||||
break;
|
||||
default:
|
||||
|
@ -243,7 +243,9 @@
|
||||
<None Include="Templates\xray\server\05_inbounds\05_inbounds.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\Shadowsocks-AEAD.json" />
|
||||
<None Include="Templates\xray\server\05_inbounds\Shadowsocks-AEAD.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Templates\xray\server\05_inbounds\Trojan_TCP.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -4,7 +4,7 @@
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"password": "example_user_1",
|
||||
"password": "",
|
||||
"method": "aes-128-gcm"
|
||||
}
|
||||
],
|
||||
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"port": 3456,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "vless",
|
||||
"settings": {
|
||||
"clients": [
|
||||
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"port": 3456,
|
||||
"listen": "127.0.0.1",
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
||||
|
@ -45,7 +45,6 @@ namespace ProxySU_Core.ViewModels
|
||||
set => settings.MaskDomain = value;
|
||||
}
|
||||
|
||||
|
||||
public string TrojanPassword
|
||||
{
|
||||
get => settings.TrojanPassword;
|
||||
@ -165,11 +164,11 @@ namespace ProxySU_Core.ViewModels
|
||||
get => settings.VMESS_WS_Path;
|
||||
set => settings.VMESS_WS_Path = value;
|
||||
}
|
||||
public string VMESS_WS_TLS_ShareLink
|
||||
public string VMESS_WS_ShareLink
|
||||
{
|
||||
get => ShareLink.Build(XrayType.VMESS_WS, settings);
|
||||
}
|
||||
|
||||
|
||||
// vmess kcp
|
||||
public string VMESS_KCP_Seed
|
||||
{
|
||||
|
@ -5,8 +5,11 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:metro="http://metro.mahapps.com/winfx/xaml/controls"
|
||||
xmlns:local="clr-namespace:ProxySU_Core.Views"
|
||||
xmlns:dev="clr-namespace:ProxySU_Core.Models.Developers"
|
||||
mc:Ignorable="d"
|
||||
Title="查看配置" Height="450" Width="800">
|
||||
Title="查看配置" Height="500" Width="800">
|
||||
|
||||
|
||||
<Grid>
|
||||
<TabControl
|
||||
Background="#fff"
|
||||
@ -69,7 +72,7 @@
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VLESS_XTLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.VLESS_TCP_XTLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
@ -191,7 +194,7 @@
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VLESS_WS_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.VLESS_WS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
@ -247,7 +250,7 @@
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_TCP_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.VMESS_TCP_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
@ -303,7 +306,63 @@
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_WS_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.VMESS_WS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Width="200"
|
||||
IsEnabled="{Binding Settings.Checked_VMESS_WS}"
|
||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
|
||||
Header="VMESS-mKCP">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="地址(address)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="端口(port)" Width="120" />
|
||||
<TextBox Text="{Binding Source={x:Static dev:ConfigBuilder.VMESS_mKCP_Port},Mode=OneTime}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="用户ID(id)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.UUID}" IsReadOnly="True" Width="300" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="加密(security)" Width="120" />
|
||||
<TextBox Text="none" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="传输协议(network)" Width="120" />
|
||||
<TextBox Text="kcp" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="伪装类型(type)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_KCP_Type}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="伪装域名(host)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="路径(path)" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_KCP_Seed}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="传输安全(tls)" Width="120" />
|
||||
<TextBox Text="" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.VMESS_KCP_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
@ -329,11 +388,41 @@
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.Trojan_TCP_TLS_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
<TextBox Text="{Binding Settings.Trojan_TCP_ShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Width="200"
|
||||
IsEnabled="{Binding Settings.CheckedShadowSocks}"
|
||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"
|
||||
Header="ShadowSocks">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="服务器地址" Width="120" />
|
||||
<TextBox Text="{Binding Settings.Domain}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="服务器端口" Width="120" />
|
||||
<TextBox Text="{Binding Source={x:Static dev:ConfigBuilder.ShadowSocksPort},Mode=OneTime}" IsReadOnly="True" Width="200" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="密码" Width="120" />
|
||||
<TextBox Text="{Binding Settings.ShadowSocksPassword}" IsReadOnly="True" Width="300" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="加密方式" Width="120" />
|
||||
<TextBox Text="{Binding Settings.ShadowSocksMethod}" IsReadOnly="True" Width="300" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||
<Label Content="分享链接" Width="120" />
|
||||
<TextBox Text="{Binding Settings.ShadowSocksShareLink,Mode=OneTime}" Width="300" IsReadOnly="True" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</metro:MetroWindow>
|
||||
|
Loading…
Reference in New Issue
Block a user