dns.html 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. {{define "settings/xray/dns"}}
  2. <a-collapse default-active-key="1">
  3. <a-collapse-panel key="1" header='{{ i18n "pages.xray.generalConfigs"}}'>
  4. <a-setting-list-item paddings="small">
  5. <template #title>{{ i18n "pages.xray.dns.enable" }}</template>
  6. <template #description>{{ i18n "pages.xray.dns.enableDesc" }}</template>
  7. <template #control>
  8. <a-switch v-model="enableDNS"></a-switch>
  9. </template>
  10. </a-setting-list-item>
  11. <template v-if="enableDNS">
  12. <a-setting-list-item paddings="small">
  13. <template #title>{{ i18n "pages.xray.dns.tag" }}</template>
  14. <template #description>{{ i18n "pages.xray.dns.tagDesc" }}</template>
  15. <template #control>
  16. <a-input type="text" v-model="dnsTag"></a-input>
  17. </template>
  18. </a-setting-list-item>
  19. <a-setting-list-item paddings="small">
  20. <template #title>{{ i18n "pages.xray.dns.clientIp" }}</template>
  21. <template #description>{{ i18n "pages.xray.dns.clientIpDesc" }}</template>
  22. <template #control>
  23. <a-input type="text" v-model="dnsClientIp"></a-input>
  24. </template>
  25. </a-setting-list-item>
  26. <a-setting-list-item paddings="small">
  27. <template #title>{{ i18n "pages.xray.dns.strategy" }}</template>
  28. <template #description>{{ i18n "pages.xray.dns.strategyDesc" }}</template>
  29. <template #control>
  30. <a-select v-model="dnsStrategy" :style="{ width: '100%' }"
  31. :dropdown-class-name="themeSwitcher.currentTheme">
  32. <a-select-option :value="l" :label="l" v-for="l in ['UseIP', 'UseIPv4', 'UseIPv6']">
  33. <span>[[ l ]]</span>
  34. </a-select-option>
  35. </a-select>
  36. </template>
  37. </a-setting-list-item>
  38. <a-setting-list-item paddings="small">
  39. <template #title>{{ i18n "pages.xray.dns.disableCache" }}</template>
  40. <template #description>{{ i18n "pages.xray.dns.disableCacheDesc" }}</template>
  41. <template #control>
  42. <a-switch v-model="dnsDisableCache"></a-switch>
  43. </template>
  44. </a-setting-list-item>
  45. <a-setting-list-item paddings="small">
  46. <template #title>{{ i18n "pages.xray.dns.disableFallback" }}</template>
  47. <template #description>{{ i18n "pages.xray.dns.disableFallbackDesc" }}</template>
  48. <template #control>
  49. <a-switch v-model="dnsDisableFallback"></a-switch>
  50. </template>
  51. </a-setting-list-item>
  52. <a-setting-list-item paddings="small">
  53. <template #title>{{ i18n "pages.xray.dns.disableFallbackIfMatch" }}</template>
  54. <template #description>{{ i18n "pages.xray.dns.disableFallbackIfMatchDesc" }}</template>
  55. <template #control>
  56. <a-switch v-model="dnsDisableFallbackIfMatch"></a-switch>
  57. </template>
  58. </a-setting-list-item>
  59. </template>
  60. </a-collapse-panel>
  61. <template v-if="enableDNS">
  62. <a-collapse-panel key="2" header='DNS'>
  63. <template v-if="dnsServers.length > 0">
  64. <a-space direction="vertical" size="middle">
  65. <a-button type="primary" icon="plus" @click="addDNSServer()">
  66. <span>{{ i18n "pages.xray.dns.add" }}</span>
  67. </a-button>
  68. <a-table :columns="dnsColumns" bordered :row-key="r => r.key" :data-source="dnsServers"
  69. :scroll="isMobile ? {} : { x: 200 }" :pagination="false" :indent-size="0">
  70. <template slot="action" slot-scope="text,dns,index">
  71. <span>[[ index+1 ]]</span>
  72. <a-dropdown :trigger="['click']">
  73. <a-icon @click="e => e.preventDefault()" type="more"
  74. :style="{ fontSize: '16px', textDecoration: 'bold' }"></a-icon>
  75. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  76. <a-menu-item @click="editDNSServer(index)">
  77. <a-icon type="edit"></a-icon>
  78. <span>{{ i18n "edit" }}</span>
  79. </a-menu-item>
  80. <a-menu-item @click="deleteDNSServer(index)">
  81. <span :style="{ color: '#FF4D4F' }">
  82. <a-icon type="delete"></a-icon>
  83. <span>{{ i18n "delete"}}</span>
  84. </span>
  85. </a-menu-item>
  86. </a-menu>
  87. </a-dropdown>
  88. </template>
  89. <template slot="address" slot-scope="dns,index">
  90. <span v-if="typeof dns == 'object'">[[ dns.address ]]</span>
  91. <span v-else>[[ dns ]]</span>
  92. </template>
  93. <template slot="domain" slot-scope="dns,index">
  94. <span v-if="typeof dns == 'object'">[[ dns.domains.join(",") ]]</span>
  95. </template>
  96. <template slot="expectIPs" slot-scope="dns,index">
  97. <span v-if="typeof dns == 'object'">[[ dns.expectIPs.join(",") ]]</span>
  98. </template>
  99. </a-table>
  100. </a-space>
  101. </template>
  102. <template v-else>
  103. <a-empty description='{{ i18n "emptyDnsDesc" }}' :style="{ margin: '10px' }">
  104. <a-button type="primary" icon="plus" @click="addDNSServer()" :style="{ marginTop: '10px' }">
  105. <span>{{ i18n "pages.xray.dns.add" }}</span>
  106. </a-button>
  107. </a-empty>
  108. </template>
  109. </a-collapse-panel>
  110. <a-collapse-panel key="3" header='Fake DNS'>
  111. <template v-if="fakeDns && fakeDns.length > 0">
  112. <a-space direction="vertical" size="middle">
  113. <a-button type="primary" icon="plus" @click="addFakedns()">{{ i18n "pages.xray.fakedns.add"
  114. }}</a-button>
  115. <a-table :columns="fakednsColumns" bordered :row-key="r => r.key" :data-source="fakeDns"
  116. :scroll="isMobile ? {} : { x: 200 }" :pagination="false" :indent-size="0">
  117. <template slot="action" slot-scope="text,fakedns,index">
  118. <span>[[ index+1 ]]</span>
  119. <a-dropdown :trigger="['click']">
  120. <a-icon @click="e => e.preventDefault()" type="more"
  121. :style="{ fontSize: '16px', textDecoration: 'bold' }"></a-icon>
  122. <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
  123. <a-menu-item @click="editFakedns(index)">
  124. <a-icon type="edit"></a-icon>
  125. <span>{{ i18n "edit" }}</span>
  126. </a-menu-item>
  127. <a-menu-item @click="deleteFakedns(index)">
  128. <span :style="{ color: '#FF4D4F' }">
  129. <a-icon type="delete"></a-icon>
  130. <span>{{ i18n "delete"}}</span>
  131. </span>
  132. </a-menu-item>
  133. </a-menu>
  134. </a-dropdown>
  135. </template>
  136. </a-table>
  137. </a-space>
  138. </template>
  139. <template v-else>
  140. <a-empty description='{{ i18n "emptyFakeDnsDesc" }}' :style="{ margin: '20px' }">
  141. <a-button type="primary" icon="plus" @click="addFakedns()" :style="{ marginTop: '10px' }">
  142. <span>{{ i18n "pages.xray.fakedns.add" }}</span>
  143. </a-button>
  144. </a-empty>
  145. </template>
  146. </a-collapse-panel>
  147. </template>
  148. </a-collapse>
  149. {{end}}