mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-21 20:56:08 +03:00
grpc share link and multi user
This commit is contained in:
parent
fe94157c7b
commit
a2b27076b1
@ -84,6 +84,11 @@ namespace ProxySuper.Core.Models.Projects
|
||||
/// </summary>
|
||||
public string UUID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多用户
|
||||
/// </summary>
|
||||
public List<string> MulitUUID { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 伪装域名
|
||||
/// </summary>
|
||||
|
@ -168,7 +168,7 @@ namespace ProxySuper.Core.Services
|
||||
case XrayType.VLESS_gRPC:
|
||||
_protocol = "vless";
|
||||
_type = "grpc";
|
||||
_path = settings.VLESS_gRPC_ServiceName;
|
||||
_port = settings.VLESS_gRPC_Port;
|
||||
_descriptiveText = "vless-gRPC";
|
||||
break;
|
||||
case XrayType.Trojan_TCP:
|
||||
@ -198,6 +198,12 @@ namespace ProxySuper.Core.Services
|
||||
{
|
||||
parametersURL += "&flow=xtls-rprx-direct";
|
||||
}
|
||||
|
||||
|
||||
if (xrayType == XrayType.VLESS_gRPC)
|
||||
{
|
||||
parametersURL += $"&serviceName={settings.VLESS_gRPC_ServiceName}&mode=gun";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -95,8 +95,31 @@ namespace ProxySuper.Core.Services
|
||||
return caddyStr;
|
||||
}
|
||||
|
||||
private static void SetClients(dynamic bound, List<string> uuidList, bool withXtls = false)
|
||||
{
|
||||
bound.settings.clients.Clear();
|
||||
uuidList.ForEach(id =>
|
||||
{
|
||||
object obj;
|
||||
if (!withXtls)
|
||||
{
|
||||
obj = new { id = id };
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = new { id = id, flow = "xtls-rprx-direct" };
|
||||
}
|
||||
|
||||
bound.settings.clients.Add(JToken.FromObject(obj));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static string BuildXrayConfig(XraySettings parameters)
|
||||
{
|
||||
var uuidList = parameters.MulitUUID;
|
||||
uuidList.Insert(0, parameters.UUID);
|
||||
|
||||
var xrayConfig = LoadXrayConfig();
|
||||
var baseBound = GetBound("VLESS_TCP_XTLS.json");
|
||||
baseBound.port = parameters.Port;
|
||||
@ -105,13 +128,13 @@ namespace ProxySuper.Core.Services
|
||||
dest = FullbackPort
|
||||
}));
|
||||
xrayConfig.inbounds.Add(baseBound);
|
||||
baseBound.settings.clients[0].id = parameters.UUID;
|
||||
SetClients(baseBound, uuidList, withXtls: true);
|
||||
|
||||
if (parameters.Types.Contains(XrayType.VLESS_WS))
|
||||
{
|
||||
var wsInbound = GetBound("VLESS_WS.json");
|
||||
wsInbound.port = VLESS_WS_Port;
|
||||
wsInbound.settings.clients[0].id = parameters.UUID;
|
||||
SetClients(wsInbound, uuidList);
|
||||
wsInbound.streamSettings.wsSettings.path = parameters.VLESS_WS_Path;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
@ -126,7 +149,7 @@ namespace ProxySuper.Core.Services
|
||||
{
|
||||
var gRPCInBound = GetBound("VLESS_gRPC.json");
|
||||
gRPCInBound.port = parameters.VLESS_gRPC_Port;
|
||||
gRPCInBound.settings.clients[0].id = parameters.UUID;
|
||||
SetClients(gRPCInBound, uuidList);
|
||||
gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName;
|
||||
gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain;
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
|
||||
@ -136,7 +159,7 @@ namespace ProxySuper.Core.Services
|
||||
{
|
||||
var kcpBound = GetBound("VLESS_KCP.json");
|
||||
kcpBound.port = parameters.VLESS_KCP_Port;
|
||||
kcpBound.settings.clients[0].id = parameters.UUID;
|
||||
SetClients(kcpBound, uuidList);
|
||||
kcpBound.streamSettings.kcpSettings.header.type = parameters.VLESS_KCP_Type;
|
||||
kcpBound.streamSettings.kcpSettings.seed = parameters.VLESS_KCP_Seed;
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||
@ -146,7 +169,7 @@ namespace ProxySuper.Core.Services
|
||||
{
|
||||
var mtcpBound = GetBound("VMESS_TCP.json");
|
||||
mtcpBound.port = VMESS_TCP_Port;
|
||||
mtcpBound.settings.clients[0].id = parameters.UUID;
|
||||
SetClients(mtcpBound, uuidList);
|
||||
mtcpBound.streamSettings.tcpSettings.header.request.path = parameters.VMESS_TCP_Path;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
@ -161,7 +184,7 @@ namespace ProxySuper.Core.Services
|
||||
{
|
||||
var mwsBound = GetBound("VMESS_WS.json");
|
||||
mwsBound.port = VMESS_WS_Port;
|
||||
mwsBound.settings.clients[0].id = parameters.UUID;
|
||||
SetClients(mwsBound, uuidList);
|
||||
mwsBound.streamSettings.wsSettings.path = parameters.VMESS_WS_Path;
|
||||
baseBound.settings.fallbacks.Add(JToken.FromObject(new
|
||||
{
|
||||
@ -176,7 +199,7 @@ namespace ProxySuper.Core.Services
|
||||
{
|
||||
var kcpBound = GetBound("VMESS_KCP.json");
|
||||
kcpBound.port = parameters.VMESS_KCP_Port;
|
||||
kcpBound.settings.clients[0].id = parameters.UUID;
|
||||
SetClients(kcpBound, uuidList);
|
||||
kcpBound.streamSettings.kcpSettings.header.type = parameters.VMESS_KCP_Type;
|
||||
kcpBound.streamSettings.kcpSettings.seed = parameters.VMESS_KCP_Seed;
|
||||
xrayConfig.inbounds.Add(JToken.FromObject(kcpBound));
|
||||
|
@ -110,6 +110,18 @@ namespace ProxySuper.Core.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public string MultiUUID
|
||||
{
|
||||
get => string.Join(",", Settings.MulitUUID);
|
||||
set
|
||||
{
|
||||
var input = value.Replace(',', ',');
|
||||
var arr = input.Split(',').ToList();
|
||||
Settings.MulitUUID = arr;
|
||||
RaisePropertyChanged("MultiUUID");
|
||||
}
|
||||
}
|
||||
|
||||
public string Domain
|
||||
{
|
||||
get => Settings.Domain;
|
||||
|
@ -319,6 +319,22 @@
|
||||
<TextBox Text="{Binding Path=Port}" Width="120" />
|
||||
<Label Content="{DynamicResource XrayPortDefault}" Foreground="Red" />
|
||||
</StackPanel>
|
||||
|
||||
<!--多用户-->
|
||||
<StackPanel Margin="30,10,0,0"
|
||||
Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="{DynamicResource MultiUser}" Width="120" />
|
||||
|
||||
<TextBox Text="{Binding Path=MultiUUID}"
|
||||
Height="60"
|
||||
TextWrapping="Wrap"
|
||||
Width="200" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock Margin="120,3,0,0" Text="{DynamicResource MultiUserHelp}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
|
@ -76,6 +76,8 @@
|
||||
<sys:String x:Key="XrayDomain">Address</sys:String>
|
||||
<sys:String x:Key="XrayMarkDomain">GuiseHost</sys:String>
|
||||
<sys:String x:Key="XrayUUID">UUID</sys:String>
|
||||
<sys:String x:Key="MultiUser">Multi User</sys:String>
|
||||
<sys:String x:Key="MultiUserHelp">Multi Id split with ","</sys:String>
|
||||
<sys:String x:Key="VlessWsPath">VLESS WS Path</sys:String>
|
||||
<sys:String x:Key="VlessKcpSeed">VLESS KCP Seed</sys:String>
|
||||
<sys:String x:Key="VlessKcpType">VLESS KCP Type</sys:String>
|
||||
|
@ -75,6 +75,8 @@
|
||||
<sys:String x:Key="XrayDomain">域名</sys:String>
|
||||
<sys:String x:Key="XrayMarkDomain">偽裝域名</sys:String>
|
||||
<sys:String x:Key="XrayUUID">UUID</sys:String>
|
||||
<sys:String x:Key="MultiUser">多用戶</sys:String>
|
||||
<sys:String x:Key="MultiUserHelp">多個UUID用“,”分隔</sys:String>
|
||||
<sys:String x:Key="VlessWsPath">VLESS WS路徑</sys:String>
|
||||
<sys:String x:Key="VlessKcpSeed">VLESS KCP Seed</sys:String>
|
||||
<sys:String x:Key="VlessKcpType">VLESS KCP偽裝</sys:String>
|
||||
|
@ -76,6 +76,8 @@
|
||||
<sys:String x:Key="XrayDomain">域名</sys:String>
|
||||
<sys:String x:Key="XrayMarkDomain">伪装域名</sys:String>
|
||||
<sys:String x:Key="XrayUUID">UUID</sys:String>
|
||||
<sys:String x:Key="MultiUser">多用户</sys:String>
|
||||
<sys:String x:Key="MultiUserHelp">多个UUID用“,”分隔</sys:String>
|
||||
<sys:String x:Key="VlessWsPath">VLESS WS路径</sys:String>
|
||||
<sys:String x:Key="VlessKcpSeed">VLESS KCP Seed</sys:String>
|
||||
<sys:String x:Key="VlessKcpType">VLESS KCP伪装</sys:String>
|
||||
|
Loading…
Reference in New Issue
Block a user