outbound.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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. <!-- shadowsocks -->
  189. <template v-if="outbound.protocol === Protocols.Shadowsocks">
  190. <a-form-item label='{{ i18n "encryption" }}'>
  191. <a-select v-model="outbound.settings.method" :dropdown-class-name="themeSwitcher.currentTheme">
  192. <a-select-option v-for="(method,method_name) in SSMethods" :value="method">[[ method_name ]]</a-select-option>
  193. </a-select>
  194. </a-form-item>
  195. <a-form-item label='UDP over TCP'>
  196. <a-switch v-model="outbound.settings.uot"></a-switch>
  197. </a-form-item>
  198. </template>
  199. </template>
  200. <!-- stream settings -->
  201. <template v-if="outbound.canEnableStream()">
  202. <a-form-item label='{{ i18n "transmission" }}'>
  203. <a-select v-model="outbound.stream.network" @change="streamNetworkChange"
  204. :dropdown-class-name="themeSwitcher.currentTheme">
  205. <a-select-option value="tcp">TCP</a-select-option>
  206. <a-select-option value="kcp">mKCP</a-select-option>
  207. <a-select-option value="ws">WS</a-select-option>
  208. <a-select-option value="http">H2</a-select-option>
  209. <a-select-option value="quic">QUIC</a-select-option>
  210. <a-select-option value="grpc">gRPC</a-select-option>
  211. </a-select>
  212. </a-form-item>
  213. <template v-if="outbound.stream.network === 'tcp'">
  214. <a-form-item label='HTTP {{ i18n "camouflage" }}'>
  215. <a-switch
  216. :checked="outbound.stream.tcp.type === 'http'"
  217. @change="checked => outbound.stream.tcp.type = checked ? 'http' : 'none'">
  218. </a-switch>
  219. </a-form-item>
  220. <template v-if="outbound.stream.tcp.type == 'http'">
  221. <a-form-item label='{{ i18n "host" }}'>
  222. <a-input v-model.trim="outbound.stream.tcp.host"></a-input>
  223. </a-form-item>
  224. <a-form-item label='{{ i18n "path" }}'>
  225. <a-input v-model.trim="outbound.stream.tcp.path"></a-input>
  226. </a-form-item>
  227. </template>
  228. </template>
  229. <!-- kcp -->
  230. <template v-if="outbound.stream.network === 'kcp'">
  231. <a-form-item label='{{ i18n "camouflage" }}'>
  232. <a-select v-model="outbound.stream.kcp.type" :dropdown-class-name="themeSwitcher.currentTheme">
  233. <a-select-option value="none">None</a-select-option>
  234. <a-select-option value="srtp">SRTP</a-select-option>
  235. <a-select-option value="utp">uTP</a-select-option>
  236. <a-select-option value="wechat-video">WeChat</a-select-option>
  237. <a-select-option value="dtls">DTLS 1.2</a-select-option>
  238. <a-select-option value="wireguard">WireGuard</a-select-option>
  239. </a-select>
  240. </a-form-item>
  241. <a-form-item label='{{ i18n "password" }}'>
  242. <a-input v-model="outbound.stream.kcp.seed"></a-input>
  243. </a-form-item>
  244. <a-form-item label='MTU'>
  245. <a-input-number v-model.number="outbound.stream.kcp.mtu"></a-input-number>
  246. </a-form-item>
  247. <a-form-item label='TTI (ms)'>
  248. <a-input-number v-model.number="outbound.stream.kcp.tti"></a-input-number>
  249. </a-form-item>
  250. <a-form-item label='Uplink (MB/s)'>
  251. <a-input-number v-model.number="outbound.stream.kcp.upCap"></a-input-number>
  252. </a-form-item>
  253. <a-form-item label='Downlink (MB/s)'>
  254. <a-input-number v-model.number="outbound.stream.kcp.downCap"></a-input-number>
  255. </a-form-item>
  256. <a-form-item label='Congestion'>
  257. <a-switch v-model="outbound.stream.kcp.congestion"></a-switch>
  258. </a-form-item>
  259. <a-form-item label='Read Buffer (MB)'>
  260. <a-input-number v-model.number="outbound.stream.kcp.readBuffer"></a-input-number>
  261. </a-form-item>
  262. <a-form-item label='Write Buffer (MB)'>
  263. <a-input-number v-model.number="outbound.stream.kcp.writeBuffer"></a-input-number>
  264. </a-form-item>
  265. </template>
  266. <!-- ws -->
  267. <template v-if="outbound.stream.network === 'ws'">
  268. <a-form-item label='{{ i18n "host" }}'>
  269. <a-input v-model="outbound.stream.ws.host"></a-input>
  270. </a-form-item>
  271. <a-form-item label='{{ i18n "path" }}'>
  272. <a-form-item><a-input v-model.trim="outbound.stream.ws.path"></a-input>
  273. </a-form-item>
  274. </template>
  275. <!-- http -->
  276. <template v-if="outbound.stream.network === 'http'">
  277. <a-form-item label='{{ i18n "host" }}'>
  278. <a-input v-model.trim="outbound.stream.http.host"></a-input>
  279. </a-form-item>
  280. <a-form-item label='{{ i18n "path" }}'>
  281. <a-input v-model.trim="outbound.stream.http.path"></a-input>
  282. </a-form-item>
  283. </template>
  284. <!-- quic -->
  285. <template v-if="outbound.stream.network === 'quic'">
  286. <a-form-item label='{{ i18n "pages.inbounds.stream.quic.encryption" }}'>
  287. <a-select v-model="outbound.stream.quic.security" :dropdown-class-name="themeSwitcher.currentTheme">
  288. <a-select-option value="none">None</a-select-option>
  289. <a-select-option value="aes-128-gcm">AES-128-GCM</a-select-option>
  290. <a-select-option value="chacha20-poly1305">CHACHA20-POLY1305</a-select-option>
  291. </a-select>
  292. </a-form-item>
  293. <a-form-item label='{{ i18n "password" }}'>
  294. <a-input v-model.trim="outbound.stream.quic.key"></a-input>
  295. </a-form-item>
  296. <a-form-item label='{{ i18n "camouflage" }}'>
  297. <a-select v-model="outbound.stream.quic.type" :dropdown-class-name="themeSwitcher.currentTheme">
  298. <a-select-option value="none">None</a-select-option>
  299. <a-select-option value="srtp">SRTP</a-select-option>
  300. <a-select-option value="utp">uTP</a-select-option>
  301. <a-select-option value="wechat-video">WeChat</a-select-option>
  302. <a-select-option value="dtls">DTLS 1.2</a-select-option>
  303. <a-select-option value="wireguard">WireGuard</a-select-option>
  304. </a-select>
  305. </a-form-item>
  306. </template>
  307. <!-- grpc -->
  308. <template v-if="outbound.stream.network === 'grpc'">
  309. <a-form-item label='Service Name'>
  310. <a-input v-model.trim="outbound.stream.grpc.serviceName"></a-input>
  311. </a-form-item>
  312. <a-form-item label='Multi Mode'>
  313. <a-switch v-model="outbound.stream.grpc.multiMode"></a-switch>
  314. </a-form-item>
  315. </template>
  316. </template>
  317. <!-- tls settings -->
  318. <template v-if="outbound.canEnableTls()">
  319. <a-form-item label='{{ i18n "security" }}'>
  320. <a-radio-group v-model="outbound.stream.security" button-style="solid">
  321. <a-radio-button value="none">{{ i18n "none" }}</a-radio-button>
  322. <a-radio-button value="tls">TLS</a-radio-button>
  323. <a-radio-button v-if="outbound.canEnableReality()" value="reality">Reality</a-radio-button>
  324. </a-radio-group>
  325. </a-form-item>
  326. <template v-if="outbound.stream.isTls">
  327. <a-form-item label="SNI" placeholder="Server Name Indication">
  328. <a-input v-model.trim="outbound.stream.tls.serverName"></a-input>
  329. </a-form-item>
  330. <a-form-item label="uTLS">
  331. <a-select v-model="outbound.stream.tls.fingerprint" :dropdown-class-name="themeSwitcher.currentTheme">
  332. <a-select-option value=''>None</a-select-option>
  333. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  334. </a-select>
  335. </a-form-item>
  336. <a-form-item label="ALPN">
  337. <a-select mode="multiple" :dropdown-class-name="themeSwitcher.currentTheme"
  338. v-model="outbound.stream.tls.alpn">
  339. <a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option>
  340. </a-select>
  341. </a-form-item>
  342. <a-form-item label="Allow Insecure">
  343. <a-switch v-model="outbound.stream.tls.allowInsecure"></a-switch>
  344. </a-form-item>
  345. </template>
  346. <!-- reality settings -->
  347. <template v-if="outbound.stream.isReality">
  348. <a-form-item label='{{ i18n "domainName" }}'>
  349. <a-input v-model.trim="outbound.stream.reality.serverName"></a-input>
  350. </a-form-item>
  351. <a-form-item label="uTLS">
  352. <a-select v-model="outbound.stream.reality.fingerprint" :dropdown-class-name="themeSwitcher.currentTheme">
  353. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  354. </a-select>
  355. </a-form-item>
  356. <a-form-item label="Short ID">
  357. <a-input v-model.trim="outbound.stream.reality.shortId" style="width:250px"></a-input>
  358. </a-form-item>
  359. <a-form-item label="SpiderX">
  360. <a-input v-model.trim="outbound.stream.reality.spiderX" style="width:250px"></a-input>
  361. </a-form-item>
  362. <a-form-item label="Public Key">
  363. <a-input v-model.trim="outbound.stream.reality.publicKey"></a-input>
  364. </a-form-item>
  365. </template>
  366. </template>
  367. </a-form>
  368. </a-tab-pane>
  369. <a-tab-pane key="2" tab="JSON" force-render="true">
  370. <a-form-item style="margin: 10px 0">
  371. Link: <a-input v-model.trim="outModal.link" style="width: 300px; margin-right: 5px;" placeholder="vmess:// vless:// trojan:// ss://"></a-input>
  372. <a-button @click="convertLink" type="primary"><a-icon type="form"></a-icon></a-button>
  373. </a-form-item>
  374. <textarea style="position:absolute; left: -800px;" id="outboundJson"></textarea>
  375. </a-tab-pane>
  376. </a-tabs>
  377. {{end}}