mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
[externalProxy] seprated port field #656
This commit is contained in:
@@ -254,14 +254,9 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
newObj["ps"] = s.genRemark(inbound, email, ep["remark"].(string))
|
newObj["ps"] = s.genRemark(inbound, email, ep["remark"].(string))
|
||||||
dest, _ := ep["dest"].(string)
|
newObj["add"] = ep["dest"].(string)
|
||||||
d := strings.Split(dest, ":")
|
newObj["port"] = ep["port"].(string)
|
||||||
if len(d) == 2 {
|
|
||||||
newObj["add"] = d[0]
|
|
||||||
newObj["port"] = d[1]
|
|
||||||
} else {
|
|
||||||
newObj["add"] = d[0]
|
|
||||||
}
|
|
||||||
if newSecurity != "same" {
|
if newSecurity != "same" {
|
||||||
newObj["tls"] = newSecurity
|
newObj["tls"] = newSecurity
|
||||||
}
|
}
|
||||||
@@ -421,13 +416,9 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
|
|||||||
ep, _ := externalProxy.(map[string]interface{})
|
ep, _ := externalProxy.(map[string]interface{})
|
||||||
newSecurity, _ := ep["forceTls"].(string)
|
newSecurity, _ := ep["forceTls"].(string)
|
||||||
dest, _ := ep["dest"].(string)
|
dest, _ := ep["dest"].(string)
|
||||||
d := strings.Split(dest, ":")
|
port, _ := ep["port"].(string)
|
||||||
link := ""
|
link := fmt.Sprintf("vless://%s@%s:%s", uuid, dest, port)
|
||||||
if len(d) == 2 {
|
|
||||||
link = fmt.Sprintf("vless://%s@%s:%s", uuid, d[0], d[1])
|
|
||||||
} else {
|
|
||||||
link = fmt.Sprintf("vless://%s@%s:%d", uuid, d[0], port)
|
|
||||||
}
|
|
||||||
if newSecurity != "same" {
|
if newSecurity != "same" {
|
||||||
params["security"] = newSecurity
|
params["security"] = newSecurity
|
||||||
} else {
|
} else {
|
||||||
@@ -603,13 +594,9 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
|
|||||||
ep, _ := externalProxy.(map[string]interface{})
|
ep, _ := externalProxy.(map[string]interface{})
|
||||||
newSecurity, _ := ep["forceTls"].(string)
|
newSecurity, _ := ep["forceTls"].(string)
|
||||||
dest, _ := ep["dest"].(string)
|
dest, _ := ep["dest"].(string)
|
||||||
d := strings.Split(dest, ":")
|
port, _ := ep["port"].(string)
|
||||||
link := ""
|
link := fmt.Sprintf("trojan://%s@%s:%s", password, dest, port)
|
||||||
if len(d) == 2 {
|
|
||||||
link = fmt.Sprintf("trojan://%s@%s:%s", password, d[0], d[1])
|
|
||||||
} else {
|
|
||||||
link = fmt.Sprintf("trojan://%s@%s:%d", password, d[0], port)
|
|
||||||
}
|
|
||||||
if newSecurity != "same" {
|
if newSecurity != "same" {
|
||||||
params["security"] = newSecurity
|
params["security"] = newSecurity
|
||||||
} else {
|
} else {
|
||||||
@@ -760,13 +747,9 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st
|
|||||||
ep, _ := externalProxy.(map[string]interface{})
|
ep, _ := externalProxy.(map[string]interface{})
|
||||||
newSecurity, _ := ep["forceTls"].(string)
|
newSecurity, _ := ep["forceTls"].(string)
|
||||||
dest, _ := ep["dest"].(string)
|
dest, _ := ep["dest"].(string)
|
||||||
d := strings.Split(dest, ":")
|
port, _ := ep["port"].(string)
|
||||||
link := ""
|
link := fmt.Sprintf("ss://%s@%s:%s", base64.StdEncoding.EncodeToString([]byte(encPart)), dest, port)
|
||||||
if len(d) == 2 {
|
|
||||||
link = fmt.Sprintf("ss://%s@%s:%s", base64.StdEncoding.EncodeToString([]byte(encPart)), d[0], d[1])
|
|
||||||
} else {
|
|
||||||
link = fmt.Sprintf("ss://%s@%s:%d", base64.StdEncoding.EncodeToString([]byte(encPart)), d[0], inbound.Port)
|
|
||||||
}
|
|
||||||
if newSecurity != "same" {
|
if newSecurity != "same" {
|
||||||
params["security"] = newSecurity
|
params["security"] = newSecurity
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1367,16 +1367,9 @@ class Inbound extends XrayCommonClass {
|
|||||||
} else {
|
} else {
|
||||||
this.stream.externalProxy.forEach((ep) => {
|
this.stream.externalProxy.forEach((ep) => {
|
||||||
let r = [remark, email, ep.remark].filter(x => x.length > 0).join('-')
|
let r = [remark, email, ep.remark].filter(x => x.length > 0).join('-')
|
||||||
let dest = ep.dest.split(":");
|
|
||||||
if(dest.length == 2) {
|
|
||||||
addr = dest[0];
|
|
||||||
port = dest[1];
|
|
||||||
} else {
|
|
||||||
addr = dest[0];
|
|
||||||
}
|
|
||||||
result.push({
|
result.push({
|
||||||
remark: r,
|
remark: r,
|
||||||
link: this.genLink(addr, port, ep.forceTls, r, client)
|
link: this.genLink(ep.dest, ep.port, ep.forceTls, r, client)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,23 +3,26 @@
|
|||||||
<a-divider style="margin:0;"></a-divider>
|
<a-divider style="margin:0;"></a-divider>
|
||||||
<a-form-item label="External Proxy">
|
<a-form-item label="External Proxy">
|
||||||
<a-switch v-model="externalProxy"></a-switch>
|
<a-switch v-model="externalProxy"></a-switch>
|
||||||
<a-button v-if="externalProxy" type="primary" style="margin-left: 10px" size="small" @click="inbound.stream.externalProxy.push({forceTls: 'same', dest: '', remark: ''})">+</a-button>
|
<a-button v-if="externalProxy" type="primary" style="margin-left: 10px" size="small" @click="inbound.stream.externalProxy.push({forceTls: 'same', dest: '', port: 443, remark: ''})">+</a-button>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<table width="100%" class="ant-table-tbody" v-if="externalProxy">
|
<table width="100%" class="ant-table-tbody" v-if="externalProxy">
|
||||||
<tr style="line-height: 40px;">
|
<tr style="line-height: 40px;">
|
||||||
<td width="100%">
|
<td width="100%">
|
||||||
<a-input-group style="margin-top:5px;" compact v-for="(row, index) in inbound.stream.externalProxy">
|
<a-input-group style="margin-top:5px;" compact v-for="(row, index) in inbound.stream.externalProxy">
|
||||||
<template v-if="inbound.canEnableTls()">
|
<template>
|
||||||
<a-tooltip title="Force TLS">
|
<a-tooltip title="Force TLS">
|
||||||
<a-select v-model="row.forceTls" style="width:20%; margin: 0px" :dropdown-class-name="themeSwitcher.currentTheme">
|
<a-select v-model="row.forceTls" style="width:20%; margin: 0px" :dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
<a-select-option value="same">{{ i18n "pages.inbounds.same" }}</a-select-option>
|
<a-select-option value="same">{{ i18n "pages.inbounds.same" }}</a-select-option>
|
||||||
<a-select-option value="none">{{ i18n "none" }}</a-select-option>
|
<a-select-option value="none">{{ i18n "none" }}</a-select-option>
|
||||||
<a-select-option value="tls">TLS</a-select-option>
|
<a-select-option value="tls">TLS</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<a-input style="width: 40%" v-model.trim="row.dest" placeholder='{{ i18n "host" }}:{{ i18n "pages.inbounds.port" }}'></a-input>
|
<a-input style="width: 35%" v-model.trim="row.dest" placeholder='{{ i18n "host" }}'></a-input>
|
||||||
<a-input :style="inbound.canEnableTls() ? 'width: 30%' : 'width: 50%'" v-model.trim="row.remark" placeholder='{{ i18n "remark" }}'></a-input>
|
<a-tooltip title='{{ i18n "pages.inbounds.port" }}'>
|
||||||
|
<a-input-number style="width: 15%;" v-model.number="row.port" min="1" max="65531"></a-input-number>
|
||||||
|
</a-tooltip>
|
||||||
|
<a-input style="width: 20%" v-model.trim="row.remark" placeholder='{{ i18n "remark" }}'></a-input>
|
||||||
<a-button style="width: 10%; margin: 0px" @click="inbound.stream.externalProxy.splice(index, 1)">-</a-button>
|
<a-button style="width: 10%; margin: 0px" @click="inbound.stream.externalProxy.splice(index, 1)">-</a-button>
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -75,7 +75,8 @@
|
|||||||
if (value) {
|
if (value) {
|
||||||
inModal.inbound.stream.externalProxy = [{
|
inModal.inbound.stream.externalProxy = [{
|
||||||
forceTls: "same",
|
forceTls: "same",
|
||||||
dest: window.location.hostname + ":" + inModal.inbound.port,
|
dest: window.location.hostname,
|
||||||
|
port: inModal.inbound.port,
|
||||||
remark: ""
|
remark: ""
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1383,7 +1383,8 @@ func (s *InboundService) MigrationRequirements() {
|
|||||||
for _, domain := range domains {
|
for _, domain := range domains {
|
||||||
if domainMap, ok := domain.(map[string]interface{}); ok {
|
if domainMap, ok := domain.(map[string]interface{}); ok {
|
||||||
domainMap["forceTls"] = "same"
|
domainMap["forceTls"] = "same"
|
||||||
domainMap["dest"] = domainMap["domain"].(string) + fmt.Sprintf(":%d", ep.Port)
|
domainMap["port"] = ep.Port
|
||||||
|
domainMap["dest"] = domainMap["domain"].(string)
|
||||||
delete(domainMap, "domain")
|
delete(domainMap, "domain")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user