outbound.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  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. <!-- wireguard settings -->
  46. <template v-if="outbound.protocol === Protocols.Wireguard">
  47. <a-form-item label='Secret Key'>
  48. <a-input v-model.trim="outbound.settings.secretKey"></a-input>
  49. </a-form-item>
  50. <a-form-item label="Address">
  51. <a-row>
  52. <a-button size="small" @click="outbound.settings.addAddress()">
  53. +
  54. </a-button>
  55. </a-row>
  56. <a-space direction="vertical">
  57. <a-input-group compact v-for="(address, index) in outbound.settings.address">
  58. <a-input v-model.trim="outbound.settings.address[index]" style="width: calc(100% - 40px)"></a-input>
  59. <a-button type="delete" @click="outbound.settings.delAddress(index)">-</a-button>
  60. </a-input-group>
  61. </a-space>
  62. </a-form-item>
  63. <a-form-item label='MTU'>
  64. <a-input placeholder="1420" type="number" min="0" v-model.number="outbound.settings.mtu"></a-input>
  65. </a-form-item>
  66. <a-form-item label='Workers'>
  67. <a-input type="number" min="0" v-model.number="outbound.settings.workers"></a-input>
  68. </a-form-item>
  69. <a-form-item label='Domain Strategy'>
  70. <a-select
  71. v-model="outbound.settings.domainStrategy"
  72. :dropdown-class-name="themeSwitcher.currentTheme">
  73. <a-select-option v-for="s in ['', ...WireguardDomainStrategy]" :value="s">[[ s ]]</a-select-option>
  74. </a-select>
  75. </a-form-item>
  76. <a-form-item label="Peers">
  77. <a-row>
  78. <a-button type="primary" size="small"
  79. @click="outbound.settings.addPeer()">
  80. +
  81. </a-button>
  82. </a-row>
  83. </a-form-item>
  84. <a-form v-for="(peer, index) in outbound.settings.peers" :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
  85. <a-divider style="margin:0;">
  86. Peer [[ index + 1 ]]
  87. <a-icon type="delete" @click="() => outbound.settings.delPeer(index)"
  88. style="color: rgb(255, 77, 79);cursor: pointer;"/>
  89. </a-divider>
  90. <a-form-item label='Endpoint'>
  91. <a-input v-model.trim="peer.endpoint"></a-input>
  92. </a-form-item>
  93. <a-form-item label='Public Key'>
  94. <a-input v-model.trim="peer.publicKey"></a-input>
  95. </a-form-item>
  96. <a-form-item label='PreShared Key'>
  97. <a-input v-model.trim="peer.preSharedKey"></a-input>
  98. </a-form-item>
  99. <a-form-item label='keepAlive'>
  100. <a-input type="number" min="0" v-model.number="peer.keepAlive"></a-input>
  101. </a-form-item>
  102. <a-form-item label="Allowed IPs">
  103. <a-row>
  104. <a-button size="small" @click="outbound.settings.addAllowedIP(index)">
  105. +
  106. </a-button>
  107. </a-row>
  108. <a-space direction="vertical">
  109. <a-input-group compact v-for="(allowedIp, ipIndex) in peer.allowedIPs">
  110. <a-input v-model.trim="peer.allowedIPs[ipIndex]" style="width: calc(100% - 40px)"></a-input>
  111. <a-button type="delete" @click="outbound.settings.delAllowedIP(index, ipIndex)">-</a-button>
  112. </a-input-group>
  113. </a-space>
  114. </a-form-item>
  115. </a-form>
  116. </template>
  117. <!-- blackhole settings -->
  118. <template v-if="outbound.protocol === Protocols.Blackhole">
  119. <a-form-item label='Response Type'>
  120. <a-select
  121. v-model="outbound.settings.type"
  122. :dropdown-class-name="themeSwitcher.currentTheme">
  123. <a-select-option v-for="s in ['', 'none','http']" :value="s">[[ s ]]</a-select-option>
  124. </a-select>
  125. </a-form-item>
  126. </template>
  127. <!-- dns settings -->
  128. <template v-if="outbound.protocol === Protocols.DNS">
  129. <a-form-item label='{{ i18n "pages.inbounds.network" }}'>
  130. <a-select
  131. v-model="outbound.settings.network"
  132. :dropdown-class-name="themeSwitcher.currentTheme">
  133. <a-select-option v-for="s in ['udp','tcp']" :value="s">[[ s ]]</a-select-option>
  134. </a-select>
  135. </a-form-item>
  136. </template>
  137. <!-- Address + Port -->
  138. <template v-if="outbound.hasAddressPort()">
  139. <a-form-item label='{{ i18n "pages.inbounds.address" }}'>
  140. <a-input v-model.trim="outbound.settings.address"></a-input>
  141. </a-form-item>
  142. <a-form-item label='{{ i18n "pages.inbounds.port" }}'>
  143. <a-input-number v-model.number="outbound.settings.port" :min="1" :max="65532"></a-input-number>
  144. </a-form-item>
  145. </template>
  146. <!-- Vnext (vless/vmess) settings -->
  147. <template v-if="[Protocols.VMess, Protocols.VLESS].includes(outbound.protocol)">
  148. <a-form-item label='ID'>
  149. <a-input v-model.trim="outbound.settings.id"></a-input>
  150. </a-form-item>
  151. <!-- vless settings -->
  152. <template v-if="outbound.canEnableTlsFlow()">
  153. <a-form-item label='Flow'>
  154. <a-select v-model="outbound.settings.flow" :dropdown-class-name="themeSwitcher.currentTheme">
  155. <a-select-option value="" selected>{{ i18n "none" }}</a-select-option>
  156. <a-select-option v-for="key in TLS_FLOW_CONTROL" :value="key">[[ key ]]</a-select-option>
  157. </a-select>
  158. </a-form-item>
  159. </template>
  160. </template>
  161. <!-- Servers (trojan/shadowsocks/socks/http) settings -->
  162. <template v-if="outbound.hasServers()">
  163. <!-- http / socks -->
  164. <template v-if="outbound.hasUsername()">
  165. <a-form-item label='{{ i18n "username" }}'>
  166. <a-input v-model.trim="outbound.settings.user"></a-input>
  167. </a-form-item>
  168. <a-form-item label='{{ i18n "password" }}'>
  169. <a-input v-model.trim="outbound.settings.pass"></a-input>
  170. </a-form-item>
  171. </template>
  172. <!-- shadowsocks -->
  173. <template v-if="outbound.protocol === Protocols.Shadowsocks">
  174. <a-form-item label='{{ i18n "encryption" }}'>
  175. <a-select v-model="outbound.settings.method" :dropdown-class-name="themeSwitcher.currentTheme">
  176. <a-select-option v-for="method in SSMethods" :value="method">[[ method ]]</a-select-option>
  177. </a-select>
  178. </a-form-item>
  179. <a-form-item label='UDP over TCP'>
  180. <a-switch v-model="outbound.settings.uot"></a-switch>
  181. </a-form-item>
  182. </template>
  183. </template>
  184. <!-- stream settings -->
  185. <template v-if="outbound.canEnableStream()">
  186. <a-form-item label='{{ i18n "transmission" }}'>
  187. <a-select v-model="outbound.stream.network" @change="streamNetworkChange"
  188. :dropdown-class-name="themeSwitcher.currentTheme">
  189. <a-select-option value="tcp">TCP</a-select-option>
  190. <a-select-option value="kcp">KCP</a-select-option>
  191. <a-select-option value="ws">WS</a-select-option>
  192. <a-select-option value="http">HTTP2</a-select-option>
  193. <a-select-option value="quic">QUIC</a-select-option>
  194. <a-select-option value="grpc">gRPC</a-select-option>
  195. </a-select>
  196. </a-form-item>
  197. <template v-if="outbound.stream.network === 'tcp'">
  198. <a-form-item label='HTTP {{ i18n "camouflage" }}'>
  199. <a-switch
  200. :checked="outbound.stream.tcp.type === 'http'"
  201. @change="checked => outbound.stream.tcp.type = checked ? 'http' : 'none'">
  202. </a-switch>
  203. </a-form-item>
  204. <template v-if="outbound.stream.tcp.type == 'http'">
  205. <a-form-item label='{{ i18n "host" }}'>
  206. <a-input v-model.trim="outbound.stream.tcp.host"></a-input>
  207. </a-form-item>
  208. <a-form-item label='{{ i18n "path" }}'>
  209. <a-input v-model.trim="outbound.stream.tcp.path"></a-input>
  210. </a-form-item>
  211. </template>
  212. </template>
  213. <!-- kcp -->
  214. <template v-if="outbound.stream.network === 'kcp'">
  215. <a-form-item label='{{ i18n "camouflage" }}'>
  216. <a-select v-model="outbound.stream.kcp.type" :dropdown-class-name="themeSwitcher.currentTheme">
  217. <a-select-option value="none">none (not camouflage)</a-select-option>
  218. <a-select-option value="srtp">srtp (video call)</a-select-option>
  219. <a-select-option value="utp">utp (BT download)</a-select-option>
  220. <a-select-option value="wechat-video">wechat-video (WeChat video)</a-select-option>
  221. <a-select-option value="dtls">dtls (DTLS 1.2 packages)</a-select-option>
  222. <a-select-option value="wireguard">wireguard (wireguard packages)</a-select-option>
  223. </a-select>
  224. </a-form-item>
  225. <a-form-item label='{{ i18n "password" }}'>
  226. <a-input v-model="outbound.stream.kcp.seed"></a-input>
  227. </a-form-item>
  228. <a-form-item label='MTU'>
  229. <a-input-number v-model.number="outbound.stream.kcp.mtu"></a-input-number>
  230. </a-form-item>
  231. <a-form-item label='TTI (ms)'>
  232. <a-input-number v-model.number="outbound.stream.kcp.tti"></a-input-number>
  233. </a-form-item>
  234. <a-form-item label='Uplink Capacity (MB/s)'>
  235. <a-input-number v-model.number="outbound.stream.kcp.upCap"></a-input-number>
  236. </a-form-item>
  237. <a-form-item label='Downlink Capacity (MB/s)'>
  238. <a-input-number v-model.number="outbound.stream.kcp.downCap"></a-input-number>
  239. </a-form-item>
  240. <a-form-item label='Congestion'>
  241. <a-switch v-model="outbound.stream.kcp.congestion"></a-switch>
  242. </a-form-item>
  243. <a-form-item label='Read Buffer Size (MB)'>
  244. <a-input-number v-model.number="outbound.stream.kcp.readBuffer"></a-input-number>
  245. </a-form-item>
  246. <a-form-item label='Write Buffer Size (MB)'>
  247. <a-input-number v-model.number="outbound.stream.kcp.writeBuffer"></a-input-number>
  248. </a-form-item>
  249. </template>
  250. <!-- ws -->
  251. <template v-if="outbound.stream.network === 'ws'">
  252. <a-form-item label='{{ i18n "host" }}'>
  253. <a-input v-model="outbound.stream.ws.host"></a-input>
  254. </a-form-item>
  255. <a-form-item label='{{ i18n "path" }}'>
  256. <a-form-item><a-input v-model.trim="outbound.stream.ws.path"></a-input>
  257. </a-form-item>
  258. </template>
  259. <!-- http -->
  260. <template v-if="outbound.stream.network === 'http'">
  261. <a-form-item label='{{ i18n "host" }}'>
  262. <a-input v-model.trim="outbound.stream.http.host"></a-input>
  263. </a-form-item>
  264. <a-form-item label='{{ i18n "path" }}'>
  265. <a-input v-model.trim="outbound.stream.http.path"></a-input>
  266. </a-form-item>
  267. </template>
  268. <!-- quic -->
  269. <template v-if="outbound.stream.network === 'quic'">
  270. <a-form-item label='{{ i18n "pages.inbounds.stream.quic.encryption" }}'>
  271. <a-select v-model="outbound.stream.quic.security" :dropdown-class-name="themeSwitcher.currentTheme">
  272. <a-select-option value="none">none</a-select-option>
  273. <a-select-option value="aes-128-gcm">aes-128-gcm</a-select-option>
  274. <a-select-option value="chacha20-poly1305">chacha20-poly1305</a-select-option>
  275. </a-select>
  276. </a-form-item>
  277. <a-form-item label='{{ i18n "password" }}'>
  278. <a-input v-model.trim="outbound.stream.quic.key"></a-input>
  279. </a-form-item>
  280. <a-form-item label='{{ i18n "camouflage" }}'>
  281. <a-select v-model="outbound.stream.quic.type" :dropdown-class-name="themeSwitcher.currentTheme">
  282. <a-select-option value="none">none (No Obfuscation)</a-select-option>
  283. <a-select-option value="srtp">SRTP (Video Call)</a-select-option>
  284. <a-select-option value="utp">uTP (Bittorrent)</a-select-option>
  285. <a-select-option value="wechat-video">WeChat Video</a-select-option>
  286. <a-select-option value="dtls">DTLS (DTLS 1.2 packages)</a-select-option>
  287. <a-select-option value="wireguard">WireGuard (WireGuard Packages)</a-select-option>
  288. </a-select>
  289. </a-form-item>
  290. </template>
  291. <!-- grpc -->
  292. <template v-if="outbound.stream.network === 'grpc'">
  293. <a-form-item label='Service Name'>
  294. <a-input v-model.trim="outbound.stream.grpc.serviceName"></a-input>
  295. </a-form-item>
  296. <a-form-item label='Multi Mode'>
  297. <a-switch v-model="outbound.stream.grpc.multiMode"></a-switch>
  298. </a-form-item>
  299. </template>
  300. </template>
  301. <!-- tls settings -->
  302. <template v-if="outbound.canEnableTls()">
  303. <a-form-item label='{{ i18n "security" }}'>
  304. <a-radio-group v-model="outbound.stream.security" button-style="solid">
  305. <a-radio-button value="none">{{ i18n "none" }}</a-radio-button>
  306. <a-radio-button value="tls">TLS</a-radio-button>
  307. <a-radio-button v-if="outbound.canEnableReality()" value="reality">Reality</a-radio-button>
  308. </a-radio-group>
  309. </a-form-item>
  310. <template v-if="outbound.stream.isTls">
  311. <a-form-item label="SNI" placeholder="Server Name Indication">
  312. <a-input v-model.trim="outbound.stream.tls.serverName"></a-input>
  313. </a-form-item>
  314. <a-form-item label="uTLS">
  315. <a-select v-model="outbound.stream.tls.fingerprint"
  316. :dropdown-class-name="themeSwitcher.currentTheme">
  317. <a-select-option value=''>None</a-select-option>
  318. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  319. </a-select>
  320. </a-form-item>
  321. <a-form-item label="ALPN">
  322. <a-select
  323. mode="multiple"
  324. :dropdown-class-name="themeSwitcher.currentTheme"
  325. v-model="outbound.stream.tls.alpn">
  326. <a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option>
  327. </a-select>
  328. </a-form-item>
  329. <a-form-item label="Allow Insecure">
  330. <a-switch v-model="outbound.stream.tls.allowInsecure"></a-switch>
  331. </a-form-item>
  332. </template>
  333. <!-- reality settings -->
  334. <template v-if="outbound.stream.isReality">
  335. <a-form-item label='{{ i18n "domainName" }}'>
  336. <a-input v-model.trim="outbound.stream.reality.serverName"></a-input>
  337. </a-form-item>
  338. <a-form-item label="uTLS">
  339. <a-select v-model="outbound.stream.reality.fingerprint"
  340. :dropdown-class-name="themeSwitcher.currentTheme">
  341. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  342. </a-select>
  343. </a-form-item>
  344. <a-form-item label="Short IDs">
  345. <a-input v-model.trim="outbound.stream.reality.shortId" style="width:250px"></a-input>
  346. </a-form-item>
  347. <a-form-item label="SpiderX">
  348. <a-input v-model.trim="outbound.stream.reality.spiderX" style="width:250px"></a-input>
  349. </a-form-item>
  350. <a-form-item label="Public Key">
  351. <a-input v-model.trim="outbound.stream.reality.publicKey"></a-input>
  352. </a-form-item>
  353. </template>
  354. </template>
  355. </a-form>
  356. </a-tab-pane>
  357. <a-tab-pane key="2" tab="JSON" force-render="true">
  358. <a-form-item style="margin: 10px 0">
  359. Link: <a-input v-model.trim="outModal.link" style="width: 300px; margin-right: 5px;" placeholder="vmess:// vless:// trojan:// ss://"></a-input>
  360. <a-button @click="convertLink" type="primary"><a-icon type="form"></a-icon></a-button>
  361. </a-form-item>
  362. <textarea style="position:absolute; left: -800px;" id="outboundJson"></textarea>
  363. </a-tab-pane>
  364. </a-tabs>
  365. {{end}}