tls_settings.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. {{define "form/tlsSettings"}}
  2. <!-- tls enable -->
  3. <a-form v-if="inbound.canEnableTls()" layout="inline">
  4. <a-divider style="margin:0;"></a-divider>
  5. <table width="100%" class="ant-table-tbody">
  6. <tr>
  7. <td colspan="2">
  8. <a-form-item label='{{ i18n "security" }}'>
  9. <a-radio-group v-model="inbound.stream.security" button-style="solid">
  10. <a-radio-button value="none">{{ i18n "none" }}</a-radio-button>
  11. <a-tooltip>
  12. <template slot="title">
  13. <span>{{ i18n "pages.inbounds.xtlsDesc" }}</span>
  14. </template>
  15. <a-radio-button v-if="inbound.canEnableXtls()" value="xtls">XTLS</a-radio-button>
  16. </a-tooltip>
  17. <a-tooltip>
  18. <template slot="title">
  19. <span>{{ i18n "pages.inbounds.realityDesc" }}</span>
  20. </template>
  21. <a-radio-button v-if="inbound.canEnableReality()" value="reality">Reality</a-radio-button>
  22. </a-tooltip>
  23. <a-radio-button value="tls">TLS</a-radio-button>
  24. </a-radio-group>
  25. </a-form-item>
  26. </td>
  27. </tr>
  28. <!-- tls settings -->
  29. <template v-if="inbound.stream.isTls">
  30. <tr>
  31. <td>SNI</td>
  32. <td>
  33. <a-form-item placeholder="Server Name Indication">
  34. <a-input v-model.trim="inbound.stream.tls.sni" style="width: 250px"></a-input>
  35. </a-form-item>
  36. </td>
  37. </tr>
  38. <tr>
  39. <td>CipherSuites</td>
  40. <td>
  41. <a-form-item>
  42. <a-select v-model="inbound.stream.tls.cipherSuites" style="width: 250px"
  43. :dropdown-class-name="themeSwitcher.currentTheme">
  44. <a-select-option value="">auto</a-select-option>
  45. <a-select-option v-for="key,value in TLS_CIPHER_OPTION"
  46. :value="key">[[ value]]</a-select-option>
  47. </a-select>
  48. </a-form-item>
  49. </td>
  50. </tr>
  51. <tr>
  52. <td>Min/Max Version</td>
  53. <td>
  54. <a-form-item>
  55. <a-input-group compact>
  56. <a-select style="width: 125px" v-model="inbound.stream.tls.minVersion"
  57. :dropdown-class-name="themeSwitcher.currentTheme">
  58. <a-select-option v-for="key in TLS_VERSION_OPTION"
  59. :value="key">[[ key ]]</a-select-option>
  60. </a-select>
  61. <a-select style="width: 125px" v-model="inbound.stream.tls.maxVersion"
  62. :dropdown-class-name="themeSwitcher.currentTheme">
  63. <a-select-option v-for="key in TLS_VERSION_OPTION"
  64. :value="key">[[ key ]]</a-select-option>
  65. </a-select>
  66. </a-input-group>
  67. </a-form-item>
  68. </td>
  69. </tr>
  70. <tr>
  71. <td>uTLS</td>
  72. <td>
  73. <a-form-item>
  74. <a-select v-model="inbound.stream.tls.settings.fingerprint" style="width: 250px"
  75. :dropdown-class-name="themeSwitcher.currentTheme">
  76. <a-select-option value=''>None</a-select-option>
  77. <a-select-option v-for="key in UTLS_FINGERPRINT"
  78. :value="key">[[ key ]]</a-select-option>
  79. </a-select>
  80. </a-form-item>
  81. </td>
  82. </tr>
  83. <tr>
  84. <td>ALPN</td>
  85. <td>
  86. <a-form-item>
  87. <a-select mode="multiple" style="width: 250px"
  88. :dropdown-class-name="themeSwitcher.currentTheme"
  89. v-model="inbound.stream.tls.alpn">
  90. <a-select-option v-for="alpn in ALPN_OPTION"
  91. :value="alpn">[[ alpn ]]</a-select-option>
  92. </a-select>
  93. </a-form-item>
  94. </td>
  95. </tr>
  96. <tr>
  97. <td>Allow insecure</td>
  98. <td>
  99. <a-form-item>
  100. <a-switch v-model="inbound.stream.tls.settings.allowInsecure"></a-switch>
  101. </a-form-item>
  102. </td>
  103. </tr>
  104. <tr>
  105. <td>Reject Unknown SNI</td>
  106. <td>
  107. <a-form-item>
  108. <a-switch v-model="inbound.stream.tls.rejectUnknownSni"></a-switch>
  109. </a-form-item>
  110. </td>
  111. </tr>
  112. <template v-for="cert,index in inbound.stream.tls.certs">
  113. <tr>
  114. <td>{{ i18n "certificate" }}</td>
  115. <td>
  116. <a-form-item>
  117. <a-radio-group v-model="cert.useFile" button-style="solid">
  118. <a-radio-button
  119. :value="true">{{ i18n "pages.inbounds.certificatePath"}}
  120. </a-radio-button>
  121. <a-radio-button
  122. :value="false">{{ i18n "pages.inbounds.certificateContent"}}
  123. </a-radio-button>
  124. </a-radio-group>
  125. <a-button v-if="index === 0" type="primary" size="small"
  126. @click="inbound.stream.tls.addCert()" style="margin-left: 10px">+</a-button>
  127. <a-button v-if="inbound.stream.tls.certs.length>1" type="primary" size="small"
  128. @click="inbound.stream.tls.removeCert(index)" style="margin-left: 10px">-</a-button>
  129. </a-form-item>
  130. </td>
  131. </tr>
  132. <template v-if="cert.useFile">
  133. <tr>
  134. <td>{{ i18n "pages.inbounds.publicKeyPath" }}</td>
  135. <td>
  136. <a-form-item>
  137. <a-input v-model.trim="cert.certFile" style="width:250px;"></a-input>
  138. </a-form-item>
  139. </td>
  140. </tr>
  141. <tr>
  142. <td>{{ i18n "pages.inbounds.keyPath" }}</td>
  143. <td>
  144. <a-form-item>
  145. <a-input v-model.trim="cert.keyFile" style="width:250px;"></a-input>
  146. </a-form-item>
  147. </td>
  148. </tr>
  149. <tr>
  150. <td></td>
  151. <td>
  152. <a-button type="primary" icon="import" @click="setDefaultCertData(index)">
  153. {{ i18n "pages.inbounds.setDefaultCert" }}
  154. </a-button>
  155. </td>
  156. </tr>
  157. </template>
  158. <template v-else>
  159. <tr>
  160. <td>{{ i18n "pages.inbounds.publicKeyContent" }}</td>
  161. <td>
  162. <a-form-item>
  163. <a-input type="textarea" :rows="3" style="width:250px;" v-model="cert.cert"></a-input>
  164. </a-form-item>
  165. </td>
  166. </tr>
  167. <tr>
  168. <td>{{ i18n "pages.inbounds.keyContent" }}</td>
  169. <td>
  170. <a-form-item>
  171. <a-input type="textarea" :rows="3" style="width:250px;" v-model="cert.key"></a-input>
  172. </a-form-item>
  173. </td>
  174. </tr>
  175. </template>
  176. <tr>
  177. <td>ocspStapling</td>
  178. <td>
  179. <a-form-item>
  180. <a-input-number v-model.number="cert.ocspStapling" :min="0"></a-input-number>
  181. </a-form-item>
  182. </td>
  183. </tr>
  184. </template>
  185. </template>
  186. <!-- xtls settings -->
  187. <template v-else-if="inbound.xtls">
  188. <tr>
  189. <td>
  190. <span>SNI</span>
  191. </td>
  192. <td>
  193. <a-form-item>
  194. <a-input v-model.trim="inbound.stream.xtls.server" style="width: 250px"></a-input>
  195. </a-form-item>
  196. </td>
  197. </tr>
  198. <tr>
  199. <td>
  200. <span>Alpn</span>
  201. </td>
  202. <td>
  203. <a-form-item>
  204. <a-select mode="multiple" style="width: 250px" :dropdown-class-name="themeSwitcher.currentTheme"
  205. v-model="inbound.stream.xtls.alpn">
  206. <a-select-option v-for="alpn in ALPN_OPTION" :value="alpn">[[ alpn ]]</a-select-option>
  207. </a-select>
  208. </a-form-item>
  209. </td>
  210. </tr>
  211. <tr>
  212. <td>
  213. <span>Allow insecure</span>
  214. </td>
  215. <td>
  216. <a-form-item>
  217. <a-switch v-model="inbound.stream.xtls.settings.allowInsecure"></a-switch>
  218. </a-form-item>
  219. </td>
  220. </tr>
  221. <template v-for="cert,index in inbound.stream.xtls.certs">
  222. <tr>
  223. <td>{{ i18n "certificate" }}</td>
  224. <td>
  225. <a-form-item>
  226. <a-radio-group v-model="cert.useFile" button-style="solid">
  227. <a-radio-button :value="true">{{ i18n "pages.inbounds.certificatePath"
  228. }}</a-radio-button>
  229. <a-radio-button :value="false">{{ i18n "pages.inbounds.certificateContent"
  230. }}</a-radio-button>
  231. </a-radio-group>
  232. <a-button v-if="index === 0" type="primary" size="small"
  233. @click="inbound.stream.xtls.addCert()" style="margin-left: 10px">+</a-button>
  234. <a-button v-if="inbound.stream.xtls.certs.length>1" type="primary" size="small"
  235. @click="inbound.stream.xtls.removeCert(index)" style="margin-left: 10px">-</a-button>
  236. </a-form-item>
  237. </td>
  238. </tr>
  239. <template v-if="cert.useFile">
  240. <tr>
  241. <td>{{ i18n "pages.inbounds.publicKeyPath" }}</td>
  242. <td>
  243. <a-form-item>
  244. <a-input v-model.trim="cert.certFile" style="width:250px;"></a-input>
  245. </a-form-item>
  246. </td>
  247. </tr>
  248. <tr>
  249. <td>{{ i18n "pages.inbounds.keyPath" }}</td>
  250. <td>
  251. <a-form-item>
  252. <a-input v-model.trim="cert.keyFile" style="width:250px;"></a-input>
  253. </a-form-item>
  254. </td>
  255. </tr>
  256. <tr>
  257. <td></td>
  258. <td>
  259. <a-button type="primary" icon="import" @click="setDefaultCertData(index)">{{ i18n
  260. "pages.inbounds.setDefaultCert" }}</a-button>
  261. </td>
  262. </tr>
  263. </template>
  264. <template v-else>
  265. <tr>
  266. <td>{{ i18n "pages.inbounds.publicKeyContent" }}</td>
  267. <td>
  268. <a-form-item>
  269. <a-input type="textarea" :rows="3" style="width:250px;" v-model="cert.cert"></a-input>
  270. </a-form-item>
  271. </td>
  272. </tr>
  273. <tr>
  274. <td>{{ i18n "pages.inbounds.keyContent" }}</td>
  275. <td>
  276. <a-form-item>
  277. <a-input type="textarea" :rows="3" style="width:250px;" v-model="cert.key"></a-input>
  278. </a-form-item>
  279. </td>
  280. </tr>
  281. </template>
  282. </template>
  283. </template>
  284. <!-- reality settings -->
  285. <template v-else-if="inbound.reality">
  286. <tr>
  287. <td>
  288. <span>Show</span>
  289. </td>
  290. <td>
  291. <a-form-item>
  292. <a-switch v-model="inbound.stream.reality.show"></a-switch>
  293. </a-form-item>
  294. </td>
  295. </tr>
  296. <tr>
  297. <td>
  298. <span>xVer</span>
  299. </td>
  300. <td>
  301. <a-form-item>
  302. <a-input-number v-model="inbound.stream.reality.xver" :min="0"
  303. style="width: 60px"></a-input-number>
  304. </a-form-item>
  305. </td>
  306. </tr>
  307. <tr>
  308. <td>
  309. <span>uTLS</span>
  310. </td>
  311. <td>
  312. <a-form-item>
  313. <a-select v-model="inbound.stream.reality.settings.fingerprint" style="width: 135px"
  314. :dropdown-class-name="themeSwitcher.currentTheme">
  315. <a-select-option v-for="key in UTLS_FINGERPRINT" :value="key">[[ key ]]</a-select-option>
  316. </a-select>
  317. </a-form-item>
  318. </td>
  319. </tr>
  320. <tr>
  321. <td>
  322. <span>Dest</span>
  323. </td>
  324. <td>
  325. <a-form-item>
  326. <a-input v-model.trim="inbound.stream.reality.dest" style="width: 300px"></a-input>
  327. </a-form-item>
  328. </td>
  329. </tr>
  330. <tr>
  331. <td>
  332. <span>Server Names</span>
  333. </td>
  334. <td>
  335. <a-form-item>
  336. <a-input v-model.trim="inbound.stream.reality.serverNames" style="width: 300px"></a-input>
  337. </a-form-item>
  338. </td>
  339. </tr>
  340. <tr>
  341. <td>
  342. <span>ShortIds</span> <a-icon @click="inbound.stream.reality.shortIds = RandomUtil.randomShortId()"
  343. type="sync"> </a-icon>
  344. </td>
  345. <td>
  346. <a-form-item>
  347. <a-input v-model.trim="inbound.stream.reality.shortIds" style="width: 150px;"></a-input>
  348. </a-form-item>
  349. </td>
  350. </tr>
  351. <tr>
  352. <td>
  353. <span>SpiderX</span>
  354. </td>
  355. <td>
  356. <a-form-item>
  357. <a-input v-model.trim="inbound.stream.reality.settings.spiderX" style="width: 150px;"></a-input>
  358. </a-form-item>
  359. </td>
  360. </tr>
  361. <tr>
  362. <td>
  363. <span>Private Key</span>
  364. </td>
  365. <td>
  366. <a-form-item>
  367. <a-input v-model.trim="inbound.stream.reality.privateKey" style="width: 300px"></a-input>
  368. </a-form-item>
  369. </td>
  370. </tr>
  371. <tr>
  372. <td>
  373. <span>Public Key</span>
  374. </td>
  375. <td>
  376. <a-form-item>
  377. <a-input v-model.trim="inbound.stream.reality.settings.publicKey"
  378. style="width: 300px"></a-input>
  379. </a-form-item>
  380. </td>
  381. </tr>
  382. <tr>
  383. <td colspan="2">
  384. <a-button type="primary" icon="import" @click="getNewX25519Cert">Get New Key</a-button>
  385. </td>
  386. </tr>
  387. </template>
  388. </table>
  389. </a-form>
  390. {{end}}