TCP、TLS、UDP支持端口范围

This commit is contained in:
刘祥超
2021-10-10 16:30:21 +08:00
parent af440e5c5b
commit 265e126faf
6 changed files with 82 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
Vue.component("network-addresses-box", {
props: ["v-server-type", "v-addresses", "v-protocol", "v-name", "v-from"],
props: ["v-server-type", "v-addresses", "v-protocol", "v-name", "v-from", "v-support-range"],
data: function () {
let addresses = this.vAddresses
if (addresses == null) {
@@ -24,7 +24,8 @@ Vue.component("network-addresses-box", {
addresses: addresses,
protocol: protocol,
name: name,
from: from
from: from,
supportRange: this.vSupportRange
}
},
watch: {
@@ -41,10 +42,16 @@ Vue.component("network-addresses-box", {
addAddr: function () {
let that = this
window.UPDATING_ADDR = null
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from, {
height: "16em",
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from + "&supportRange=" + (this.supportRange ? 1 : 0), {
height: "18em",
callback: function (resp) {
var addr = resp.data.address
if (that.addresses.$find(function (k, v) {
return addr.host == v.host && addr.portRange == v.portRange && addr.protocol == v.protocol
}) != null) {
teaweb.warn("要添加的网络地址已经存在")
return
}
that.addresses.push(addr)
if (["https", "https4", "https6"].$contains(addr.protocol)) {
this.tlsProtocolName = "HTTPS"
@@ -66,8 +73,8 @@ Vue.component("network-addresses-box", {
updateAddr: function (index, addr) {
let that = this
window.UPDATING_ADDR = addr
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from, {
height: "16em",
teaweb.popup("/servers/addPortPopup?serverType=" + this.vServerType + "&protocol=" + this.protocol + "&from=" + this.from + "&supportRange=" + (this.supportRange ? 1 : 0), {
height: "18em",
callback: function (resp) {
var addr = resp.data.address
Vue.set(that.addresses, index, addr)
@@ -91,7 +98,7 @@ Vue.component("network-addresses-box", {
<input type="hidden" :name="name" :value="JSON.stringify(addresses)"/>
<div v-if="addresses.length > 0">
<div class="ui label small basic" v-for="(addr, index) in addresses">
{{addr.protocol}}://<span v-if="addr.host.length > 0">{{addr.host.quoteIP()}}</span><span v-if="addr.host.length == 0">*</span>:{{addr.portRange}}
{{addr.protocol}}://<span v-if="addr.host.length > 0">{{addr.host.quoteIP()}}</span><span v-if="addr.host.length == 0">*</span>:<span v-if="addr.portRange.indexOf('-')<0">{{addr.portRange}}</span><span v-else style="font-style: italic">{{addr.portRange}}</span>
<a href="" @click.prevent="updateAddr(index, addr)" title="修改"><i class="icon pencil small"></i></a>
<a href="" @click.prevent="removeAddr(index)" title="删除"><i class="icon remove"></i></a> </div>
<div class="ui divider"></div>