1
0

wireguard.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {{define "form/wireguard"}}
  2. <a-form :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
  3. <a-form-item>
  4. <template slot="label">
  5. <a-tooltip>
  6. <template slot="title">
  7. <span>{{ i18n "reset" }}</span>
  8. </template>
  9. {{ i18n "pages.xray.wireguard.secretKey" }}
  10. <a-icon type="sync" @click="[inbound.settings.pubKey, inbound.settings.secretKey] = Object.values(Wireguard.generateKeypair())"></a-icon>
  11. </a-tooltip>
  12. </template>
  13. <a-input v-model.trim="inbound.settings.secretKey"></a-input>
  14. </a-form-item>
  15. <a-form-item label='{{ i18n "pages.xray.wireguard.publicKey" }}'>
  16. <a-input disabled v-model="inbound.settings.pubKey"></a-input>
  17. </a-form-item>
  18. <a-form-item label='MTU'>
  19. <a-input-number v-model.number="inbound.settings.mtu"></a-input-number>
  20. </a-form-item>
  21. <a-form-item label='Kernel Mode'>
  22. <a-switch v-model="inbound.settings.kernelMode"></a-switch>
  23. </a-form-item>
  24. <a-form-item label="Peers">
  25. <a-button icon="plus" type="primary" size="small" @click="inbound.settings.addPeer()"></a-button>
  26. </a-form-item>
  27. <a-form v-for="(peer, index) in inbound.settings.peers" :colon="false" :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
  28. <a-divider style="margin:0;"> Peer [[ index + 1 ]] <a-icon v-if="inbound.settings.peers.length>1" type="delete" @click="() => inbound.settings.delPeer(index)" style="color: rgb(255, 77, 79);cursor: pointer;"></a-icon>
  29. </a-divider>
  30. <a-form-item>
  31. <template slot="label">
  32. <a-tooltip>
  33. <template slot="title">
  34. <span>{{ i18n "reset" }}</span>
  35. </template>
  36. {{ i18n "pages.xray.wireguard.secretKey" }}
  37. <a-icon @click="[peer.publicKey, peer.privateKey] = Object.values(Wireguard.generateKeypair())" type="sync"></a-icon>
  38. </a-tooltip>
  39. </template>
  40. <a-input v-model.trim="peer.privateKey"></a-input>
  41. </a-form-item>
  42. <a-form-item>
  43. <template slot="label">
  44. {{ i18n "pages.xray.wireguard.publicKey" }}
  45. </template>
  46. <a-input v-model.trim="peer.publicKey"></a-input>
  47. </a-form-item>
  48. <a-form-item>
  49. <template slot="label">
  50. <a-tooltip>
  51. <template slot="title">
  52. <span>{{ i18n "reset" }}</span>
  53. </template>
  54. {{ i18n "pages.xray.wireguard.psk" }}
  55. <a-icon @click="peer.psk = Wireguard.keyToBase64(Wireguard.generatePresharedKey())" type="sync"></a-icon>
  56. </a-tooltip>
  57. </template>
  58. <a-input v-model.trim="peer.psk"></a-input>
  59. </a-form-item>
  60. <a-form-item>
  61. <template slot="label">
  62. {{ i18n "pages.xray.wireguard.allowedIPs" }}
  63. <a-button icon="plus" type="primary" size="small" @click="peer.allowedIPs.push('')"></a-button>
  64. </template>
  65. <template v-for="(aip, index) in peer.allowedIPs" style="margin-bottom: 10px;">
  66. <a-input v-model.trim="peer.allowedIPs[index]">
  67. <a-button icon="minus" v-if="peer.allowedIPs.length>1" slot="addonAfter" size="small" @click="peer.allowedIPs.splice(index, 1)"></a-button>
  68. </a-input>
  69. </template>
  70. </a-form-item>
  71. <a-form-item label='Keep Alive'>
  72. <a-input-number v-model.number="peer.keepAlive" :min="0"></a-input-number>
  73. </a-form-item>
  74. </a-form>
  75. </a-form>
  76. {{end}}