刘河 il y a 6 ans
Parent
commit
0c87b4119a

+ 8 - 0
conf/nps.conf

@@ -49,3 +49,11 @@ auth_crypt_key =1234567812345678
 
 #Web management multi-user login
 #allow_user_login=true
+
+#extension
+allow_flow_limit=false
+allow_rate_limit=false
+allow_connection_num_limit=false
+allow_multi_ip=false
+
+

+ 4 - 0
web/controllers/base.go

@@ -45,6 +45,10 @@ func (s *BaseController) Prepare() {
 	}
 	s.Data["https_just_proxy"], _ = beego.AppConfig.Bool("https_just_proxy")
 	s.Data["allow_user_login"], _ = beego.AppConfig.Bool("allow_user_login")
+	s.Data["allow_flow_limit"], _ = beego.AppConfig.Bool("allow_flow_limit")
+	s.Data["allow_rate_limit"], _ = beego.AppConfig.Bool("allow_rate_limit")
+	s.Data["allow_connection_num_limit"], _ = beego.AppConfig.Bool("allow_connection_num_limit")
+	s.Data["allow_multi_ip"], _ = beego.AppConfig.Bool("allow_multi_ip")
 }
 
 //加载模板

+ 6 - 2
web/views/client/add.html

@@ -11,7 +11,7 @@
                                    placeholder="remark">
                         </div>
                     </div>
-
+                {{if eq true .allow_flow_limit}}
                     <div class="form-group" id="flow_limit">
                         <label class="col-sm-2 control-label" langtag="info-flow-limit">流量限制</label>
                         <div class="col-sm-10">
@@ -20,7 +20,8 @@
                             <span class="help-block m-b-none" langtag="info-flow-limit-unit">unit: M</span>
                         </div>
                     </div>
-
+                {{end}}
+                {{if eq true .allow_rate_limit}}
                     <div class="form-group" id="rate_limit">
                         <label class="control-label col-sm-2" langtag="info-bandwidth">带宽限制</label>
                         <div class="col-sm-10">
@@ -29,6 +30,8 @@
                             <span class="help-block m-b-none" langtag="info-bandwidth-unit">unit: KB/S</span>
                         </div>
                     </div>
+                {{end}}
+                {{if eq true .allow_connection_num_limit}}
                     <div class="form-group" id="max_conn">
                         <label class="control-label col-sm-2" langtag="info-max-conn-num">客户端最大连接数量</label>
                         <div class="col-sm-10">
@@ -36,6 +39,7 @@
                                    placeholder="empty means to be unrestricted">
                         </div>
                     </div>
+                {{end}}
                     <div class="form-group" id="u">
                         <label class="control-label col-sm-2" langtag="info-web-auth-username">basic权限认证用户名</label>
                         <div class="col-sm-10">

+ 7 - 0
web/views/client/edit.html

@@ -13,6 +13,7 @@
                         </div>
                     </div>
                 {{if eq true .isAdmin}}
+                {{if eq true .allow_flow_limit}}
                     <div class="form-group" id="flow_limit">
                         <label class="col-sm-2 control-label" langtag="info-flow-limit">流量限制</label>
                         <div class="col-sm-10">
@@ -21,6 +22,8 @@
                             <span class="help-block m-b-none">unit: M</span>
                         </div>
                     </div>
+                {{end}}
+                {{if eq true .allow_rate_limit}}
 
                     <div class="form-group" id="rate_limit">
                         <label class="control-label col-sm-2" langtag="info-bandwidth">带宽限制</label>
@@ -30,6 +33,9 @@
                             <span class="help-block m-b-none">unit: KB/S</span>
                         </div>
                     </div>
+                {{end}}
+                {{if eq true .allow_connection_num_limit}}
+
                     <div class="form-group" id="max_conn">
                         <label class="control-label col-sm-2" langtag="info-max-conn-num">客户端最大连接数</label>
                         <div class="col-sm-10">
@@ -37,6 +43,7 @@
                                    placeholder="empty means to be unrestricted">
                         </div>
                     </div>
+                {{end}}
                 {{end}}
                     <div class="form-group" id="u">
                         <label class="control-label col-sm-2" langtag="info-web-auth-username">basic权限认证用户名</label>

+ 2 - 2
web/views/index/add.html

@@ -27,7 +27,7 @@
                                    placeholder="empty means to be unrestricted">
                         </div>
                     </div>
-
+                {{if eq true .allow_multi_ip}}
                     <div class="form-group" id="server_ip">
                         <label class="col-sm-2 control-label" langtag="info-server-ip">服务端ip</label>
                         <div class="col-sm-10">
@@ -35,7 +35,7 @@
                                    placeholder="such as 0.0.0.0">
                         </div>
                     </div>
-
+                {{end}}
                     <div class="form-group" id="port">
                         <label class="col-sm-2 control-label" langtag="info-server-port">服务端端口</label>
                         <div class="col-sm-10">

+ 2 - 0
web/views/index/edit.html

@@ -28,6 +28,7 @@
                                    placeholder="empty means to be unrestricted">
                         </div>
                     </div>
+                {{if eq true .allow_multi_ip}}
                     <div class="form-group" id="server_ip">
                         <label class="col-sm-2 control-label" langtag="info-server-ip">服务端ip</label>
                         <div class="col-sm-10">
@@ -35,6 +36,7 @@
                                    placeholder="such as 0.0.0.0">
                         </div>
                     </div>
+                {{end}}
                     <div class="form-group" id="port">
                         <label class="col-sm-2 control-label" langtag="info-server-port">服务端端口</label>
                         <div class="col-sm-10">