mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-22 13:16:09 +03:00
增加Http2模式
This commit is contained in:
parent
28ba98af9c
commit
a9eb27caf4
@ -212,12 +212,12 @@ namespace ProxySU
|
||||
clientConfig = "TemplateConfg\\mkcp_client_config.json";
|
||||
}
|
||||
|
||||
else if (String.Equals(ReceiveConfigurationParameters[0], "HTTP2"))
|
||||
else if (String.Equals(ReceiveConfigurationParameters[0], "Http2"))
|
||||
{
|
||||
//File.Copy("TemplateConfg\\tcp_server_config.json", "ConfigUpload\\tcp_server_config.json", true);
|
||||
|
||||
serverConfig = "TemplateConfg\\HTTP2_server_config.json";
|
||||
clientConfig = "TemplateConfg\\tcp_client_config.json";
|
||||
serverConfig = "TemplateConfg\\http2_server_config.json";
|
||||
clientConfig = "TemplateConfg\\http2_client_config.json";
|
||||
}
|
||||
else if (String.Equals(ReceiveConfigurationParameters[0], "QuicNone") || String.Equals(ReceiveConfigurationParameters[0], "QuicSRTP") || String.Equals(ReceiveConfigurationParameters[0], "Quic2uTP") || String.Equals(ReceiveConfigurationParameters[0], "QuicWechatVideo") || String.Equals(ReceiveConfigurationParameters[0], "QuicDTLS") || String.Equals(ReceiveConfigurationParameters[0], "QuicWireGuard"))
|
||||
{
|
||||
@ -503,9 +503,9 @@ namespace ProxySU
|
||||
//MessageBox.Show(timesStamp2.ToString());
|
||||
|
||||
//如果使用如果是WebSocket + TLS + Web模式,需要检测域名解析是否正确
|
||||
if (serverConfig.Contains("WebSocketTLSWeb") == true)
|
||||
if (serverConfig.Contains("WebSocketTLSWeb") == true || serverConfig.Contains("Http2") == true)
|
||||
{
|
||||
currentStatus = "使用WebSocket + TLS + Web模式,正在检测域名是否解析到当前VPS的IP上......";
|
||||
currentStatus = "正在检测域名是否解析到当前VPS的IP上......";
|
||||
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
|
||||
Thread.Sleep(1000);
|
||||
|
||||
@ -593,6 +593,11 @@ namespace ProxySU
|
||||
{
|
||||
serverJson["inbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
|
||||
}
|
||||
//如果是Http2模式下,设置路径
|
||||
if (serverConfig.Contains("http2") == true)
|
||||
{
|
||||
serverJson["inbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[3];
|
||||
}
|
||||
//mkcp模式下,设置伪装类型
|
||||
if (serverConfig.Contains("mkcp") == true)
|
||||
{
|
||||
@ -616,7 +621,7 @@ namespace ProxySU
|
||||
//client.RunCommand("sed -i 's/##path##/\\" + ReceiveConfigurationParameters[3] + "/' " + upLoadPath);
|
||||
////client.RunCommand("sed -i 's/##domain##/" + ReceiveConfigurationParameters[4] + "/' " + upLoadPath);
|
||||
//client.RunCommand("sed -i 's/##mkcpHeaderType##/" + ReceiveConfigurationParameters[5] + "/' " + upLoadPath);
|
||||
client.RunCommand("systemctl restart v2ray");
|
||||
//client.RunCommand("systemctl restart v2ray");
|
||||
File.Delete(@"config.json");
|
||||
|
||||
//打开防火墙端口
|
||||
@ -696,6 +701,53 @@ namespace ProxySU
|
||||
client.RunCommand("caddy -service start");
|
||||
}
|
||||
|
||||
if (serverConfig.Contains("http2") == true)
|
||||
{
|
||||
currentStatus = "使用Http2模式,正在安装acme.sh......";
|
||||
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
|
||||
Thread.Sleep(1000);
|
||||
|
||||
if (getApt == false)
|
||||
{
|
||||
//client.RunCommand("apt-get -qq update");
|
||||
client.RunCommand("apt-get -y -qq install socat");
|
||||
}
|
||||
if (getYum == false)
|
||||
{
|
||||
//client.RunCommand("yum -q makecache");
|
||||
client.RunCommand("yum -y -q install socat");
|
||||
}
|
||||
if (getZypper == false)
|
||||
{
|
||||
// client.RunCommand("zypper ref");
|
||||
client.RunCommand("zypper -y install socat");
|
||||
}
|
||||
client.RunCommand("curl https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh | INSTALLONLINE=1 sh");
|
||||
client.RunCommand("cd ~/.acme.sh/");
|
||||
client.RunCommand("alias acme.sh=~/.acme.sh/acme.sh");
|
||||
|
||||
currentStatus = "申请域名证书......";
|
||||
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
|
||||
Thread.Sleep(1000);
|
||||
|
||||
client.RunCommand("mkdir -p /etc/v2ray/ssl");
|
||||
client.RunCommand($"/root/.acme.sh/acme.sh --issue --standalone -d {ReceiveConfigurationParameters[4]}");
|
||||
|
||||
currentStatus = "安装证书到V2ray......";
|
||||
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
|
||||
Thread.Sleep(1000);
|
||||
client.RunCommand($"/root/.acme.sh/acme.sh --installcert -d {ReceiveConfigurationParameters[4]} --certpath /etc/v2ray/ssl/v2ray-h2-ssl.pem --keypath /etc/v2ray/ssl/v2ray-h2-ssl.key --capath /etc/v2ray/ssl/v2ray-h2-ssl.pem --reloadcmd \"systemctl restart v2ray\"");
|
||||
}
|
||||
|
||||
currentStatus = "正在启动V2ray......";
|
||||
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
|
||||
Thread.Sleep(1000);
|
||||
//启动V2ray服务
|
||||
client.RunCommand("systemctl restart v2ray");
|
||||
|
||||
currentStatus = "V2ray启动成功!";
|
||||
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
|
||||
Thread.Sleep(1000);
|
||||
|
||||
|
||||
//生成客户端配置
|
||||
@ -718,6 +770,10 @@ namespace ProxySU
|
||||
{
|
||||
clientJson["outbounds"][0]["streamSettings"]["wsSettings"]["path"] = ReceiveConfigurationParameters[3];
|
||||
}
|
||||
if (clientConfig.Contains("http2") == true)
|
||||
{
|
||||
clientJson["outbounds"][0]["streamSettings"]["httpSettings"]["path"] = ReceiveConfigurationParameters[3];
|
||||
}
|
||||
if (clientConfig.Contains("mkcp")==true)
|
||||
{
|
||||
clientJson["outbounds"][0]["streamSettings"]["kcpSettings"]["header"]["type"] = ReceiveConfigurationParameters[5];
|
||||
|
@ -166,7 +166,7 @@ namespace ProxySU
|
||||
HidePathAndTLS();
|
||||
ShowQuicKey();
|
||||
}
|
||||
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "HTTP2"))
|
||||
else if (String.Equals(MainWindow.ReceiveConfigurationParameters[0], "Http2"))
|
||||
{
|
||||
TextBoxTransmission.Text = "h2";
|
||||
TextBoxCamouflageType.Text = "none";
|
||||
|
@ -57,7 +57,7 @@ namespace ProxySU
|
||||
else if (RadioButtonHTTP2.IsChecked == true)
|
||||
{
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "HTTP2";
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "Http2";
|
||||
//传递路径
|
||||
MainWindow.ReceiveConfigurationParameters[3] = TextBoxPath.Text.ToString();
|
||||
//传递域名
|
||||
|
Binary file not shown.
Binary file not shown.
52
ProxySU/bin/Release/TemplateConfg/http2_client_config.json
Normal file
52
ProxySU/bin/Release/TemplateConfg/http2_client_config.json
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"inbounds": [
|
||||
{
|
||||
"protocol": "http",
|
||||
"port": 1081
|
||||
},
|
||||
{
|
||||
"port": 1080,
|
||||
"protocol": "socks",
|
||||
"sniffing": {
|
||||
"enabled": true,
|
||||
"destOverride": [
|
||||
"http",
|
||||
"tls"
|
||||
]
|
||||
},
|
||||
"settings": {
|
||||
"auth": "noauth"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"vnext": [
|
||||
{
|
||||
"address": null,
|
||||
"port": null,
|
||||
"users": [
|
||||
{
|
||||
"id": null,
|
||||
"alterId": 16,
|
||||
"security": "auto"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "h2",
|
||||
"security": "tls",
|
||||
"httpSettings": {
|
||||
"path": null
|
||||
}
|
||||
},
|
||||
"mux": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
37
ProxySU/bin/Release/TemplateConfg/http2_server_config.json
Normal file
37
ProxySU/bin/Release/TemplateConfg/http2_server_config.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"inbounds": [
|
||||
{
|
||||
"port": null,
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": null,
|
||||
"alterId": 64
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "h2",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/v2ray/ssl/v2ray-h2-ssl.pem",
|
||||
"keyFile": "/etc/v2ray/ssl/v2ray-h2-ssl.key"
|
||||
}
|
||||
]
|
||||
},
|
||||
"httpSettings": {
|
||||
"path": null
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"settings": {}
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user