Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit 35b2cd3

Browse files
committed
TLS support
1 parent 1295cf8 commit 35b2cd3

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

V2RayW/FormTransSetting.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ private void buttonTSSave_Click(object sender, EventArgs e)
4141
concurrency = Program.strToInt(textBoxMuxCc.Text, 8)
4242
};
4343
var transportSettings = new {
44+
network = "tcp",
45+
security = checkBoxTLSEnable.Checked ? "tls" : "none",
46+
tlsSettings = new {
47+
serverName = textBoxTLSSn.Text,
48+
allowInsecure = checkBoxTLSAI.Checked
49+
},
4450
kcpSettings = new
4551
{
4652
mtu = Program.strToInt(textBoxKcpMtu.Text, 1350),
@@ -96,6 +102,10 @@ private void FormTransSetting_Load(object sender, EventArgs e)
96102
checkBoxWsCr.Checked = transportSettings.wsSettings.connectionReuse;
97103
textBoxWsPath.Text = transportSettings.wsSettings.path;
98104

105+
checkBoxTLSEnable.Checked = transportSettings.security == "tls";
106+
checkBoxTLSAI.Checked = transportSettings.tlsSettings.allowInsecure;
107+
textBoxTLSSn.Text = transportSettings.tlsSettings.serverName;
108+
99109
string muxSettingsStr = Properties.Settings.Default.mux;
100110
dynamic muxSettings = JObject.Parse(muxSettingsStr);
101111
checkBoxMuxEnable.Checked = muxSettings.enabled;
@@ -119,6 +129,8 @@ private void buttonTsReset_Click(object sender, EventArgs e)
119129

120130
checkBoxMuxEnable.Checked = false;
121131
textBoxMuxCc.Text = "8";
132+
133+
checkBoxTLSEnable.Checked = false;
122134
}
123135
}
124136
}

V2RayW/Program.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,14 @@ public static bool generateConfigJson()
336336
json.outbound.settings.vnext[0].users[0].id = profiles[selectedServerIndex].userId;
337337
json.outbound.settings.vnext[0].users[0].alterId = profiles[selectedServerIndex].alterId;
338338
json.outbound.settings.vnext[0].users[0].security = (new string[] { "aes-128-cfb", "aes-128-gcm", "chacha20-poly1305" })[profiles[selectedServerIndex].security % 3];
339-
json.outbound.streamSettings.network = (new string[]{ "tcp", "kcp", "ws" })[profiles[selectedServerIndex].network % 3];
339+
340340
var ts = JObject.Parse(Properties.Settings.Default.transportSettings);
341-
json.outbound.streamSettings.tcpSettings = ts["tcpSettings"];
342-
json.outbound.streamSettings.kcpSettings = ts["kcpSettings"];
343-
json.outbound.streamSettings.wsSettings = ts["wsSettings"];
341+
//json.outbound.streamSettings.tcpSettings = ts["tcpSettings"];
342+
//json.outbound.streamSettings.kcpSettings = ts["kcpSettings"];
343+
//json.outbound.streamSettings.wsSettings = ts["wsSettings"];
344+
json.outbound.steamSettings = ts;
345+
json.outbound.streamSettings.network = (new string[] { "tcp", "kcp", "ws" })[profiles[selectedServerIndex].network % 3];
346+
344347
json.outbound.mux = JObject.Parse(Properties.Settings.Default.mux);
345348
var dnsArray = Properties.Settings.Default.dns.Split(',');
346349
json.dns = JObject.Parse(dnsArray.Count() > 0 ? JsonConvert.SerializeObject( new { servers = dnsArray }) : "{\"servers\":[\"localhost\"]}");

0 commit comments

Comments
 (0)