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

Commit

Permalink
TLS support
Browse files Browse the repository at this point in the history
  • Loading branch information
Cenmrev committed Oct 12, 2017
1 parent 1295cf8 commit 35b2cd3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 12 additions & 0 deletions V2RayW/FormTransSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ private void buttonTSSave_Click(object sender, EventArgs e)
concurrency = Program.strToInt(textBoxMuxCc.Text, 8)
};
var transportSettings = new {
network = "tcp",
security = checkBoxTLSEnable.Checked ? "tls" : "none",
tlsSettings = new {
serverName = textBoxTLSSn.Text,
allowInsecure = checkBoxTLSAI.Checked
},
kcpSettings = new
{
mtu = Program.strToInt(textBoxKcpMtu.Text, 1350),
Expand Down Expand Up @@ -96,6 +102,10 @@ private void FormTransSetting_Load(object sender, EventArgs e)
checkBoxWsCr.Checked = transportSettings.wsSettings.connectionReuse;
textBoxWsPath.Text = transportSettings.wsSettings.path;

checkBoxTLSEnable.Checked = transportSettings.security == "tls";
checkBoxTLSAI.Checked = transportSettings.tlsSettings.allowInsecure;
textBoxTLSSn.Text = transportSettings.tlsSettings.serverName;

string muxSettingsStr = Properties.Settings.Default.mux;
dynamic muxSettings = JObject.Parse(muxSettingsStr);
checkBoxMuxEnable.Checked = muxSettings.enabled;
Expand All @@ -119,6 +129,8 @@ private void buttonTsReset_Click(object sender, EventArgs e)

checkBoxMuxEnable.Checked = false;
textBoxMuxCc.Text = "8";

checkBoxTLSEnable.Checked = false;
}
}
}
11 changes: 7 additions & 4 deletions V2RayW/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,14 @@ public static bool generateConfigJson()
json.outbound.settings.vnext[0].users[0].id = profiles[selectedServerIndex].userId;
json.outbound.settings.vnext[0].users[0].alterId = profiles[selectedServerIndex].alterId;
json.outbound.settings.vnext[0].users[0].security = (new string[] { "aes-128-cfb", "aes-128-gcm", "chacha20-poly1305" })[profiles[selectedServerIndex].security % 3];
json.outbound.streamSettings.network = (new string[]{ "tcp", "kcp", "ws" })[profiles[selectedServerIndex].network % 3];

var ts = JObject.Parse(Properties.Settings.Default.transportSettings);
json.outbound.streamSettings.tcpSettings = ts["tcpSettings"];
json.outbound.streamSettings.kcpSettings = ts["kcpSettings"];
json.outbound.streamSettings.wsSettings = ts["wsSettings"];
//json.outbound.streamSettings.tcpSettings = ts["tcpSettings"];
//json.outbound.streamSettings.kcpSettings = ts["kcpSettings"];
//json.outbound.streamSettings.wsSettings = ts["wsSettings"];
json.outbound.steamSettings = ts;
json.outbound.streamSettings.network = (new string[] { "tcp", "kcp", "ws" })[profiles[selectedServerIndex].network % 3];

json.outbound.mux = JObject.Parse(Properties.Settings.Default.mux);
var dnsArray = Properties.Settings.Default.dns.Split(',');
json.dns = JObject.Parse(dnsArray.Count() > 0 ? JsonConvert.SerializeObject( new { servers = dnsArray }) : "{\"servers\":[\"localhost\"]}");
Expand Down

0 comments on commit 35b2cd3

Please sign in to comment.