Skip to content

Commit

Permalink
update grpc settings
Browse files Browse the repository at this point in the history
  • Loading branch information
next-autumn committed Jun 29, 2021
1 parent 9923437 commit b82e857
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 31 deletions.
1 change: 1 addition & 0 deletions ProxySuper.Core/Models/Projects/XraySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public List<int> FreePorts
VLESS_KCP_Port,
VMESS_KCP_Port,
ShadowSocksPort,
VLESS_gRPC_Port,
};
}
}
Expand Down
13 changes: 1 addition & 12 deletions ProxySuper.Core/Services/XrayConfigBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,6 @@ public static string BuildCaddyConfig(XraySettings parameters, bool useCustomWeb
caddyStr = caddyStr.Replace("##reverse_proxy##", "");
}

if (parameters.Types.Contains(XrayType.VLESS_gRPC))
{
var grpcCaddyfile = File.ReadAllText(Path.Combine(CaddyFileDir, "grpc.caddyfile"));
grpcCaddyfile = grpcCaddyfile.Replace("##domain##", parameters.Domain);
grpcCaddyfile = grpcCaddyfile.Replace("##port##", parameters.VLESS_gRPC_Port.ToString());
grpcCaddyfile = grpcCaddyfile.Replace("##local_port##", VLESS_gRPC_Port.ToString());
grpcCaddyfile = grpcCaddyfile.Replace("##path##", parameters.VLESS_gRPC_ServiceName);

caddyStr += "\n";
caddyStr += grpcCaddyfile;
}

return caddyStr;
}

Expand Down Expand Up @@ -142,6 +130,7 @@ public static string BuildXrayConfig(XraySettings parameters)
gRPCInBound.port = VLESS_gRPC_Port;
gRPCInBound.settings.clients[0].id = parameters.UUID;
gRPCInBound.streamSettings.grpcSettings.serviceName = parameters.VLESS_gRPC_ServiceName;
gRPCInBound.streamSettings.tlsSettings.serverName = parameters.Domain;
xrayConfig.inbounds.Add(JToken.FromObject(gRPCInBound));
}

Expand Down
3 changes: 0 additions & 3 deletions ProxySuper.WPF/ProxySuper.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,6 @@
<None Include="Templates\xray\caddy\base.caddyfile">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\caddy\grpc.caddyfile">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Templates\xray\client\00_log\00_log.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
10 changes: 0 additions & 10 deletions ProxySuper.WPF/Templates/xray/caddy/grpc.caddyfile

This file was deleted.

21 changes: 17 additions & 4 deletions ProxySuper.WPF/Templates/xray/server/05_inbounds/VLESS_gRPC.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"port": 2003,
"listen": "127.0.0.1",
"port": 2002,
"listen": "0.0.0.0",
"protocol": "vless",
"settings": {
"clients": [
Expand All @@ -11,9 +11,22 @@
"decryption": "none"
},
"streamSettings": {
"network": "grpc",
"network": "gun",
"security": "tls",
"tlsSettings": {
"serverName": "domain",
"alpn": [
"h2"
],
"certificates": [
{
"certificateFile": "/usr/local/etc/xray/ssl/xray_ssl.crt",
"keyFile": "/usr/local/etc/xray/ssl/xray_ssl.key"
}
]
},
"grpcSettings": {
"serviceName": ""
"serviceName": "service_name"
}
}
}
4 changes: 2 additions & 2 deletions ProxySuper.WPF/Views/XrayConfigView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
<ctrl:VLESS_KCP_Control />
</TabItem>

<!--<TabItem Width="200"
<TabItem Width="200"
Tag="{x:Static models:XrayType.VLESS_gRPC}"
IsEnabled="{Binding Checked_VLESS_gRPC}"
Header="VLESS-gRPC">
<ctrl:VLESS_gRPC_Control />
</TabItem>-->
</TabItem>

<!--<TabItem Width="200" Height="40"
Tag="{x:Static models:XrayType.VMESS_TCP}"
Expand Down

0 comments on commit b82e857

Please sign in to comment.