fallbacks.html 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {{define "form/fallbacks"}}
  2. <div :style="{ display: 'flex', alignItems: 'center', flexWrap: 'wrap', gap: '8px', margin: '8px 0' }">
  3. <span :style="{ fontWeight: 500 }">
  4. <a-tooltip title="Route incoming TLS traffic to a backend when it doesn't match a valid VLESS/Trojan handshake. Match by SNI, ALPN, and HTTP path; the most precise rule wins. Fallbacks require TCP+TLS transport.">
  5. Fallbacks ([[ inbound.settings.fallbacks.length ]])
  6. <a-icon type="question-circle"></a-icon>
  7. </a-tooltip>
  8. </span>
  9. <span :style="{ flex: 1 }"></span>
  10. <a-button icon="plus" type="primary" size="small" @click="inbound.settings.addFallback()">Add</a-button>
  11. </div>
  12. <a-form v-for="(fallback, index) in inbound.settings.fallbacks" :colon="false"
  13. :label-col="{ md: {span:8} }" :wrapper-col="{ md: {span:14} }">
  14. <a-divider :style="{ margin: '0' }">
  15. Fallback [[ index + 1 ]]
  16. <a-icon type="delete" @click="() => inbound.settings.delFallback(index)"
  17. :style="{ color: 'rgb(255, 77, 79)', cursor: 'pointer', marginLeft: '6px' }"></a-icon>
  18. </a-divider>
  19. <a-form-item>
  20. <template slot="label">
  21. <a-tooltip title="Match TLS SNI (server name). Leave empty to match any SNI.">
  22. SNI <a-icon type="question-circle"></a-icon>
  23. </a-tooltip>
  24. </template>
  25. <a-input v-model.trim="fallback.name" placeholder="any (leave empty)"></a-input>
  26. </a-form-item>
  27. <a-form-item>
  28. <template slot="label">
  29. <a-tooltip title="Match TLS ALPN. 'any' = no ALPN constraint. Use h2/http/1.1 split when the inbound advertises both.">
  30. ALPN <a-icon type="question-circle"></a-icon>
  31. </a-tooltip>
  32. </template>
  33. <a-select v-model="fallback.alpn" :style="{ width: '100%' }">
  34. <a-select-option value="">any</a-select-option>
  35. <a-select-option value="h2">h2</a-select-option>
  36. <a-select-option value="http/1.1">http/1.1</a-select-option>
  37. </a-select>
  38. </a-form-item>
  39. <a-form-item
  40. :validate-status="fallback.path && !fallback.path.startsWith('/') ? 'error' : ''"
  41. :help="fallback.path && !fallback.path.startsWith('/') ? 'Path must start with /' : ''">
  42. <template slot="label">
  43. <a-tooltip title="Match the HTTP request path of the first packet. Must start with '/'. Leave empty to match any.">
  44. Path <a-icon type="question-circle"></a-icon>
  45. </a-tooltip>
  46. </template>
  47. <a-input v-model.trim="fallback.path" placeholder="any (leave empty) or /ws"></a-input>
  48. </a-form-item>
  49. <a-form-item
  50. :validate-status="!fallback.dest ? 'error' : ''"
  51. :help="!fallback.dest ? 'Destination is required' : ''">
  52. <template slot="label">
  53. <a-tooltip>
  54. <template slot="title">
  55. <span>
  56. Where matching traffic is forwarded. Accepts a port number (<code>80</code>),
  57. an <code>addr:port</code> (<code>127.0.0.1:8080</code>), or a Unix socket path
  58. (<code>/dev/shm/x.sock</code> or <code>@abstract</code>).
  59. </span>
  60. </template>
  61. Destination <a-icon type="question-circle"></a-icon>
  62. </a-tooltip>
  63. </template>
  64. <a-input v-model.trim="fallback.dest" placeholder="80 | 127.0.0.1:8080 | /dev/shm/x.sock"></a-input>
  65. </a-form-item>
  66. <a-form-item>
  67. <template slot="label">
  68. <a-tooltip title="PROXY protocol version sent to the destination. Off (0) for plain TCP; v1/v2 to preserve client IP if the backend supports it.">
  69. PROXY <a-icon type="question-circle"></a-icon>
  70. </a-tooltip>
  71. </template>
  72. <a-select v-model="fallback.xver" :style="{ width: '100%' }">
  73. <a-select-option :value="0">Off</a-select-option>
  74. <a-select-option :value="1">v1</a-select-option>
  75. <a-select-option :value="2">v2</a-select-option>
  76. </a-select>
  77. </a-form-item>
  78. </a-form>
  79. {{end}}