diff --git a/internal/web/actions/default/servers/components/index.go b/internal/web/actions/default/servers/components/index.go index 1af5db06..690a37aa 100644 --- a/internal/web/actions/default/servers/components/index.go +++ b/internal/web/actions/default/servers/components/index.go @@ -57,6 +57,11 @@ func (this *IndexAction) RunPost(params struct { DomainMismatchActionPageStatusCode int DomainMismatchActionPageContentHTML string + // TCP端口设置 + TcpAllPortRangeMin int + TcpAllPortRangeMax int + TcpAllDenyPorts []int + DefaultDomain string }) { // 创建日志 @@ -101,6 +106,22 @@ func (this *IndexAction) RunPost(params struct { } } + // TCP端口范围 + if params.TcpAllPortRangeMin < 1024 { + params.TcpAllPortRangeMin = 1024 + } + if params.TcpAllPortRangeMax > 65534 { + params.TcpAllPortRangeMax = 65534 + } else if params.TcpAllPortRangeMax < 1024 { + params.TcpAllPortRangeMax = 1024 + } + if params.TcpAllPortRangeMin > params.TcpAllPortRangeMax { + params.TcpAllPortRangeMin, params.TcpAllPortRangeMax = params.TcpAllPortRangeMax, params.TcpAllPortRangeMin + } + globalConfig.TCPAll.DenyPorts = params.TcpAllDenyPorts + globalConfig.TCPAll.PortRangeMin = params.TcpAllPortRangeMin + globalConfig.TCPAll.PortRangeMax = params.TcpAllPortRangeMax + // 修改配置 globalConfigJSON, err := json.Marshal(globalConfig) if err != nil { diff --git a/internal/web/actions/default/servers/serverutils/server_helper.go b/internal/web/actions/default/servers/serverutils/server_helper.go index d89ccfc2..7d8aa1d2 100644 --- a/internal/web/actions/default/servers/serverutils/server_helper.go +++ b/internal/web/actions/default/servers/serverutils/server_helper.go @@ -75,6 +75,19 @@ func (this *ServerHelper) createLeftMenu(action *actions.ActionObject) { return } + // 协议簇 + family := "" + if serverConfig.IsHTTP() { + family = "http" + } else if serverConfig.IsTCP() { + family = "tcp" + } else if serverConfig.IsUnix() { + family = "unix" + } else if serverConfig.IsUDP() { + family = "udp" + } + action.Data["serverFamily"] = family + // TABBAR selectedTabbar, _ := action.Data["mainTab"] tabbar := actionutils.NewTabbar() diff --git a/web/public/js/components/common/values-box.js b/web/public/js/components/common/values-box.js index 2d0fad1a..d5956bc2 100644 --- a/web/public/js/components/common/values-box.js +++ b/web/public/js/components/common/values-box.js @@ -73,7 +73,7 @@ Vue.component("values-box", {
- 取消 +
diff --git a/web/public/js/components/server/reverse-proxy-box.js b/web/public/js/components/server/reverse-proxy-box.js index 5b5a539c..b90022af 100644 --- a/web/public/js/components/server/reverse-proxy-box.js +++ b/web/public/js/components/server/reverse-proxy-box.js @@ -1,5 +1,5 @@ Vue.component("reverse-proxy-box", { - props: ["v-reverse-proxy-ref", "v-reverse-proxy-config", "v-is-location"], + props: ["v-reverse-proxy-ref", "v-reverse-proxy-config", "v-is-location", "v-family"], data: function () { let reverseProxyRef = this.vReverseProxyRef if (reverseProxyRef == null) { @@ -23,7 +23,8 @@ Vue.component("reverse-proxy-box", { return { reverseProxyRef: reverseProxyRef, reverseProxyConfig: reverseProxyConfig, - advancedVisible: false + advancedVisible: false, + family: this.vFamily } }, watch: { @@ -58,7 +59,7 @@ Vue.component("reverse-proxy-box", { - + 回源主机名(Host) 跟随代理服务   @@ -76,14 +77,14 @@ Vue.component("reverse-proxy-box", { - + 请求URI(RequestURI)

\${requestURI}为完整的请求URI,可以使用类似于"\${requestURI}?arg1=value1&arg2=value2"的形式添加你的参数。

- + 去除URL前缀(StripPrefix) diff --git a/web/public/js/components/server/server-name-box.js b/web/public/js/components/server/server-name-box.js index b7ccef8f..b77777fa 100644 --- a/web/public/js/components/server/server-name-box.js +++ b/web/public/js/components/server/server-name-box.js @@ -85,8 +85,8 @@ Vue.component("server-name-box", {
[添加域名绑定]
-
|
-
+
|
+
diff --git a/web/views/@default/servers/components/index.html b/web/views/@default/servers/components/index.html index 02fe5b92..4ae82d63 100644 --- a/web/views/@default/servers/components/index.html +++ b/web/views/@default/servers/components/index.html @@ -3,6 +3,7 @@
@@ -78,6 +79,36 @@
+ +
+ + + + + + + + + +
允许的端口范围 +
+
+ +
+
+ - +
+
+ +
+
+

用户创建TCP/TLS负载均衡服务时可以随机选择的端口范围,最小不能小于1024,最大不能大于65534。

+
排除的端口 + +

当为用户随机分配端口时要排除的端口。

+
+
+
保存 diff --git a/web/views/@default/servers/components/index.js b/web/views/@default/servers/components/index.js index 1035c2dd..6b728af6 100644 --- a/web/views/@default/servers/components/index.js +++ b/web/views/@default/servers/components/index.js @@ -1,22 +1,31 @@ Tea.context(function () { - this.tab = "domainMatch" + this.tab = "domainMatch" - this.selectTab = function (tab) { - this.tab = tab - } + this.$delay(function () { + if (window.location.hash != null && window.location.hash.length > 1) { + this.selectTab(window.location.hash.substr(1)) + } + }) - this.success = function () { - teaweb.success("保存成功") - } + this.selectTab = function (tab) { + this.tab = tab + window.location.hash = "#" + tab + } - /** - * 域名不匹配动作 - */ - this.domainMismatchAction = "page" + this.success = function () { + teaweb.success("保存成功", function () { + teaweb.reload() + }) + } - this.domainMismatchActionPageOptions = { - statusCode: 404, - contentHTML: ` + /** + * 域名不匹配动作 + */ + this.domainMismatchAction = "page" + + this.domainMismatchActionPageOptions = { + statusCode: 404, + contentHTML: ` @@ -28,13 +37,29 @@ Tea.context(function () { ` - } - if (this.globalConfig.httpAll.domainMismatchAction != null) { - this.domainMismatchAction = this.globalConfig.httpAll.domainMismatchAction.code + } + if (this.globalConfig.httpAll.domainMismatchAction != null) { + this.domainMismatchAction = this.globalConfig.httpAll.domainMismatchAction.code - if (this.domainMismatchAction == "page") { - this.domainMismatchActionPageOptions = this.globalConfig.httpAll.domainMismatchAction.options; - } - } + if (this.domainMismatchAction == "page") { + this.domainMismatchActionPageOptions = this.globalConfig.httpAll.domainMismatchAction.options; + } + } + /** + * TCP端口 + */ + this.tcpAllPortRangeMin = 10000 + this.tcpAllPortRangeMax = 40000 + if (this.globalConfig.tcpAll.portRangeMin > 0) { + this.tcpAllPortRangeMin = this.globalConfig.tcpAll.portRangeMin + } + if (this.globalConfig.tcpAll.portRangeMax > 0) { + this.tcpAllPortRangeMax = this.globalConfig.tcpAll.portRangeMax + } + + this.tcpAllDenyPorts = [] + if (this.globalConfig.tcpAll.denyPorts != null) { + this.tcpAllDenyPorts = this.globalConfig.tcpAll.denyPorts + } }) \ No newline at end of file diff --git a/web/views/@default/servers/server/settings/reverseProxy/setting.html b/web/views/@default/servers/server/settings/reverseProxy/setting.html index ce1c5581..dfef5a45 100644 --- a/web/views/@default/servers/server/settings/reverseProxy/setting.html +++ b/web/views/@default/servers/server/settings/reverseProxy/setting.html @@ -8,7 +8,7 @@
- +
\ No newline at end of file