1
0
Fork 0
mirror of https://github.com/proxysu/ProxySU.git synced 2025-03-29 19:59:55 +03:00

增加HTTP2+TLS+Web模式

This commit is contained in:
ProxySU 2020-04-16 21:08:47 +08:00
parent bd781058cf
commit 040e03cbd0
23 changed files with 579 additions and 33 deletions

View file

@ -204,6 +204,11 @@ namespace ProxySU
serverConfig = "TemplateConfg\\tcpTLSselfSigned_server_config.json"; serverConfig = "TemplateConfg\\tcpTLSselfSigned_server_config.json";
clientConfig = "TemplateConfg\\tcpTLSselfSigned_client_config.json"; clientConfig = "TemplateConfg\\tcpTLSselfSigned_client_config.json";
} }
else if (String.Equals(ReceiveConfigurationParameters[0], "webSocket"))
{
serverConfig = "TemplateConfg\\webSocket_server_config.json";
clientConfig = "TemplateConfg\\webSocket_client_config.json";
}
else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS")) else if (String.Equals(ReceiveConfigurationParameters[0], "WebSocketTLS"))
{ {
serverConfig = "TemplateConfg\\WebSocket_TLS_server_config.json"; serverConfig = "TemplateConfg\\WebSocket_TLS_server_config.json";
@ -224,6 +229,11 @@ namespace ProxySU
serverConfig = "TemplateConfg\\http2_server_config.json"; serverConfig = "TemplateConfg\\http2_server_config.json";
clientConfig = "TemplateConfg\\http2_client_config.json"; clientConfig = "TemplateConfg\\http2_client_config.json";
} }
else if (String.Equals(ReceiveConfigurationParameters[0], "http2Web"))
{
serverConfig = "TemplateConfg\\http2Web_server_config.json";
clientConfig = "TemplateConfg\\http2Web_client_config.json";
}
//else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard")) //else if (String.Equals(ReceiveConfigurationParameters[0], "MkcpNone")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2SRTP")||String.Equals(ReceiveConfigurationParameters[0], "mKCPuTP")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WechatVideo")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2DTLS")|| String.Equals(ReceiveConfigurationParameters[0], "mKCP2WireGuard"))
else if (ReceiveConfigurationParameters[0].Contains("mKCP")) else if (ReceiveConfigurationParameters[0].Contains("mKCP"))
{ {
@ -653,7 +663,7 @@ namespace ProxySU
//设置uuid //设置uuid
serverJson["inbounds"][0]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2]; serverJson["inbounds"][0]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2];
//除WebSocketTLSWeb模式外设置监听端口 //除WebSocketTLSWeb模式外设置监听端口
if (serverConfig.Contains("WebSocketTLSWeb") == false) if (serverConfig.Contains("WebSocketTLSWeb") == false && serverConfig.Contains("http2Web") == false)
{ {
serverJson["inbounds"][0]["port"] = ReceiveConfigurationParameters[1]; serverJson["inbounds"][0]["port"] = ReceiveConfigurationParameters[1];
} }
@ -729,9 +739,9 @@ namespace ProxySU
} }
//如果是WebSocket + TLS + Web模式需要安装Caddy //如果是WebSocket + TLS + Web模式需要安装Caddy
if (serverConfig.Contains("WebSocketTLSWeb")==true) if (serverConfig.Contains("WebSocketTLSWeb")==true || serverConfig.Contains("http2Web") == true)
{ {
currentStatus = "使用WebSocket + TLS + Web模式正在安装Caddy......"; currentStatus = "使用WebSocket+TLS+Web/HTTP2+TLS+Web模式正在安装Caddy......";
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
Thread.Sleep(1000); Thread.Sleep(1000);
@ -744,7 +754,14 @@ namespace ProxySU
currentStatus = "上传Caddy配置文件......"; currentStatus = "上传Caddy配置文件......";
textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus);
Thread.Sleep(1000); Thread.Sleep(1000);
if (serverConfig.Contains("WebSocketTLSWeb") == true)
{
serverConfig = "TemplateConfg\\WebSocketTLSWeb_server_config.caddyfile"; serverConfig = "TemplateConfg\\WebSocketTLSWeb_server_config.caddyfile";
}
if (serverConfig.Contains("http2Web") == true)
{
serverConfig = "TemplateConfg\\http2Web_server_config.caddyfile";
}
upLoadPath = "/etc/caddy/Caddyfile"; upLoadPath = "/etc/caddy/Caddyfile";
UploadConfig(connectionInfo, serverConfig, upLoadPath); UploadConfig(connectionInfo, serverConfig, upLoadPath);

View file

@ -113,14 +113,15 @@
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--<RadioButton x:Name="RadioButtonWebSocket" Content="WebSocket" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton> <RadioButton x:Name="RadioButtonWebSocket" Content="WebSocket" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonTCP_Checked"/>
<TextBlock Text="数据加密传输传输协议使用WebSocket未启用TLS,将被识别为WebSocket流量。" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>--> <TextBlock Text="数据加密传输传输协议使用WebSocket未启用TLS,将被识别为WebSocket流量。" TextWrapping="Wrap" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonWebSocketTLS" Content="WebSocket+TLS" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonHTTP2_Checked"/> <RadioButton x:Name="RadioButtonWebSocketTLS" Content="WebSocket+TLS" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonHTTP2_Checked"/>
<TextBlock Text="数据加密传输传输协议使用WebSocket启用TLS,将被识别为TLS流量。(需要域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock> <TextBlock Text="数据加密传输传输协议使用WebSocket启用TLS,将被识别为TLS流量。(需要域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonWebSocketTLS2Web" Content="WebSocket+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="3" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton> <RadioButton x:Name="RadioButtonWebSocketTLS2Web" Content="WebSocket+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="3" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton>
<TextBlock Text="稳定性强使用Caddy做伪装网站隐藏代理会被识别为访问网站的https流量抗封锁识别最强。(需要域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock> <TextBlock Text="稳定性强使用Caddy做伪装网站隐藏代理会被识别为访问网站的https流量抗封锁识别最强。(需要域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonWebSocketTLSselfSigned" Content="WebSocket+TLS(自签证书)" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="4" Checked="RadioButtonWebSocketTLSselfSigned_Checked"></RadioButton> <RadioButton x:Name="RadioButtonWebSocketTLSselfSigned" Content="WebSocket+TLS(自签证书)" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="4" Checked="RadioButtonWebSocketTLSselfSigned_Checked"></RadioButton>
<TextBlock Text="数据加密传输传输协议使用WebSocket启用TLS,将被识别为TLS流量。(无需域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3"></TextBlock> <TextBlock Text="数据加密传输传输协议使用WebSocket启用TLS,将被识别为TLS流量。(无需域名)" TextWrapping="Wrap" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="3"></TextBlock>
<TextBlock Text="Shadowrocket (ios)需要手动打开“允许不安全”选项" TextWrapping="Wrap" Grid.Column="4" Grid.Row="4" ></TextBlock>
</Grid> </Grid>
</TabItem> </TabItem>
@ -142,9 +143,9 @@
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<RadioButton x:Name="RadioButtonHTTP2" Content="HTTP/2" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonHTTP2_Checked"></RadioButton> <RadioButton x:Name="RadioButtonHTTP2" Content="HTTP2" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="1" Checked="RadioButtonHTTP2_Checked"></RadioButton>
<TextBlock Text="基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock> <TextBlock Text="基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3"></TextBlock>
<RadioButton x:Name="RadioButtonHTTP2Web" Content="HTTP/2+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton> <RadioButton x:Name="RadioButtonHTTP2Web" Content="HTTP2+TLS+Web" GroupName="TemplateGroup" Grid.Column="0" Grid.Row="2" Checked="RadioButtonWebSocketTLS2Web_Checked"></RadioButton>
<TextBlock Text="基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,增加伪装网站" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock> <TextBlock Text="基于 HTTP/2 的传输方式。它完整按照 HTTP/2 标准实现,增加伪装网站" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="3"></TextBlock>
</Grid> </Grid>
</TabItem> </TabItem>

View file

@ -86,6 +86,13 @@ namespace ProxySU
//传递域名 //传递域名
// MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString(); // MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString();
}
//webSocket模式被选中
if (RadioButtonWebSocket.IsChecked == true)
{
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "webSocket";
} }
//WebSocket+TLS模式被选中 //WebSocket+TLS模式被选中
else if (RadioButtonWebSocketTLS.IsChecked == true) else if (RadioButtonWebSocketTLS.IsChecked == true)
@ -161,6 +168,37 @@ namespace ProxySU
MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString(); MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString();
} }
//http2+TLS+Web模式被选中
else if (RadioButtonHTTP2Web.IsChecked == true)
{
if (string.IsNullOrEmpty(TextBoxDomain.Text.ToString()) == true)
{
MessageBox.Show("域名不能为空!");
return;
}
//传递模板类型
MainWindow.ReceiveConfigurationParameters[0] = "http2Web";
//传递路径
MainWindow.ReceiveConfigurationParameters[3] = TextBoxPath.Text.ToString();
//传递域名
MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString();
//传递伪装网站
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.ToString();
//处理伪装网站域名中的前缀
if (TextBoxMaskSites.Text.ToString().Length >= 7)
{
string testDomain = TextBoxMaskSites.Text.Substring(0, 7);
if (String.Equals(testDomain, "https:/") || String.Equals(testDomain, "http://"))
{
//MessageBox.Show(testDomain);
MainWindow.ReceiveConfigurationParameters[7] = TextBoxMaskSites.Text.Replace("/", "\\/");
}
else
{
MainWindow.ReceiveConfigurationParameters[7] = "http:\\/\\/" + TextBoxMaskSites.Text;
}
}
}
//mKCP无伪装模式被选中 //mKCP无伪装模式被选中
else if (RadioButtonMkcpNoCamouflage.IsChecked == true) else if (RadioButtonMkcpNoCamouflage.IsChecked == true)
{ {

View file

@ -25,27 +25,24 @@
"settings": { "settings": {
"vnext": [ "vnext": [
{ {
"address":null, "address": null,
"port":null, "port": null,
"users":[ "users": [
{ {
"id":null, "id": null,
"alterId":16, "alterId": 16,
"security":"auto" "security": "auto"
} }
] ]
} }
] ]
}, },
"streamSettings":{ "streamSettings": {
"network":"ws", "network": "ws",
"security":"tls", "security": "tls",
"wsSettings":{ "wsSettings": {
"path":null "path": null
} }
},
"mux": {
"enabled": true
} }
} }
] ]

View file

@ -1,4 +1,6 @@
##domain## { ##domain## {
log stdout
errors stderr
root /var/www root /var/www
tls off tls off
##sites## ##sites##

View file

@ -0,0 +1,49 @@
{
"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": "ws",
"security": "tls",
"wsSettings": {
"path": null
}
}
}
]
}

View 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": "ws",
"security": "tls",
"wsSettings": {
"path": null
},
"tlsSettings": {
"allowInsecure": true
}
}
}
]
}

View file

@ -0,0 +1,34 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"security": "tls",
"tlsSettings": {
"certificates": [
{}
]
},
"network": "ws",
"wsSettings": {
"path": null
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -0,0 +1,37 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"security": "tls",
"tlsSettings": {
"certificates": [
{
"certificateFile": "/etc/v2ray/ssl/v2ray_ssl.crt",
"keyFile": "/etc/v2ray/ssl/v2ray_ssl.key"
}
]
},
"network": "ws",
"wsSettings": {
"path": null
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -0,0 +1,49 @@
{
"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
}
}
}
]
}

View file

@ -0,0 +1,14 @@
##domain## {
log stdout
errors stderr
root /var/www
tls off
##sites##
proxy ##path## https://localhost:10000 {
insecure_skip_verify
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Port {server_port}
header_upstream X-Forwarded-Proto "https"
}

View file

@ -0,0 +1,35 @@
{
"inbounds": [
{
"port": 10000,
"listen": "127.0.0.1",
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"network": "h2",
"security": "tls",
"httpSettings": {
"path": null
},
"tlsSettings": {
"certificates": [
{}
]
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -43,9 +43,6 @@
"httpSettings": { "httpSettings": {
"path": null "path": null
} }
},
"mux": {
"enabled": true
} }
} }
] ]

View file

@ -17,8 +17,8 @@
"tlsSettings": { "tlsSettings": {
"certificates": [ "certificates": [
{ {
"certificateFile": "/etc/v2ray/ssl/v2ray-h2-ssl.pem", "certificateFile": "/etc/v2ray/ssl/v2ray_ssl.crt",
"keyFile": "/etc/v2ray/ssl/v2ray-h2-ssl.key" "keyFile": "/etc/v2ray/ssl/v2ray_ssl.key"
} }
] ]
}, },

View file

@ -51,9 +51,6 @@
"type": null "type": null
} }
} }
},
"mux": {
"enabled": true
} }
} }
] ]

View file

@ -0,0 +1,49 @@
{
"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": "tcp",
"security": "tls",
"tlsSettings": {
"allowInsecure": true
}
}
}
]
}

View file

@ -0,0 +1,31 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"security": "tls",
"tlsSettings": {
"certificates": [
{}
]
},
"network": "tcp"
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -0,0 +1,46 @@
{
"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": "tcp",
"security": "tls"
}
}
]
}

View file

@ -0,0 +1,34 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"security": "tls",
"tlsSettings": {
"certificates": [
{
"certificateFile": "/etc/v2ray/ssl/v2ray_ssl.crt",
"keyFile": "/etc/v2ray/ssl/v2ray_ssl.key"
}
]
},
"network": "tcp"
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}

View file

@ -39,9 +39,6 @@
}, },
"streamSettings": { "streamSettings": {
"network": "tcp" "network": "tcp"
},
"mux": {
"enabled": true
} }
} }
] ]

View file

@ -1,6 +1,6 @@
{ {
"inbounds": [ "inbounds": [
{ {
"protocol": "http", "protocol": "http",
"port": 1081 "port": 1081
}, },

View file

@ -0,0 +1,45 @@
{
"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": "ws"
}
}
]
}

View file

@ -0,0 +1,25 @@
{
"inbounds": [
{
"port": null,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": null,
"alterId": 64
}
]
},
"streamSettings": {
"network": "ws"
}
}
],
"outbounds": [
{
"protocol": "freedom",
"settings": {}
}
]
}