outbound.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. {{define "form/outbound"}}
  2. <!-- base -->
  3. <a-tabs :active-key="outModal.activeKey" style="padding: 0; background-color: transparent;" @change="(activeKey) => {outModal.toggleJson(activeKey == '2'); }">
  4. <a-tab-pane key="1" tab="Form">
  5. <a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
  6. <a-form-item label='{{ i18n "protocol" }}'>
  7. <a-select v-model="outbound.protocol" :dropdown-class-name="themeSwitcher.currentTheme">
  8. <a-select-option v-for="x,y in Protocols" :value="x">[[ y ]]</a-select-option>
  9. </a-select>
  10. </a-form-item>
  11. <a-form-item label='{{ i18n "pages.xray.outbound.tag" }}' has-feedback :validate-status="outModal.duplicateTag? 'warning' : 'success'">
  12. <a-input v-model.trim="outbound.tag" @change="outModal.check()" placeholder='{{ i18n "pages.xray.outbound.tagDesc" }}'></a-input>
  13. </a-form-item>
  14. <!-- freedom settings-->
  15. <template v-if="outbound.protocol === Protocols.Freedom">
  16. <a-form-item label='Strategy'>
  17. <a-select
  18. v-model="outbound.settings.domainStrategy"
  19. :dropdown-class-name="themeSwitcher.currentTheme">
  20. <a-select-option v-for="s in OutboundDomainStrategies" :value="s">[[ s ]]</a-select-option>
  21. </a-select>
  22. </a-form-item>
  23. <a-form-item label='Fragment'>
  24. <a-switch
  25. :checked="Object.keys(outbound.settings.fragment).length >0"
  26. @change="checked => outbound.settings.fragment = checked ? new Outbound.FreedomSettings.Fragment() : {}">
  27. </a-switch>
  28. </a-form-item>
  29. <template v-if="Object.keys(outbound.settings.fragment).length >0">
  30. <a-form-item label='Packets'>
  31. <a-select
  32. v-model="outbound.settings.fragment.packets"
  33. :dropdown-class-name="themeSwitcher.currentTheme">
  34. <a-select-option v-for="s in ['1-3','tlshello']" :value="s">[[ s ]]</a-select-option>
  35. </a-select>
  36. </a-form-item>
  37. <a-form-item label='Length'>
  38. <a-input v-model.trim="outbound.settings.fragment.length"></a-input>
  39. </a-form-item>
  40. <a-form-item label='Interval'>
  41. <a-input v-model.trim="outbound.settings.fragment.interval"></a-input>
  42. </a-form-item>
  43. </template>
  44. </template>
  45. <!-- blackhole settings -->
  46. <template v-if="outbound.protocol === Protocols.Blackhole">
  47. <a-form-item label='Response Type'>
  48. <a-select
  49. v-model="outbound.settings.type"
  50. :dropdown-class-name="themeSwitcher.currentTheme">
  51. <a-select-option v-for="s in ['', 'none','http']" :value="s">[[ s ]]</a-select-option>
  52. </a-select>
  53. </a-form-item>
  54. </template>
  55. <!-- dns settings -->
  56. <template v-if="outbound.protocol === Protocols.DNS">
  57. <a-form-item label='{{ i18n "pages.inbounds.network" }}'>
  58. <a-select
  59. v-model="outbound.settings.network"
  60. :dropdown-class-name="themeSwitcher.currentTheme">
  61. <a-select-option v-for="s in ['udp','tcp']" :value="s">[[ s ]]</a-select-option>
  62. </a-select>
  63. </a-form-item>
  64. </template>
  65. <!-- wireguard settings -->
  66. <template v-if="outbound.protocol === Protocols.Wireguard">
  67. <a-form-item>
  68. <template slot="label">
  69. <a-tooltip>
  70. <template slot="title">
  71. <span>{{ i18n "pages.xray.rules.useComma" }}</span>
  72. </template>
  73. {{ i18n "pages.xray.outbound.address" }} <a-icon type="question-circle"></a-icon>
  74. </a-tooltip>
  75. </template>
  76. <a-input v-model.trim="outbound.settings.address"></a-input>
  77. </a-form-item>
  78. <a-form-item>
  79. <template slot="label">
  80. <a-tooltip>
  81. <template slot="title">
  82. <span>{{ i18n "reset" }}</span>
  83. </template>
  84. {{ i18n "pages.xray.wireguard.secretKey" }}
  85. <a-icon type="sync"
  86. @click="[outbound.settings.pubKey, outbound.settings.secretKey] = Object.values(Wireguard.generateKeypair())">
  87. </a-icon>
  88. </a-tooltip>
  89. </template>
  90. <a-input v-model.trim="outbound.settings.secretKey"></a-input>
  91. </a-form-item>
  92. <a-form-item label='{{ i18n "pages.xray.wireguard.publicKey" }}'>
  93. <a-input disabled v-model="outbound.settings.pubKey"></a-input>
  94. </a-form-item>
  95. <a-form-item label='{{ i18n "pages.xray.wireguard.domainStrategy" }}'>
  96. <a-select v-model="outbound.settings.domainStrategy" :dropdown-class-name="themeSwitcher.currentTheme">
  97. <a-select-option v-for="wds in ['', ...WireguardDomainStrategy]" :value="wds">[[ wds ]]</a-select-option>
  98. </a-select>
  99. </a-form-item>
  100. <a-form-item label='MTU'>
  101. <a-input-number v-model.number="outbound.settings.mtu"></a-input-number>
  102. </a-form-item>
  103. <a-form-item label='Workers'>
  104. <a-input-number min="0" v-model.number="outbound.settings.workers"></a-input>
  105. </a-form-item>
  106. <a-form-item label='Kernel Mode'>
  107. <a-switch v-model="outbound.settings.kernelMode"></a-switch>
  108. </a-form-item>
  109. <a-form-item>
  110. <template slot="label">
  111. <a-tooltip>
  112. <template slot="title">
  113. <span>{{ i18n "pages.xray.rules.useComma" }}</span>
  114. </template>
  115. Reserved <a-icon type="question-circle"></a-icon>
  116. </a-tooltip>
  117. </template>
  118. <a-input v-model="outbound.settings.reserved"></a-input>
  119. </a-form-item>
  120. <a-form-item label="Peers">
  121. <a-button type="primary" size="small" @click="outbound.settings.addPeer()">+</a-button>
  122. </a-form-item>
  123. <a-form v-for="(peer, index) in outbound.settings.peers" :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
  124. <a-divider style="margin:0;">
  125. Peer [[ index + 1 ]]
  126. <a-icon v-if="outbound.settings.peers.length>1" type="delete" @click="() => outbound.settings.delPeer(index)"
  127. style="color: rgb(255, 77, 79);cursor: pointer;"/>
  128. </a-divider>
  129. <a-form-item label='{{ i18n "pages.xray.wireguard.endpoint" }}'>
  130. <a-input v-model.trim="peer.endpoint"></a-input>
  131. </a-form-item>
  132. <a-form-item>
  133. <template slot="label">
  134. <a-tooltip>
  135. <template slot="title">
  136. <span>{{ i18n "reset" }}</span>
  137. </template>
  138. {{ i18n "pages.xray.wireguard.publicKey" }}
  139. <a-icon @click="peer.publicKey = publicKey=Wireguard.generateKeypair().publicKey"type="sync"> </a-icon>
  140. </a-tooltip>
  141. </template>
  142. <a-input v-model.trim="peer.publicKey"></a-input>
  143. </a-form-item>
  144. <a-form-item>
  145. <template slot="label">
  146. <a-tooltip>
  147. <template slot="title">
  148. <span>{{ i18n "reset" }}</span>
  149. </template>
  150. {{ i18n "pages.xray.wireguard.psk" }}
  151. <a-icon @click="peer.psk = publicKey=Wireguard.generateKeypair().publicKey"type="sync"> </a-icon>
  152. </a-tooltip>
  153. </template>
  154. <a-input v-model.trim="peer.psk"></a-input>
  155. </a-form-item>
  156. <a-form-item>
  157. <template slot="label">
  158. {{ i18n "pages.xray.wireguard.allowedIPs" }} <a-button type="primary" size="small" @click="peer.allowedIPs.push('')">+</a-button>
  159. </template>
  160. <template v-for="(aip, index) in peer.allowedIPs" style="margin-bottom: 10px;">
  161. <a-input v-model.trim="peer.allowedIPs[index]">
  162. <a-button v-if="peer.allowedIPs.length>1" slot="addonAfter" size="small" @click="peer.allowedIPs.splice(index, 1)">-</a-button>
  163. </a-input>
  164. </template>
  165. </a-form-item>
  166. <a-form-item label='Keep Alive'>
  167. <a-input-number v-model.number="peer.keepAlive" :min="0"></a-input>
  168. </a-form-item>
  169. </a-form>
  170. </template>
  171. <!-- Address + Port -->
  172. <template v-if="outbound.hasAddressPort()">
  173. <a-form-item label='{{ i18n "pages.inbounds.address" }}'>
  174. <a-input v-model.trim="outbound.settings.address"></a-input>
  175. </a-form-item>
  176. <a-form-item label='{{ i18n "pages.inbounds.port" }}'>
  177. <a-input-number v-model.number="outbound.settings.port" :min="1" :max="65532"></a-input-number>
  178. </a-form-item>
  179. </template>
  180. <!-- Vnext (vless/vmess) settings -->
  181. <template v-if="[Protocols.VMess, Protocols.VLESS].includes(outbound.protocol)">
  182. <a-form-item label='ID'>
  183. <a-input v-model.trim="outbound.settings.id"></a-input>
  184. </a-form-item>
  185. <!-- vless settings -->
  186. <template v-if="outbound.canEnableTlsFlow()">
  187. <a-form-item label='Flow'>
  188. <a-select v-model="outbound.settings.flow" :dropdown-class-name="themeSwitcher.currentTheme">
  189. <a-select-option value="" selected>{{ i18n "none" }}</a-select-option>
  190. <a-select-option v-for="key in TLS_FLOW_CONTROL" :value="key">[[ key ]]</a-select-option>
  191. </a-select>
  192. </a-form-item>
  193. </template>
  194. </template>
  195. <!-- Servers (trojan/shadowsocks/socks/http) settings -->
  196. <template v-if="outbound.hasServers()">
  197. <!-- http / socks -->
  198. <template v-if="outbound.hasUsername()">
  199. <a-form-item label='{{ i18n "username" }}'>
  200. <a-input v-model.trim="outbound.settings.user"></a-input>
  201. </a-form-item>
  202. <a-form-item label='{{ i18n "password" }}'>
  203. <a-input v-model.trim="outbound.settings.pass"></a-input>
  204. </a-form-item>
  205. </template>
  206. <!-- trojan/shadowsocks -->
  207. <template v-if="[Protocols.Trojan, Protocols.Shadowsocks].includes(outbound.protocol)">
  208. <a-form-item label='{{ i18n "password" }}'>
  209. <a-input v-model.trim="outbound.settings.password"></a-input>
  210. </a-form-item>
  211. </template>
  212. <!-- shadowsocks -->
  213. <template v-if="outbound.protocol === Protocols.Shadowsocks">
  214. <a-form-item label='{{ i18n "encryption" }}'>
  215. <a-select v-model="outbound.settings.method" :dropdown-class-name="themeSwitcher.currentTheme">
  216. <a-select-option v-for="(method, method_name) in SSMethods" :value="method">[[ method_name ]]</a-select-option>
  217. </a-select>
  218. </a-form-item>
  219. <a-form-item label='UDP over TCP'>
  220. <a-switch v-model="outbound.settings.uot"></a-switch>
  221. </a-form-item>
  222. </template>
  223. </template>
  224. <!-- stream settings -->
  225. <template v-if="outbound.canEnableStream()">
  226. <a-form-item label='{{ i18n "transmission" }}'>
  227. <a-select v-model="outbound.stream.network" @change="streamNetworkChange"
  228. :dropdown-class-name="themeSwitcher.currentTheme">
  229. <a-select-option value="tcp">TCP</a-select-option>
  230. <a-select-option value="kcp">mKCP</a-select-option>
  231. <a-select-option value="ws">WS</a-select-option>
  232. <a-select-option value="http">H2</a-select-option>
  233. <a-select-option value="quic">QUIC</a-select-option>
  234. <a-select-option value="grpc">gRPC</a-select-option>
  235. </a-select>
  236. </a-form-item>
  237. <template v-if="outbound.stream.network === 'tcp'">
  238. <a-form-item label='HTTP {{ i18n "camouflage" }}'>
  239. <a-switch
  240. :checked="outbound.stream.tcp.type === 'http'"
  241. @change="checked => outbound.stream.tcp.type = checked ? 'http' : 'none'">
  242. </a-switch>
  243. </a-form-item>
  244. <template v-if="outbound.stream.tcp.type == 'http'">
  245. <a-form-item label='{{ i18n "host" }}'>
  246. <a-input v-model.trim="outbound.stream.tcp.host"></a-input>
  247. </a-form-item>
  248. <a-form-item label='{{ i18n "path" }}'>
  249. <a-input v-model.trim="outbound.stream.tcp.path"></a-input>
  250. </a-form-item>
  251. </template>
  252. </template>
  253. <!-- kcp -->
  254. <template v-if="outbound.stream.network === 'kcp'">
  255. <a-form-item label='{{ i18n "camouflage" }}'>
  256. <a-select v-model="outbound.stream.kcp.type" :dropdown-class-name="themeSwitcher.currentTheme">
  257. <a-select-option value="none">None</a-select-option>
  258. <a-select-option value="srtp">SRTP</a-select-option>
  259. <a-select-option value="utp">uTP</a-select-option>
  260. <a-select-option value="wechat-video">WeChat</a-select-option>
  261. <a-select-option value="dtls">DTLS 1.2</a-select-option>
  262. <a-select-option value="wireguard">WireGuard</a-select-option>
  263. </a-select>
  264. </a-form-item>
  265. <a-form-item label='{{ i18n "password" }}'>
  266. <a-input v-model="outbound.stream.kcp.seed"></a-input>
  267. </a-form-item>
  268. <a-form-item label='MTU'>
  269. <a-input-number v-model.number="outbound.stream.kcp.mtu"></a-input-number>
  270. </a-form-item>
  271. <a-form-item label='TTI (ms)'>
  272. <a-input-number v-model.number="outbound.stream.kcp.tti"></a-input-number>
  273. </a-form-item>
  274. <a-form-item label='Uplink (MB/s)'>
  275. <a-input-number v-model.number="outbound.stream.kcp.upCap"></a-input-number>
  276. </a-form-item>
  277. <a-form-item label='Downlink (MB/s)'>
  278. <a-input-number v-model.number="outbound.stream.kcp.downCap"></a-input-number>
  279. </a-form-item>
  280. <a-form-item label='Congestion'>
  281. <a-switch v-model="outbound.stream.kcp.congestion"></a-switch>
  282. </a-form-item>
  283. <a-form-item label='Read Buffer (MB)'>
  284. <a-input-number v-model.number="outbound.stream.kcp.readBuffer"></a-input-number>
  285. </a-form-item>
  286. <a-form-item label='Write Buffer (MB)'>
  287. <a-input-number v-model.number="outbound.stream.kcp.writeBuffer"></a-input-number>
  288. </a-form-item>
  289. </template>
  290. <!-- ws -->
  291. <template v-if="outbound.stream.network === 'ws'">
  292. <a-form-item label='{{ i18n "host" }}'>
  293. <a-input v-model="outbound.stream.ws.host"></a-input>
  294. </a-form-item>
  295. <a-form-item label='{{ i18n "path" }}'>
  296. <a-form-item><a-input v-model.trim="outbound.stream.ws.path"></a-input>
  297. </a-form-item>
  298. </template>
  299. <!-- http -->
  300. <template v-if="outbound.stream.network === 'http'">
  301. <a-form-item label='{{ i18n "host" }}'>
  302. <a-input v-model.trim="outbound.stream.http.host"></a-input>
  303. </a-form-item>
  304. <a-form-item label='{{ i18n "path" }}'>
  305. <a-input v-model.trim="outbound.stream.http.path"></a-input>
  306. </a-form-item>
  307. </template>
  308. <!-- quic -->
  309. <template v-if="outbound.stream.network === 'quic'">
  310. <a-form-item label='{{ i18n "pages.inbounds.stream.quic.encryption" }}'>
  311. <a-select v-model="outbound.stream.quic.security" :dropdown-class-name="themeSwitcher.currentTheme">
  312. <a-select-option value="none">None</a-select-option>
  313. <a-select-option value="aes-128-gcm">AES-128-GCM</a-select-option>
  314. <a-select-option value="chacha20-poly1305">CHACHA20-POLY1305</a-select-option>
  315. </a-select>
  316. </a-form-item>
  317. <a-form-item label='{{ i18n "password" }}'>
  318. <a-input v-model.trim="outbound.stream.quic.key"></a-input>
  319. </a-form-item>
  320. <a-form-item label='{{ i18n "camouflage" }}'>
  321. <a-select v-model="outbound.stream.quic.type" :dropdown-class-name="themeSwitcher.currentTheme">
  322. <a-select-option value="none">None</a-select-option>
  323. <a-select-option value="srtp">SRTP</a-select-option>
  324. <a-select-option value="utp">uTP</a-select-option>
  325. <a-select-option value="wechat-video">WeChat</a-select-option>
  326. <a-select-option value="dtls">DTLS 1.2</a-select-option>
  327. <a-select-option value="wireguard">WireGuard</a-select-option>
  328. </a-select>
  329. </a-form-item>
  330. </template>
  331. <!-- grpc -->
  332. <template v-if="outbound.stream.network === 'grpc'">
  333. <a-form-item label='Service Name'>
  334. <a-input v-model.trim="outbound.stream.grpc.serviceName"></a-input>
  335. </a-form-item>
  336. <a-form-item label='Multi Mode'>
  337. <a-switch v-model="outbound.stream.grpc.multiMode"></a-switch>
  338. </a-form-item>
  339. </template>
  340. </template>
  341. <!-- tls settings -->
  342. <template v-if="outbound.canEnableTls()">
  343. <a-form-item label='{{ i18n "security" }}'>
  344. <a-radio-group v-model="outbound.stream.security" button-style="solid">
  345. <a-radio-button value="none">{{ i18n "none" }}</a-radio-button>
  346. <a-radio-button value="tls">TLS</a-radio-button>
  347. <a-radio-button v-if="outbound.canEnableReality()" value="reality">REALITY</a-radio-button>
  348. </a-radio-group>
  349. </a-form-item>
  350. <template v-if="outbound.stream.isTls">
  351. <a-form-item label="SNI" placeholder="Server Name Indication">
  352. <a-input v-model.trim="outbound.stream.tls.serverName"></a-input>
  353. </a-form-item>
  354. <a-form-item label="uTLS">
  355. <a-select v-model="outbound.stream.tls.fingerprint" :dropdown-class-name="themeSwitcher.currentTheme">
  356. <a-select-option value=''>None</a-select-option>
  357. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  358. </a-select>
  359. </a-form-item>
  360. <a-form-item label="ALPN">
  361. <a-select mode="multiple" :dropdown-class-name="themeSwitcher.currentTheme"
  362. v-model="outbound.stream.tls.alpn">
  363. <a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option>
  364. </a-select>
  365. </a-form-item>
  366. <a-form-item label="Allow Insecure">
  367. <a-switch v-model="outbound.stream.tls.allowInsecure"></a-switch>
  368. </a-form-item>
  369. </template>
  370. <!-- reality settings -->
  371. <template v-if="outbound.stream.isReality">
  372. <a-form-item label="SNI">
  373. <a-input v-model.trim="outbound.stream.reality.serverName"></a-input>
  374. </a-form-item>
  375. <a-form-item label="uTLS">
  376. <a-select v-model="outbound.stream.reality.fingerprint" :dropdown-class-name="themeSwitcher.currentTheme">
  377. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  378. </a-select>
  379. </a-form-item>
  380. <a-form-item label="Short ID">
  381. <a-input v-model.trim="outbound.stream.reality.shortId" style="width:250px"></a-input>
  382. </a-form-item>
  383. <a-form-item label="SpiderX">
  384. <a-input v-model.trim="outbound.stream.reality.spiderX" style="width:250px"></a-input>
  385. </a-form-item>
  386. <a-form-item label="Public Key">
  387. <a-input v-model.trim="outbound.stream.reality.publicKey"></a-input>
  388. </a-form-item>
  389. </template>
  390. </template>
  391. </a-form>
  392. </a-tab-pane>
  393. <a-tab-pane key="2" tab="JSON" force-render="true">
  394. <a-form-item style="margin: 10px 0">
  395. Link: <a-input v-model.trim="outModal.link" style="width: 300px; margin-right: 5px;" placeholder="vmess:// vless:// trojan:// ss://"></a-input>
  396. <a-button @click="convertLink" type="primary"><a-icon type="form"></a-icon></a-button>
  397. </a-form-item>
  398. <textarea style="position:absolute; left: -800px;" id="outboundJson"></textarea>
  399. </a-tab-pane>
  400. </a-tabs>
  401. {{end}}