stream_finalmask.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. {{define "form/streamFinalMask"}}
  2. <a-form
  3. :colon="false"
  4. :label-col="{ md: {span:8} }"
  5. :wrapper-col="{ md: {span:14} }"
  6. v-if="inbound.protocol == Protocols.HYSTERIA || inbound.stream.network == 'kcp'"
  7. >
  8. <a-divider :style="{ margin: '5px 0 0' }"></a-divider>
  9. <a-form-item label="UDP Masks">
  10. <a-button
  11. icon="plus"
  12. type="primary"
  13. size="small"
  14. @click="inbound.stream.addUdpMask(inbound.protocol === Protocols.HYSTERIA ? 'salamander' : 'mkcp-aes128gcm')"
  15. ></a-button>
  16. </a-form-item>
  17. <template
  18. v-if="inbound.stream.finalmask.udp && inbound.stream.finalmask.udp.length > 0"
  19. >
  20. <a-form
  21. v-for="(mask, index) in inbound.stream.finalmask.udp"
  22. :key="index"
  23. :colon="false"
  24. :label-col="{ md: {span:8} }"
  25. :wrapper-col="{ md: {span:14} }"
  26. >
  27. <a-divider :style="{ margin: '0' }">
  28. UDP Mask [[ index + 1 ]]
  29. <a-icon
  30. type="delete"
  31. @click="() => inbound.stream.delUdpMask(index)"
  32. :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }"
  33. ></a-icon>
  34. </a-divider>
  35. <a-form-item label='{{ i18n "pages.xray.outbound.type" }}'>
  36. <a-select
  37. v-model="mask.type"
  38. @change="(type) => { mask.settings = mask._getDefaultSettings(type, {}); if(inbound.stream.network === 'kcp') { inbound.stream.kcp.mtu = type === 'xdns' ? 900 : 1350; } }"
  39. :dropdown-class-name="themeSwitcher.currentTheme"
  40. >
  41. <template v-if="inbound.protocol === Protocols.HYSTERIA">
  42. <a-select-option value="salamander"
  43. >Salamander (Hysteria2)</a-select-option
  44. >
  45. </template>
  46. <template v-else>
  47. <a-select-option value="mkcp-aes128gcm"
  48. >mKCP AES-128-GCM</a-select-option
  49. >
  50. <a-select-option value="header-dns">Header DNS</a-select-option>
  51. <a-select-option value="header-dtls"
  52. >Header DTLS 1.2</a-select-option
  53. >
  54. <a-select-option value="header-srtp">Header SRTP</a-select-option>
  55. <a-select-option value="header-utp">Header uTP</a-select-option>
  56. <a-select-option value="header-wechat"
  57. >Header WeChat Video</a-select-option
  58. >
  59. <a-select-option value="header-wireguard"
  60. >Header WireGuard</a-select-option
  61. >
  62. <a-select-option value="mkcp-original"
  63. >mKCP Original</a-select-option
  64. >
  65. <a-select-option value="xdns">xDNS</a-select-option>
  66. <a-select-option value="xicmp">xICMP</a-select-option>
  67. <a-select-option value="header-custom"
  68. >Header Custom</a-select-option
  69. >
  70. <a-select-option value="noise">Noise</a-select-option>
  71. <a-select-option value="sudoku">Sudoku</a-select-option>
  72. </template>
  73. </a-select>
  74. </a-form-item>
  75. <a-form-item
  76. label="Password"
  77. v-if="['mkcp-aes128gcm', 'salamander', 'sudoku'].includes(mask.type)"
  78. >
  79. <a-input
  80. v-model.trim="mask.settings.password"
  81. placeholder="Obfuscation password"
  82. ></a-input>
  83. </a-form-item>
  84. <a-form-item label="Domain" v-if="mask.type === 'header-dns'">
  85. <a-input
  86. v-model.trim="mask.settings.domain"
  87. placeholder="e.g., www.example.com"
  88. ></a-input>
  89. </a-form-item>
  90. <template v-if="mask.type === 'xdns'">
  91. <a-form-item label="Domains">
  92. <a-select
  93. mode="tags"
  94. v-model="mask.settings.domains"
  95. :style="{ width: '100%' }"
  96. :token-separators="[',']"
  97. placeholder="e.g., www.example.com"
  98. ></a-select>
  99. </a-form-item>
  100. </template>
  101. <template v-if="mask.type === 'header-custom'">
  102. <a-form-item label="Client">
  103. <a-icon
  104. type="plus"
  105. type="primary"
  106. size="small"
  107. @click="mask.settings.client.push({rand: 0, randRange: '0-255', type: 'array', packet: []})"
  108. />
  109. </a-form-item>
  110. <template v-for="(c, index) in mask.settings.client" :key="index">
  111. <a-divider :style="{ margin: '0' }">
  112. Client [[ index + 1 ]]
  113. <a-icon
  114. type="delete"
  115. @click="() => mask.settings.client.splice(index, 1)"
  116. :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }"
  117. ></a-icon>
  118. </a-divider>
  119. <a-form-item label="Rand">
  120. <a-input-number v-model.number="c.rand" />
  121. </a-form-item>
  122. <a-form-item label="Rand Range">
  123. <a-input v-model.trim="c.randRange" placeholder="0-255" />
  124. </a-form-item>
  125. <a-form-item label='{{ i18n "pages.xray.outbound.type" }}'>
  126. <a-select
  127. v-model="c.type"
  128. :dropdown-class-name="themeSwitcher.currentTheme"
  129. >
  130. <a-select-option value="array">Array</a-select-option>
  131. <a-select-option value="str">String</a-select-option>
  132. <a-select-option value="hex">Hex</a-select-option>
  133. <a-select-option value="base64">Base64</a-select-option>
  134. </a-select>
  135. </a-form-item>
  136. <a-form-item label="Packet">
  137. <a-input v-model.trim="c.packet" placeholder="binary data" />
  138. </a-form-item>
  139. </template>
  140. <a-divider :style="{ margin: '0' }"></a-divider>
  141. <a-form-item label="Server">
  142. <a-icon
  143. type="plus"
  144. type="primary"
  145. size="small"
  146. @click="mask.settings.server.push({rand: 0, randRange: '0-255', type: 'array', packet: []})"
  147. />
  148. </a-form-item>
  149. <template v-for="(s, index) in mask.settings.server" :key="index">
  150. <a-divider :style="{ margin: '0' }">
  151. Server [[ index + 1 ]]
  152. <a-icon
  153. type="delete"
  154. @click="() => mask.settings.server.splice(index, 1)"
  155. :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }"
  156. ></a-icon>
  157. </a-divider>
  158. <a-form-item label="Rand">
  159. <a-input-number v-model.number="s.rand" />
  160. </a-form-item>
  161. <a-form-item label="Rand Range">
  162. <a-input v-model.trim="s.randRange" placeholder="0-255" />
  163. </a-form-item>
  164. <a-form-item label='{{ i18n "pages.xray.outbound.type" }}'>
  165. <a-select
  166. v-model="s.type"
  167. :dropdown-class-name="themeSwitcher.currentTheme"
  168. >
  169. <a-select-option value="array">Array</a-select-option>
  170. <a-select-option value="str">String</a-select-option>
  171. <a-select-option value="hex">Hex</a-select-option>
  172. <a-select-option value="base64">Base64</a-select-option>
  173. </a-select>
  174. </a-form-item>
  175. <a-form-item label="Packet">
  176. <a-input v-model.trim="s.packet" placeholder="binary data" />
  177. </a-form-item>
  178. </template>
  179. </template>
  180. <template v-if="mask.type === 'noise'">
  181. <a-form-item label="Reset">
  182. <a-input-number v-model.number="mask.settings.reset" :min="0" />
  183. </a-form-item>
  184. <a-form-item label="Noise">
  185. <a-icon
  186. type="plus"
  187. type="primary"
  188. size="small"
  189. @click="mask.settings.noise.push({rand: '1-8192', randRange: '0-255', type: 'array', packet: '', delay: ''})"
  190. />
  191. </a-form-item>
  192. <template v-for="(n, index) in mask.settings.noise" :key="index">
  193. <a-divider :style="{ margin: '0' }">
  194. Noise [[ index + 1 ]]
  195. <a-icon
  196. type="delete"
  197. @click="() => mask.settings.noise.splice(index, 1)"
  198. :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer' }"
  199. ></a-icon>
  200. </a-divider>
  201. <a-form-item label="Rand">
  202. <a-input v-model.trim="n.rand" placeholder="1-8192" />
  203. </a-form-item>
  204. <a-form-item label="Rand Range">
  205. <a-input v-model.trim="n.randRange" placeholder="0-255" />
  206. </a-form-item>
  207. <a-form-item label='{{ i18n "pages.xray.outbound.type" }}'>
  208. <a-select
  209. v-model="n.type"
  210. :dropdown-class-name="themeSwitcher.currentTheme"
  211. >
  212. <a-select-option value="array">Array</a-select-option>
  213. <a-select-option value="str">String</a-select-option>
  214. <a-select-option value="hex">Hex</a-select-option>
  215. <a-select-option value="base64">Base64</a-select-option>
  216. </a-select>
  217. </a-form-item>
  218. <a-form-item label="Packet">
  219. <a-input v-model.trim="n.packet" placeholder="binary data" />
  220. </a-form-item>
  221. <a-form-item label="Delay">
  222. <a-input v-model.trim="n.delay" placeholder="10-20" />
  223. </a-form-item>
  224. </template>
  225. </template>
  226. <template v-if="mask.type === 'sudoku'">
  227. <a-form-item label="ASCII">
  228. <a-input v-model.trim="mask.settings.ascii" placeholder="ASCII" />
  229. </a-form-item>
  230. <a-form-item label="Custom Table">
  231. <a-input
  232. v-model.trim="mask.settings.customTable"
  233. placeholder="Custom Table"
  234. />
  235. </a-form-item>
  236. <a-form-item label="Custom Tables">
  237. <a-input
  238. v-model.trim="mask.settings.customTables"
  239. placeholder="Custom Tables"
  240. />
  241. </a-form-item>
  242. <a-form-item label="Padding Min">
  243. <a-input-number v-model.number="mask.settings.paddingMin" :min="0" />
  244. </a-form-item>
  245. <a-form-item label="Padding Max">
  246. <a-input-number v-model.number="mask.settings.paddingMax" :min="0" />
  247. </a-form-item>
  248. </template>
  249. <template v-if="mask.type === 'xicmp'">
  250. <a-form-item label="IP">
  251. <a-input v-model.trim="mask.settings.ip" placeholder="0.0.0.0" />
  252. </a-form-item>
  253. <a-form-item label="ID">
  254. <a-input-number v-model.number="mask.settings.id" :min="0" />
  255. </a-form-item>
  256. </template>
  257. </a-form>
  258. </template>
  259. </a-form>
  260. {{end}}