瀏覽代碼

New - leastload, leastping balancer

MHSanaei 1 年之前
父節點
當前提交
ac5d8af4f9
共有 2 個文件被更改,包括 9 次插入5 次删除
  1. 7 5
      web/html/xui/xray.html
  2. 2 0
      web/html/xui/xray_balancer_modal.html

+ 7 - 5
web/html/xui/xray.html

@@ -537,6 +537,8 @@
                                 <template slot="strategy" slot-scope="text, balancer, index">
                                 <template slot="strategy" slot-scope="text, balancer, index">
                                     <a-tag style="margin:0;" v-if="balancer.strategy=='random'" color="purple">Random</a-tag>
                                     <a-tag style="margin:0;" v-if="balancer.strategy=='random'" color="purple">Random</a-tag>
                                     <a-tag style="margin:0;" v-if="balancer.strategy=='roundRobin'" color="green">Round Robin</a-tag>
                                     <a-tag style="margin:0;" v-if="balancer.strategy=='roundRobin'" color="green">Round Robin</a-tag>
+                                    <a-tag style="margin:0;" v-if="balancer.strategy=='leastload'" color="green">Least Load</a-tag>
+                                    <a-tag style="margin:0;" v-if="balancer.strategy=='leastping'" color="green">Least Ping</a-tag>
                                 </template>
                                 </template>
                                 <template slot="selector" slot-scope="text, balancer, index">
                                 <template slot="selector" slot-scope="text, balancer, index">
                                     <a-tag class="info-large-tag" style="margin:1;" v-for="sel in balancer.selector">[[ sel ]]</a-tag>
                                     <a-tag class="info-large-tag" style="margin:1;" v-for="sel in balancer.selector">[[ sel ]]</a-tag>
@@ -1131,7 +1133,7 @@
                             'tag': balancer.tag,
                             'tag': balancer.tag,
                             'selector': balancer.selector
                             'selector': balancer.selector
                         };
                         };
-                        if (balancer.strategy == 'roundRobin') {
+                        if (balancer.strategy === 'roundRobin' || balancer.strategy === 'leastload' || balancer.strategy === 'leastping') {
                             tmpBalancer.strategy = {
                             tmpBalancer.strategy = {
                                 'type': balancer.strategy
                                 'type': balancer.strategy
                             };
                             };
@@ -1158,7 +1160,7 @@
                             'tag': balancer.tag,
                             'tag': balancer.tag,
                             'selector': balancer.selector
                             'selector': balancer.selector
                         };
                         };
-                        if (balancer.strategy == 'roundRobin') {
+                        if (balancer.strategy === 'roundRobin' || balancer.strategy === 'leastload' || balancer.strategy === 'leastping') {
                             tmpBalancer.strategy = {
                             tmpBalancer.strategy = {
                                 'type': balancer.strategy
                                 'type': balancer.strategy
                             };
                             };
@@ -1474,11 +1476,11 @@
                     if (this.templateSettings != null && this.templateSettings.routing != null && this.templateSettings.routing.balancers != null) {
                     if (this.templateSettings != null && this.templateSettings.routing != null && this.templateSettings.routing.balancers != null) {
                         this.templateSettings.routing.balancers.forEach((o, index) => {
                         this.templateSettings.routing.balancers.forEach((o, index) => {
                             let strategy = "random"
                             let strategy = "random"
-                            if (o.strategy && o.strategy.type == "roundRobin") {
-                                strategy = o.strategy.type
+                            if (o.strategy && (o.strategy.type == "roundRobin" || o.strategy.type == "leastload" || o.strategy.type == "leastping")) {
+                                strategy = o.strategy.type;
                             }
                             }
 
 
-                            data.push({ 
+                            data.push({
                                 'key': index,
                                 'key': index,
                                 'tag': o.tag ? o.tag : "",
                                 'tag': o.tag ? o.tag : "",
                                 'strategy': strategy,
                                 'strategy': strategy,

+ 2 - 0
web/html/xui/xray_balancer_modal.html

@@ -21,6 +21,8 @@
             <a-select v-model="balancerModal.balancer.strategy" :dropdown-class-name="themeSwitcher.currentTheme">
             <a-select v-model="balancerModal.balancer.strategy" :dropdown-class-name="themeSwitcher.currentTheme">
                 <a-select-option value="random">Random</a-select-option>
                 <a-select-option value="random">Random</a-select-option>
                 <a-select-option value="roundRobin">Round Robin</a-select-option>
                 <a-select-option value="roundRobin">Round Robin</a-select-option>
+                <a-select-option value="leastload">Least Load</a-select-option>
+                <a-select-option value="leastping">Least Ping</a-select-option>
             </a-select>
             </a-select>
         </a-form-item>
         </a-form-item>
         <a-form-item label='{{ i18n "pages.xray.balancer.balancerSelectors" }}' has-feedback 
         <a-form-item label='{{ i18n "pages.xray.balancer.balancerSelectors" }}' has-feedback