diff --git a/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs b/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs
index 3932650..0c3b993 100644
--- a/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs
+++ b/ProxySuper.Core/Models/Projects/TrojanGoSettings.cs
@@ -1,4 +1,5 @@
-using System;
+using Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -46,6 +47,7 @@ namespace ProxySuper.Core.Models.Projects
///
/// 是否开启WebSocket
///
+ [JsonIgnore]
public bool EnableWebSocket
{
get
diff --git a/ProxySuper.Core/Services/ShareLink.cs b/ProxySuper.Core/Services/ShareLink.cs
index b82b48d..78d9419 100644
--- a/ProxySuper.Core/Services/ShareLink.cs
+++ b/ProxySuper.Core/Services/ShareLink.cs
@@ -11,6 +11,18 @@ namespace ProxySuper.Core.Services
{
public class ShareLink
{
+ public static string BuildTrojanGo(TrojanGoSettings settings)
+ {
+ throw new NotImplementedException();
+ StringBuilder strBuilder = new StringBuilder();
+ strBuilder.Append("trojan-go://");
+
+ strBuilder.Append($"{settings.Password}@{settings.Domain}:{settings.Port}/?");
+ strBuilder.Append($"sni={settings.Domain}&");
+
+ return strBuilder.ToString();
+ }
+
public static string Build(XrayType xrayType, XraySettings settings)
{
diff --git a/ProxySuper.Core/Services/TrojanGoConfigBuilder.cs b/ProxySuper.Core/Services/TrojanGoConfigBuilder.cs
index e1151de..0943d41 100644
--- a/ProxySuper.Core/Services/TrojanGoConfigBuilder.cs
+++ b/ProxySuper.Core/Services/TrojanGoConfigBuilder.cs
@@ -28,6 +28,13 @@ namespace ProxySuper.Core.Services
settings["password"][0] = parameters.Password;
settings["ssl"]["sni"] = parameters.Domain;
+ if (parameters.EnableWebSocket)
+ {
+ settings["websocket"]["enabled"] = true;
+ settings["websocket"]["path"] = parameters.WebSocketPath;
+ settings["websocket"]["host"] = parameters.WebSocketDomain;
+ }
+
return JsonConvert.SerializeObject(settings, Formatting.Indented, new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore
diff --git a/ProxySuper.Core/ViewModels/HomeViewModel.cs b/ProxySuper.Core/ViewModels/HomeViewModel.cs
index 055f46f..0f982c7 100644
--- a/ProxySuper.Core/ViewModels/HomeViewModel.cs
+++ b/ProxySuper.Core/ViewModels/HomeViewModel.cs
@@ -111,15 +111,17 @@ namespace ProxySuper.Core.ViewModels
if (record.Type == ProjectType.Xray)
{
result = await _navigationService.Navigate(record);
+ record.Host = result.Host;
+ record.XraySettings = result.XraySettings;
}
- else
+ if (record.Type == ProjectType.TrojanGo)
{
result = await _navigationService.Navigate(record);
+ record.Host = result.Host;
+ record.TrojanGoSettings = result.TrojanGoSettings;
}
if (result == null) return;
- record.Host = result.Host;
- record.XraySettings = result.XraySettings;
SaveToJson();
}
diff --git a/ProxySuper.WPF/Templates/trojan-go/trojan-go.json b/ProxySuper.WPF/Templates/trojan-go/trojan-go.json
index acb0207..f9057a9 100644
--- a/ProxySuper.WPF/Templates/trojan-go/trojan-go.json
+++ b/ProxySuper.WPF/Templates/trojan-go/trojan-go.json
@@ -10,7 +10,11 @@
"ssl": {
"cert": "/usr/local/etc/trojan-go/trojan-go.crt",
"key": "/usr/local/etc/trojan-go/trojan-go.key",
- "sni": ""
+ "sni": "example.com"
+ },
+ "websocket": {
+ "enabled": false,
+ "path": "/ws",
+ "host": "example.com"
}
-
}