mirror of
https://github.com/alireza0/x-ui.git
synced 2026-03-14 05:23:09 +00:00
DNS - Expect IPs
This commit is contained in:
@@ -1,96 +1,114 @@
|
|||||||
{{define "dnsModal"}}
|
{{define "dnsModal"}}
|
||||||
<a-modal id="dns-modal" v-model="dnsModal.visible" :title="dnsModal.title" @ok="dnsModal.ok"
|
<a-modal id="dns-modal" v-model="dnsModal.visible" :title="dnsModal.title" @ok="dnsModal.ok" :closable="true"
|
||||||
:closable="true" :mask-closable="false"
|
:mask-closable="false" :ok-text="dnsModal.okText" cancel-text='{{ i18n "close" }}'
|
||||||
:ok-text="dnsModal.okText" cancel-text='{{ i18n "close" }}' :class="themeSwitcher.currentTheme">
|
:class="themeSwitcher.currentTheme">
|
||||||
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
<a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
|
||||||
<a-form-item label='{{ i18n "pages.xray.outbound.address" }}'>
|
<a-form-item label='{{ i18n "pages.xray.outbound.address" }}'>
|
||||||
<a-input v-model.trim="dnsModal.dnsServer.address"></a-input>
|
<a-input v-model.trim="dnsModal.dnsServer.address"></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='{{ i18n "pages.xray.dns.domains" }}'>
|
<a-form-item label='{{ i18n "pages.xray.dns.domains" }}'>
|
||||||
<a-button size="small" type="primary" @click="dnsModal.dnsServer.domains.push('')">+</a-button>
|
<a-button icon="plus" size="small" type="primary" @click="dnsModal.dnsServer.domains.push('')"></a-button>
|
||||||
<template v-for="(domain, index) in dnsModal.dnsServer.domains">
|
<template v-for="(domain, index) in dnsModal.dnsServer.domains">
|
||||||
<a-input v-model.trim="dnsModal.dnsServer.domains[index]">
|
<a-input v-model.trim="dnsModal.dnsServer.domains[index]">
|
||||||
<a-button size="small" slot="addonAfter" @click="dnsModal.dnsServer.domains.splice(index,1)">-</a-button>
|
<a-button icon="minus" size="small" slot="addonAfter"
|
||||||
</a-input>
|
@click="dnsModal.dnsServer.domains.splice(index,1)"></a-button>
|
||||||
</template>
|
</a-input>
|
||||||
</a-form-item>
|
</template>
|
||||||
<a-form-item label='{{ i18n "pages.xray.dns.strategy" }}' v-if="isAdvanced">
|
</a-form-item>
|
||||||
<a-select
|
<a-form-item label='{{ i18n "pages.xray.dns.strategy" }}' v-if="isAdvanced">
|
||||||
v-model="dnsModal.dnsServer.queryStrategy"
|
<a-select v-model="dnsModal.dnsServer.queryStrategy" style="width: 100%"
|
||||||
style="width: 100%"
|
:dropdown-class-name="themeSwitcher.currentTheme">
|
||||||
:dropdown-class-name="themeSwitcher.currentTheme">
|
<a-select-option :value="l" :label="l" v-for="l in ['UseIP', 'UseIPv4', 'UseIPv6']"> [[ l ]] </a-select-option>
|
||||||
<a-select-option :value="l" :label="l" v-for="l in ['UseIP', 'UseIPv4', 'UseIPv6']">
|
</a-select>
|
||||||
[[ l ]]
|
</a-form-item>
|
||||||
</a-select-option>
|
<a-form-item label='Skip Fallback' v-if="isAdvanced">
|
||||||
</a-select>
|
<a-switch v-model="dnsModal.dnsServer.skipFallback"></a-switch>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label='Skip Fallback' v-if="isAdvanced">
|
<a-form-item label='{{ i18n "pages.xray.dns.expectIPs"}}'>
|
||||||
<a-switch v-model="dnsModal.dnsServer.skipFallback"></a-switch>
|
<a-button icon="plus" size="small" type="primary" @click="dnsModal.dnsServer.expectIPs.push('')"></a-button>
|
||||||
</a-form-item>
|
<template v-for="(domain, index) in dnsModal.dnsServer.expectIPs">
|
||||||
</a-form>
|
<a-input v-model.trim="dnsModal.dnsServer.expectIPs[index]">
|
||||||
|
<a-button icon="minus" size="small" slot="addonAfter"
|
||||||
|
@click="dnsModal.dnsServer.expectIPs.splice(index,1)"></a-button>
|
||||||
|
</a-input>
|
||||||
|
</template>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
</a-modal>
|
</a-modal>
|
||||||
<script>
|
<script>
|
||||||
const dnsModal = {
|
const dnsModal = {
|
||||||
title: '',
|
title: '',
|
||||||
visible: false,
|
visible: false,
|
||||||
okText: '{{ i18n "confirm" }}',
|
okText: '{{ i18n "confirm" }}',
|
||||||
isEdit: false,
|
isEdit: false,
|
||||||
confirm: null,
|
confirm: null,
|
||||||
dnsServer: {
|
dnsServer: {
|
||||||
address: "localhost",
|
address: "localhost",
|
||||||
domains: [],
|
domains: [],
|
||||||
queryStrategy: 'UseIP',
|
expectIPs: [],
|
||||||
skipFallback: true,
|
queryStrategy: 'UseIP',
|
||||||
},
|
skipFallback: true,
|
||||||
ok() {
|
},
|
||||||
domains = dnsModal.dnsServer.domains.filter(d => d.length>0);
|
ok() {
|
||||||
dnsModal.dnsServer.domains = domains;
|
domains = dnsModal.dnsServer.domains.filter(d => d.length > 0);
|
||||||
newDnsServer = domains.length > 0 ? dnsModal.dnsServer : dnsModal.dnsServer.address;
|
expectIPs = dnsModal.dnsServer.expectIPs.filter(ip => ip.length > 0);
|
||||||
ObjectUtil.execute(dnsModal.confirm, newDnsServer);
|
dnsModal.dnsServer.domains = domains;
|
||||||
},
|
dnsModal.dnsServer.expectIPs = expectIPs;
|
||||||
show({ title='', okText='{{ i18n "confirm" }}', dnsServer, confirm=(dnsServer)=>{}, isEdit=false }) {
|
newDnsServer = (domains.length > 0 || expectIPs.length > 0) ? dnsModal.dnsServer : dnsModal.dnsServer.address;
|
||||||
this.title = title;
|
ObjectUtil.execute(dnsModal.confirm, newDnsServer);
|
||||||
this.okText = okText;
|
},
|
||||||
this.confirm = confirm;
|
|
||||||
this.visible = true;
|
|
||||||
if(isEdit) {
|
|
||||||
if (typeof dnsServer == 'object'){
|
|
||||||
this.dnsServer = dnsServer;
|
|
||||||
} else {
|
|
||||||
this.dnsServer = {
|
|
||||||
address: dnsServer?? "",
|
|
||||||
domains: [],
|
|
||||||
queryStrategy: 'UseIP',
|
|
||||||
skipFallback: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.dnsServer = {
|
|
||||||
address: "localhost",
|
|
||||||
domains: [],
|
|
||||||
queryStrategy: 'UseIP',
|
|
||||||
skipFallback: true,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.isEdit = isEdit;
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
dnsModal.visible = false;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
new Vue({
|
show({
|
||||||
delimiters: ['[[', ']]'],
|
title = '',
|
||||||
el: '#dns-modal',
|
okText = '{{ i18n "confirm" }}',
|
||||||
data: {
|
dnsServer,
|
||||||
dnsModal: dnsModal,
|
confirm = (dnsServer) => { },
|
||||||
},
|
isEdit = false
|
||||||
computed: {
|
}) {
|
||||||
isAdvanced: {
|
this.title = title;
|
||||||
get: function () { return dnsModal.dnsServer.domains.length>0 }
|
this.okText = okText;
|
||||||
|
this.confirm = confirm;
|
||||||
|
this.visible = true;
|
||||||
|
if (isEdit) {
|
||||||
|
if (typeof dnsServer == 'object') {
|
||||||
|
this.dnsServer = dnsServer;
|
||||||
|
} else {
|
||||||
|
this.dnsServer = {
|
||||||
|
address: dnsServer ?? "",
|
||||||
|
domains: [],
|
||||||
|
expectIPs: [],
|
||||||
|
queryStrategy: 'UseIP',
|
||||||
|
skipFallback: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
this.dnsServer = {
|
||||||
|
address: "localhost",
|
||||||
|
domains: [],
|
||||||
|
expectIPs: [],
|
||||||
|
queryStrategy: 'UseIP',
|
||||||
|
skipFallback: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.isEdit = isEdit;
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
dnsModal.visible = false;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
new Vue({
|
||||||
|
delimiters: ['[[', ']]'],
|
||||||
|
el: '#dns-modal',
|
||||||
|
data: {
|
||||||
|
dnsModal: dnsModal,
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
isAdvanced: {
|
||||||
|
get: function () {
|
||||||
|
return dnsModal.dnsServer.domains.length > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
{{end}}
|
{{end}}
|
||||||
@@ -657,6 +657,9 @@
|
|||||||
<template slot="domain" slot-scope="dns,index">
|
<template slot="domain" slot-scope="dns,index">
|
||||||
<span v-if="typeof dns == 'object'">[[ dns.domains.join(",") ]]</span>
|
<span v-if="typeof dns == 'object'">[[ dns.domains.join(",") ]]</span>
|
||||||
</template>
|
</template>
|
||||||
|
<template slot="expectIPs" slot-scope="dns,index">
|
||||||
|
<span v-if="typeof dns == 'object'">[[ dns.expectIPs.join(",") ]]</span>
|
||||||
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
<a-divider>Fake DNS</a-divider>
|
<a-divider>Fake DNS</a-divider>
|
||||||
<a-button type="primary" icon="plus" @click="addFakedns()" style="margin-bottom: 10px;">{{ i18n "pages.xray.fakedns.add" }}</a-button>
|
<a-button type="primary" icon="plus" @click="addFakedns()" style="margin-bottom: 10px;">{{ i18n "pages.xray.fakedns.add" }}</a-button>
|
||||||
@@ -766,6 +769,7 @@
|
|||||||
{ title: "#", align: 'center', width: 20, scopedSlots: { customRender: 'action' } },
|
{ title: "#", align: 'center', width: 20, scopedSlots: { customRender: 'action' } },
|
||||||
{ title: '{{ i18n "pages.xray.outbound.address"}}', align: 'center', width: 50, scopedSlots: { customRender: 'address' } },
|
{ title: '{{ i18n "pages.xray.outbound.address"}}', align: 'center', width: 50, scopedSlots: { customRender: 'address' } },
|
||||||
{ title: '{{ i18n "pages.xray.dns.domains"}}', align: 'center', width: 50, scopedSlots: { customRender: 'domain' } },
|
{ title: '{{ i18n "pages.xray.dns.domains"}}', align: 'center', width: 50, scopedSlots: { customRender: 'domain' } },
|
||||||
|
{ title: '{{ i18n "pages.xray.dns.expectIPs"}}', align: 'center', width: 50, scopedSlots: { customRender: 'expectIPs' } },
|
||||||
];
|
];
|
||||||
|
|
||||||
const fakednsColumns = [
|
const fakednsColumns = [
|
||||||
|
|||||||
@@ -422,6 +422,7 @@
|
|||||||
"add" = "Add Server"
|
"add" = "Add Server"
|
||||||
"edit" = "Edit Server"
|
"edit" = "Edit Server"
|
||||||
"domains" = "Domains"
|
"domains" = "Domains"
|
||||||
|
"expectIPs" = "Expect IPs"
|
||||||
|
|
||||||
[pages.xray.fakedns]
|
[pages.xray.fakedns]
|
||||||
"add" = "Add Fake DNS"
|
"add" = "Add Fake DNS"
|
||||||
|
|||||||
@@ -420,6 +420,7 @@
|
|||||||
"add" = "افزودن سرور"
|
"add" = "افزودن سرور"
|
||||||
"edit" = "ویرایش سرور"
|
"edit" = "ویرایش سرور"
|
||||||
"domains" = "دامنهها"
|
"domains" = "دامنهها"
|
||||||
|
"expectIPs" = "آیپیهای مورد انتظار"
|
||||||
|
|
||||||
[pages.xray.fakedns]
|
[pages.xray.fakedns]
|
||||||
"add" = "افزودن دیاناس جعلی"
|
"add" = "افزودن دیاناس جعلی"
|
||||||
|
|||||||
@@ -423,6 +423,7 @@
|
|||||||
"add" = "Добавить сервер"
|
"add" = "Добавить сервер"
|
||||||
"edit" = "Редактировать сервер"
|
"edit" = "Редактировать сервер"
|
||||||
"domains" = "Домены"
|
"domains" = "Домены"
|
||||||
|
"expectIPs" = "Ожидаемые IP"
|
||||||
|
|
||||||
[pages.xray.fakedns]
|
[pages.xray.fakedns]
|
||||||
"add" = "Добавить поддельный DNS"
|
"add" = "Добавить поддельный DNS"
|
||||||
|
|||||||
@@ -423,6 +423,7 @@
|
|||||||
"add" = "Thêm máy chủ"
|
"add" = "Thêm máy chủ"
|
||||||
"edit" = "Chỉnh sửa máy chủ"
|
"edit" = "Chỉnh sửa máy chủ"
|
||||||
"domains" = "Tên miền"
|
"domains" = "Tên miền"
|
||||||
|
"expectIPs" = "Các IP Dự Kiến"
|
||||||
|
|
||||||
[pages.xray.fakedns]
|
[pages.xray.fakedns]
|
||||||
"add" = "Thêm DNS giả"
|
"add" = "Thêm DNS giả"
|
||||||
|
|||||||
@@ -423,6 +423,7 @@
|
|||||||
"add" = "添加服务器"
|
"add" = "添加服务器"
|
||||||
"edit" = "编辑服务器"
|
"edit" = "编辑服务器"
|
||||||
"domains" = "域"
|
"domains" = "域"
|
||||||
|
"expectIPs" = "预期 IP"
|
||||||
|
|
||||||
[pages.xray.fakedns]
|
[pages.xray.fakedns]
|
||||||
"add" = "添加假 DNS"
|
"add" = "添加假 DNS"
|
||||||
|
|||||||
Reference in New Issue
Block a user