outbound.html 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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 label='{{ i18n "pages.xray.wireguard.publicKey" }}'>
  133. <a-input v-model.trim="peer.publicKey"></a-input>
  134. </a-form-item>
  135. <a-form-item label='{{ i18n "pages.xray.wireguard.psk" }}'>
  136. <a-input v-model.trim="peer.psk"></a-input>
  137. </a-form-item>
  138. <a-form-item>
  139. <template slot="label">
  140. {{ i18n "pages.xray.wireguard.allowedIPs" }} <a-button type="primary" size="small" @click="peer.allowedIPs.push('')">+</a-button>
  141. </template>
  142. <template v-for="(aip, index) in peer.allowedIPs" style="margin-bottom: 10px;">
  143. <a-input v-model.trim="peer.allowedIPs[index]">
  144. <a-button v-if="peer.allowedIPs.length>1" slot="addonAfter" size="small" @click="peer.allowedIPs.splice(index, 1)">-</a-button>
  145. </a-input>
  146. </template>
  147. </a-form-item>
  148. <a-form-item label='Keep Alive'>
  149. <a-input-number v-model.number="peer.keepAlive" :min="0"></a-input>
  150. </a-form-item>
  151. </a-form>
  152. </template>
  153. <!-- Address + Port -->
  154. <template v-if="outbound.hasAddressPort()">
  155. <a-form-item label='{{ i18n "pages.inbounds.address" }}'>
  156. <a-input v-model.trim="outbound.settings.address"></a-input>
  157. </a-form-item>
  158. <a-form-item label='{{ i18n "pages.inbounds.port" }}'>
  159. <a-input-number v-model.number="outbound.settings.port" :min="1" :max="65532"></a-input-number>
  160. </a-form-item>
  161. </template>
  162. <!-- Vnext (vless/vmess) settings -->
  163. <template v-if="[Protocols.VMess, Protocols.VLESS].includes(outbound.protocol)">
  164. <a-form-item label='ID'>
  165. <a-input v-model.trim="outbound.settings.id"></a-input>
  166. </a-form-item>
  167. <!-- vless settings -->
  168. <template v-if="outbound.canEnableTlsFlow()">
  169. <a-form-item label='Flow'>
  170. <a-select v-model="outbound.settings.flow" :dropdown-class-name="themeSwitcher.currentTheme">
  171. <a-select-option value="" selected>{{ i18n "none" }}</a-select-option>
  172. <a-select-option v-for="key in TLS_FLOW_CONTROL" :value="key">[[ key ]]</a-select-option>
  173. </a-select>
  174. </a-form-item>
  175. </template>
  176. </template>
  177. <!-- Servers (trojan/shadowsocks/socks/http) settings -->
  178. <template v-if="outbound.hasServers()">
  179. <!-- http / socks -->
  180. <template v-if="outbound.hasUsername()">
  181. <a-form-item label='{{ i18n "username" }}'>
  182. <a-input v-model.trim="outbound.settings.user"></a-input>
  183. </a-form-item>
  184. <a-form-item label='{{ i18n "password" }}'>
  185. <a-input v-model.trim="outbound.settings.pass"></a-input>
  186. </a-form-item>
  187. </template>
  188. <!-- trojan/shadowsocks -->
  189. <template v-if="[Protocols.Trojan, Protocols.Shadowsocks].includes(outbound.protocol)">
  190. <a-form-item label='{{ i18n "password" }}'>
  191. <a-input v-model.trim="outbound.settings.password"></a-input>
  192. </a-form-item>
  193. </template>
  194. <!-- shadowsocks -->
  195. <template v-if="outbound.protocol === Protocols.Shadowsocks">
  196. <a-form-item label='{{ i18n "encryption" }}'>
  197. <a-select v-model="outbound.settings.method" :dropdown-class-name="themeSwitcher.currentTheme">
  198. <a-select-option v-for="(method, method_name) in SSMethods" :value="method">[[ method_name ]]</a-select-option>
  199. </a-select>
  200. </a-form-item>
  201. <a-form-item label='UDP over TCP'>
  202. <a-switch v-model="outbound.settings.uot"></a-switch>
  203. </a-form-item>
  204. </template>
  205. </template>
  206. <!-- stream settings -->
  207. <template v-if="outbound.canEnableStream()">
  208. <a-form-item label='{{ i18n "transmission" }}'>
  209. <a-select v-model="outbound.stream.network" @change="streamNetworkChange"
  210. :dropdown-class-name="themeSwitcher.currentTheme">
  211. <a-select-option value="tcp">TCP</a-select-option>
  212. <a-select-option value="kcp">mKCP</a-select-option>
  213. <a-select-option value="ws">WS</a-select-option>
  214. <a-select-option value="http">H2</a-select-option>
  215. <a-select-option value="quic">QUIC</a-select-option>
  216. <a-select-option value="grpc">gRPC</a-select-option>
  217. </a-select>
  218. </a-form-item>
  219. <template v-if="outbound.stream.network === 'tcp'">
  220. <a-form-item label='HTTP {{ i18n "camouflage" }}'>
  221. <a-switch
  222. :checked="outbound.stream.tcp.type === 'http'"
  223. @change="checked => outbound.stream.tcp.type = checked ? 'http' : 'none'">
  224. </a-switch>
  225. </a-form-item>
  226. <template v-if="outbound.stream.tcp.type == 'http'">
  227. <a-form-item label='{{ i18n "host" }}'>
  228. <a-input v-model.trim="outbound.stream.tcp.host"></a-input>
  229. </a-form-item>
  230. <a-form-item label='{{ i18n "path" }}'>
  231. <a-input v-model.trim="outbound.stream.tcp.path"></a-input>
  232. </a-form-item>
  233. </template>
  234. </template>
  235. <!-- kcp -->
  236. <template v-if="outbound.stream.network === 'kcp'">
  237. <a-form-item label='{{ i18n "camouflage" }}'>
  238. <a-select v-model="outbound.stream.kcp.type" :dropdown-class-name="themeSwitcher.currentTheme">
  239. <a-select-option value="none">None</a-select-option>
  240. <a-select-option value="srtp">SRTP</a-select-option>
  241. <a-select-option value="utp">uTP</a-select-option>
  242. <a-select-option value="wechat-video">WeChat</a-select-option>
  243. <a-select-option value="dtls">DTLS 1.2</a-select-option>
  244. <a-select-option value="wireguard">WireGuard</a-select-option>
  245. </a-select>
  246. </a-form-item>
  247. <a-form-item label='{{ i18n "password" }}'>
  248. <a-input v-model="outbound.stream.kcp.seed"></a-input>
  249. </a-form-item>
  250. <a-form-item label='MTU'>
  251. <a-input-number v-model.number="outbound.stream.kcp.mtu"></a-input-number>
  252. </a-form-item>
  253. <a-form-item label='TTI (ms)'>
  254. <a-input-number v-model.number="outbound.stream.kcp.tti"></a-input-number>
  255. </a-form-item>
  256. <a-form-item label='Uplink (MB/s)'>
  257. <a-input-number v-model.number="outbound.stream.kcp.upCap"></a-input-number>
  258. </a-form-item>
  259. <a-form-item label='Downlink (MB/s)'>
  260. <a-input-number v-model.number="outbound.stream.kcp.downCap"></a-input-number>
  261. </a-form-item>
  262. <a-form-item label='Congestion'>
  263. <a-switch v-model="outbound.stream.kcp.congestion"></a-switch>
  264. </a-form-item>
  265. <a-form-item label='Read Buffer (MB)'>
  266. <a-input-number v-model.number="outbound.stream.kcp.readBuffer"></a-input-number>
  267. </a-form-item>
  268. <a-form-item label='Write Buffer (MB)'>
  269. <a-input-number v-model.number="outbound.stream.kcp.writeBuffer"></a-input-number>
  270. </a-form-item>
  271. </template>
  272. <!-- ws -->
  273. <template v-if="outbound.stream.network === 'ws'">
  274. <a-form-item label='{{ i18n "host" }}'>
  275. <a-input v-model="outbound.stream.ws.host"></a-input>
  276. </a-form-item>
  277. <a-form-item label='{{ i18n "path" }}'>
  278. <a-form-item><a-input v-model.trim="outbound.stream.ws.path"></a-input>
  279. </a-form-item>
  280. </template>
  281. <!-- http -->
  282. <template v-if="outbound.stream.network === 'http'">
  283. <a-form-item label='{{ i18n "host" }}'>
  284. <a-input v-model.trim="outbound.stream.http.host"></a-input>
  285. </a-form-item>
  286. <a-form-item label='{{ i18n "path" }}'>
  287. <a-input v-model.trim="outbound.stream.http.path"></a-input>
  288. </a-form-item>
  289. </template>
  290. <!-- quic -->
  291. <template v-if="outbound.stream.network === 'quic'">
  292. <a-form-item label='{{ i18n "pages.inbounds.stream.quic.encryption" }}'>
  293. <a-select v-model="outbound.stream.quic.security" :dropdown-class-name="themeSwitcher.currentTheme">
  294. <a-select-option value="none">None</a-select-option>
  295. <a-select-option value="aes-128-gcm">AES-128-GCM</a-select-option>
  296. <a-select-option value="chacha20-poly1305">CHACHA20-POLY1305</a-select-option>
  297. </a-select>
  298. </a-form-item>
  299. <a-form-item label='{{ i18n "password" }}'>
  300. <a-input v-model.trim="outbound.stream.quic.key"></a-input>
  301. </a-form-item>
  302. <a-form-item label='{{ i18n "camouflage" }}'>
  303. <a-select v-model="outbound.stream.quic.type" :dropdown-class-name="themeSwitcher.currentTheme">
  304. <a-select-option value="none">None</a-select-option>
  305. <a-select-option value="srtp">SRTP</a-select-option>
  306. <a-select-option value="utp">uTP</a-select-option>
  307. <a-select-option value="wechat-video">WeChat</a-select-option>
  308. <a-select-option value="dtls">DTLS 1.2</a-select-option>
  309. <a-select-option value="wireguard">WireGuard</a-select-option>
  310. </a-select>
  311. </a-form-item>
  312. </template>
  313. <!-- grpc -->
  314. <template v-if="outbound.stream.network === 'grpc'">
  315. <a-form-item label='Service Name'>
  316. <a-input v-model.trim="outbound.stream.grpc.serviceName"></a-input>
  317. </a-form-item>
  318. <a-form-item label='Multi Mode'>
  319. <a-switch v-model="outbound.stream.grpc.multiMode"></a-switch>
  320. </a-form-item>
  321. </template>
  322. </template>
  323. <!-- tls settings -->
  324. <template v-if="outbound.canEnableTls()">
  325. <a-form-item label='{{ i18n "security" }}'>
  326. <a-radio-group v-model="outbound.stream.security" button-style="solid">
  327. <a-radio-button value="none">{{ i18n "none" }}</a-radio-button>
  328. <a-radio-button value="tls">TLS</a-radio-button>
  329. <a-radio-button v-if="outbound.canEnableReality()" value="reality">REALITY</a-radio-button>
  330. </a-radio-group>
  331. </a-form-item>
  332. <template v-if="outbound.stream.isTls">
  333. <a-form-item label="SNI" placeholder="Server Name Indication">
  334. <a-input v-model.trim="outbound.stream.tls.serverName"></a-input>
  335. </a-form-item>
  336. <a-form-item label="uTLS">
  337. <a-select v-model="outbound.stream.tls.fingerprint"
  338. :dropdown-class-name="themeSwitcher.currentTheme">
  339. <a-select-option value=''>None</a-select-option>
  340. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  341. </a-select>
  342. </a-form-item>
  343. <a-form-item label="ALPN">
  344. <a-select mode="multiple"
  345. :dropdown-class-name="themeSwitcher.currentTheme"
  346. v-model="outbound.stream.tls.alpn">
  347. <a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option>
  348. </a-select>
  349. </a-form-item>
  350. <a-form-item label="Allow Insecure">
  351. <a-switch v-model="outbound.stream.tls.allowInsecure"></a-switch>
  352. </a-form-item>
  353. </template>
  354. <!-- reality settings -->
  355. <template v-if="outbound.stream.isReality">
  356. <a-form-item label="SNI">
  357. <a-input v-model.trim="outbound.stream.reality.serverName"></a-input>
  358. </a-form-item>
  359. <a-form-item label="uTLS">
  360. <a-select v-model="outbound.stream.reality.fingerprint"
  361. :dropdown-class-name="themeSwitcher.currentTheme">
  362. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  363. </a-select>
  364. </a-form-item>
  365. <a-form-item label="Short ID">
  366. <a-input v-model.trim="outbound.stream.reality.shortId" style="width:250px"></a-input>
  367. </a-form-item>
  368. <a-form-item label="SpiderX">
  369. <a-input v-model.trim="outbound.stream.reality.spiderX" style="width:250px"></a-input>
  370. </a-form-item>
  371. <a-form-item label="Public Key">
  372. <a-input v-model.trim="outbound.stream.reality.publicKey"></a-input>
  373. </a-form-item>
  374. </template>
  375. </template>
  376. </a-form>
  377. </a-tab-pane>
  378. <a-tab-pane key="2" tab="JSON" force-render="true">
  379. <a-form-item style="margin: 10px 0">
  380. Link: <a-input v-model.trim="outModal.link" style="width: 300px; margin-right: 5px;" placeholder="vmess:// vless:// trojan:// ss://"></a-input>
  381. <a-button @click="convertLink" type="primary"><a-icon type="form"></a-icon></a-button>
  382. </a-form-item>
  383. <textarea style="position:absolute; left: -800px;" id="outboundJson"></textarea>
  384. </a-tab-pane>
  385. </a-tabs>
  386. {{end}}