| 1 | <template> |
| 2 | <!-- XTCP Options --> |
| 3 | <ConfigSection title="XTCP Options" collapsible :readonly="readonly" |
| 4 | :has-value="form.protocol !== 'quic' || form.keepTunnelOpen || form.maxRetriesAnHour != null || form.minRetryInterval != null || !!form.fallbackTo || form.fallbackTimeoutMs != null"> |
| 5 | <ConfigField label="Protocol" type="select" v-model="form.protocol" |
| 6 | :options="[{ label: 'QUIC', value: 'quic' }, { label: 'KCP', value: 'kcp' }]" :readonly="readonly" /> |
| 7 | <ConfigField label="Keep Tunnel Open" type="switch" v-model="form.keepTunnelOpen" :readonly="readonly" /> |
| 8 | <div class="field-row two-col"> |
| 9 | <ConfigField label="Max Retries per Hour" type="number" v-model="form.maxRetriesAnHour" :min="0" :readonly="readonly" /> |
| 10 | <ConfigField label="Min Retry Interval (s)" type="number" v-model="form.minRetryInterval" :min="0" :readonly="readonly" /> |
| 11 | </div> |
| 12 | <div class="field-row two-col"> |
| 13 | <ConfigField label="Fallback To" type="text" v-model="form.fallbackTo" placeholder="Fallback visitor name" :readonly="readonly" /> |
| 14 | <ConfigField label="Fallback Timeout (ms)" type="number" v-model="form.fallbackTimeoutMs" :min="0" :readonly="readonly" /> |
| 15 | </div> |
| 16 | </ConfigSection> |
| 17 |
| 18 | <!-- NAT Traversal --> |
| 19 | <ConfigSection title="NAT Traversal" collapsible :readonly="readonly" |
| 20 | :has-value="form.natTraversalDisableAssistedAddrs"> |
| 21 | <ConfigField label="Disable Assisted Addresses" type="switch" v-model="form.natTraversalDisableAssistedAddrs" |
| 22 | tip="Only use STUN-discovered public addresses" :readonly="readonly" /> |
| 23 | </ConfigSection> |
| 24 | </template> |
| 25 |
| 26 | <script setup lang="ts"> |
| 27 | import { computed } from 'vue' |
| 28 | import type { VisitorFormData } from '../../types' |
| 29 | import ConfigSection from '../ConfigSection.vue' |
| 30 | import ConfigField from '../ConfigField.vue' |
| 31 |
| 32 | const props = withDefaults(defineProps<{ |
| 33 | modelValue: VisitorFormData |
| 34 | readonly?: boolean |
| 35 | }>(), { readonly: false }) |
| 36 |
| 37 | const emit = defineEmits<{ 'update:modelValue': [value: VisitorFormData] }>() |
| 38 |
| 39 | const form = computed({ |
| 40 | get: () => props.modelValue, |
| 41 | set: (val) => emit('update:modelValue', val), |
| 42 | }) |
| 43 | </script> |
| 44 |
| 45 | <style scoped lang="scss"> |
| 46 | @use '@/assets/css/form-layout'; |
| 47 | </style> |