diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index 7affaad..6849174 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -204,6 +204,11 @@ namespace ProxySU serverConfig = "TemplateConfg\\tcpTLSselfSigned_server_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")) { serverConfig = "TemplateConfg\\WebSocket_TLS_server_config.json"; @@ -224,6 +229,11 @@ namespace ProxySU serverConfig = "TemplateConfg\\http2_server_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 (ReceiveConfigurationParameters[0].Contains("mKCP")) { @@ -653,7 +663,7 @@ namespace ProxySU //设置uuid serverJson["inbounds"][0]["settings"]["clients"][0]["id"] = ReceiveConfigurationParameters[2]; //除WebSocketTLSWeb模式外设置监听端口 - if (serverConfig.Contains("WebSocketTLSWeb") == false) + if (serverConfig.Contains("WebSocketTLSWeb") == false && serverConfig.Contains("http2Web") == false) { serverJson["inbounds"][0]["port"] = ReceiveConfigurationParameters[1]; } @@ -729,9 +739,9 @@ namespace ProxySU } //如果是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); Thread.Sleep(1000); @@ -744,7 +754,14 @@ namespace ProxySU currentStatus = "上传Caddy配置文件......"; textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); Thread.Sleep(1000); + if (serverConfig.Contains("WebSocketTLSWeb") == true) + { serverConfig = "TemplateConfg\\WebSocketTLSWeb_server_config.caddyfile"; + } + if (serverConfig.Contains("http2Web") == true) + { + serverConfig = "TemplateConfg\\http2Web_server_config.caddyfile"; + } upLoadPath = "/etc/caddy/Caddyfile"; UploadConfig(connectionInfo, serverConfig, upLoadPath); diff --git a/ProxySU/TemplateConfiguration.xaml b/ProxySU/TemplateConfiguration.xaml index b118533..2fb659b 100644 --- a/ProxySU/TemplateConfiguration.xaml +++ b/ProxySU/TemplateConfiguration.xaml @@ -113,14 +113,15 @@ - + + + @@ -142,9 +143,9 @@ - + - + diff --git a/ProxySU/TemplateConfiguration.xaml.cs b/ProxySU/TemplateConfiguration.xaml.cs index 9df91bd..9cadcbb 100644 --- a/ProxySU/TemplateConfiguration.xaml.cs +++ b/ProxySU/TemplateConfiguration.xaml.cs @@ -86,6 +86,13 @@ namespace ProxySU //传递域名 // MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString(); + } + //webSocket模式被选中 + if (RadioButtonWebSocket.IsChecked == true) + { + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "webSocket"; + } //WebSocket+TLS模式被选中 else if (RadioButtonWebSocketTLS.IsChecked == true) @@ -161,6 +168,37 @@ namespace ProxySU 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无伪装模式被选中 else if (RadioButtonMkcpNoCamouflage.IsChecked == true) { diff --git a/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_client_config.json b/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_client_config.json index 9fa1a07..bc33578 100644 --- a/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_client_config.json +++ b/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_client_config.json @@ -25,27 +25,24 @@ "settings": { "vnext": [ { - "address":null, - "port":null, - "users":[ + "address": null, + "port": null, + "users": [ { - "id":null, - "alterId":16, - "security":"auto" + "id": null, + "alterId": 16, + "security": "auto" } ] } ] }, - "streamSettings":{ - "network":"ws", - "security":"tls", - "wsSettings":{ - "path":null + "streamSettings": { + "network": "ws", + "security": "tls", + "wsSettings": { + "path": null } - }, - "mux": { - "enabled": true } } ] diff --git a/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.caddyfile b/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.caddyfile index d496060..9ba684f 100644 --- a/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.caddyfile +++ b/ProxySU/bin/Release/TemplateConfg/WebSocketTLSWeb_server_config.caddyfile @@ -1,4 +1,6 @@ ##domain## { + log stdout + errors stderr root /var/www tls off ##sites## diff --git a/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_client_config.json b/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_client_config.json new file mode 100644 index 0000000..bc33578 --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_client_config.json @@ -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 + } + } + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_selfSigned_client_config.json b/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_selfSigned_client_config.json new file mode 100644 index 0000000..7f2d477 --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_selfSigned_client_config.json @@ -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 + } + } + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_selfSigned_server_config.json b/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_selfSigned_server_config.json new file mode 100644 index 0000000..e5dca55 --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_selfSigned_server_config.json @@ -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": {} + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_server_config.json b/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_server_config.json new file mode 100644 index 0000000..6b82607 --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/WebSocket_TLS_server_config.json @@ -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": {} + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/http2Web_client_config.json b/ProxySU/bin/Release/TemplateConfg/http2Web_client_config.json new file mode 100644 index 0000000..ab763bb --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/http2Web_client_config.json @@ -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 + } + } + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/http2Web_server_config.caddyfile b/ProxySU/bin/Release/TemplateConfg/http2Web_server_config.caddyfile new file mode 100644 index 0000000..7490061 --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/http2Web_server_config.caddyfile @@ -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" +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/http2Web_server_config.json b/ProxySU/bin/Release/TemplateConfg/http2Web_server_config.json new file mode 100644 index 0000000..4efed3d --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/http2Web_server_config.json @@ -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": {} + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/http2_client_config.json b/ProxySU/bin/Release/TemplateConfg/http2_client_config.json index 769f4d1..ab763bb 100644 --- a/ProxySU/bin/Release/TemplateConfg/http2_client_config.json +++ b/ProxySU/bin/Release/TemplateConfg/http2_client_config.json @@ -43,9 +43,6 @@ "httpSettings": { "path": null } - }, - "mux": { - "enabled": true } } ] diff --git a/ProxySU/bin/Release/TemplateConfg/http2_server_config.json b/ProxySU/bin/Release/TemplateConfg/http2_server_config.json index 568b03e..5bb1ef7 100644 --- a/ProxySU/bin/Release/TemplateConfg/http2_server_config.json +++ b/ProxySU/bin/Release/TemplateConfg/http2_server_config.json @@ -17,8 +17,8 @@ "tlsSettings": { "certificates": [ { - "certificateFile": "/etc/v2ray/ssl/v2ray-h2-ssl.pem", - "keyFile": "/etc/v2ray/ssl/v2ray-h2-ssl.key" + "certificateFile": "/etc/v2ray/ssl/v2ray_ssl.crt", + "keyFile": "/etc/v2ray/ssl/v2ray_ssl.key" } ] }, diff --git a/ProxySU/bin/Release/TemplateConfg/mkcp_client_config.json b/ProxySU/bin/Release/TemplateConfg/mkcp_client_config.json index 570d23f..1d05f3d 100644 --- a/ProxySU/bin/Release/TemplateConfg/mkcp_client_config.json +++ b/ProxySU/bin/Release/TemplateConfg/mkcp_client_config.json @@ -51,9 +51,6 @@ "type": null } } - }, - "mux": { - "enabled": true } } ] diff --git a/ProxySU/bin/Release/TemplateConfg/tcpTLSselfSigned_client_config.json b/ProxySU/bin/Release/TemplateConfg/tcpTLSselfSigned_client_config.json new file mode 100644 index 0000000..737fa3b --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/tcpTLSselfSigned_client_config.json @@ -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 + } + } + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/tcpTLSselfSigned_server_config.json b/ProxySU/bin/Release/TemplateConfg/tcpTLSselfSigned_server_config.json new file mode 100644 index 0000000..252692b --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/tcpTLSselfSigned_server_config.json @@ -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": {} + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/tcp_TLS_client_config.json b/ProxySU/bin/Release/TemplateConfg/tcp_TLS_client_config.json new file mode 100644 index 0000000..93b95b0 --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/tcp_TLS_client_config.json @@ -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" + } + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/tcp_TLS_server_config.json b/ProxySU/bin/Release/TemplateConfg/tcp_TLS_server_config.json new file mode 100644 index 0000000..fb47415 --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/tcp_TLS_server_config.json @@ -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": {} + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/tcp_client_config.json b/ProxySU/bin/Release/TemplateConfg/tcp_client_config.json index a0ce390..dc040e2 100644 --- a/ProxySU/bin/Release/TemplateConfg/tcp_client_config.json +++ b/ProxySU/bin/Release/TemplateConfg/tcp_client_config.json @@ -39,9 +39,6 @@ }, "streamSettings": { "network": "tcp" - }, - "mux": { - "enabled": true } } ] diff --git a/ProxySU/bin/Release/TemplateConfg/tcp_http_client_config.json b/ProxySU/bin/Release/TemplateConfg/tcp_http_client_config.json index 8b9f723..6c75bf3 100644 --- a/ProxySU/bin/Release/TemplateConfg/tcp_http_client_config.json +++ b/ProxySU/bin/Release/TemplateConfg/tcp_http_client_config.json @@ -1,6 +1,6 @@ { "inbounds": [ - { + { "protocol": "http", "port": 1081 }, diff --git a/ProxySU/bin/Release/TemplateConfg/webSocket_client_config.json b/ProxySU/bin/Release/TemplateConfg/webSocket_client_config.json new file mode 100644 index 0000000..f12516b --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/webSocket_client_config.json @@ -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" + } + } + ] +} \ No newline at end of file diff --git a/ProxySU/bin/Release/TemplateConfg/webSocket_server_config.json b/ProxySU/bin/Release/TemplateConfg/webSocket_server_config.json new file mode 100644 index 0000000..f80c616 --- /dev/null +++ b/ProxySU/bin/Release/TemplateConfg/webSocket_server_config.json @@ -0,0 +1,25 @@ +{ + "inbounds": [ + { + "port": null, + "protocol": "vmess", + "settings": { + "clients": [ + { + "id": null, + "alterId": 64 + } + ] + }, + "streamSettings": { + "network": "ws" + } + } + ], + "outbounds": [ + { + "protocol": "freedom", + "settings": {} + } + ] +} \ No newline at end of file