feat: add outbound interface binding

This commit is contained in:
lbl
2026-08-22 07:58:18 +08:00
parent 55d47c5a1c
commit 74c47bce69
29 changed files with 562 additions and 74 deletions
+11
View File
@@ -19,6 +19,7 @@ export const emptyFormData = () => ({
device_name: "",
device_id: "",
tun_name: "",
outbound_interface: "",
password: "",
cert_mode: "skip",
fingerprint: "",
@@ -95,6 +96,9 @@ export const parseTomlToForm = (toml) => {
} else if (trimmed.includes("tun_name")) {
const match = trimmed.match(/tun_name\s*=\s*"([^"]*)"/);
if (match) data.tun_name = match[1];
} else if (trimmed.includes("outbound_interface")) {
const match = trimmed.match(/outbound_interface\s*=\s*"([^"]*)"/);
if (match) data.outbound_interface = match[1];
} else if (trimmed.includes("password =")) {
const match = trimmed.match(/password\s*=\s*"([^"]*)"/);
if (match) data.password = match[1];
@@ -231,6 +235,10 @@ export const formToToml = (formData) => {
toml += "\n# 虚拟网卡名称\n";
toml += `tun_name = "${formData.tun_name}"\n`;
}
if (formData.outbound_interface) {
toml += "\n# 绑定对外通信 Socket 的出口网卡名称(用于服务端通信、P2P 打洞及转发流量)\n";
toml += `outbound_interface = "${formData.outbound_interface}"\n`;
}
toml += "\n# --- 安全配置 ---\n";
if (formData.password) {
@@ -331,6 +339,9 @@ server = ["quic://1.2.3.4:29872"]
# 虚拟网卡名称
# tun_name = "vnt-tun"
# 绑定对外通信 Socket 的出口网卡名称(例如 Ethernet、Wi-Fi、eth0
# outbound_interface = "Ethernet"
# --- 安全配置 ---
# 加密密码 (可选)
+11 -1
View File
@@ -515,7 +515,7 @@ const sectionTitleClass = "text-md mb-4 flex items-center font-bold text-slate-9
</svg>
设备配置
</h4>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-4">
<div>
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">设备名称</label>
<input v-model="formData.device_name" type="text" placeholder="默认为主机名" class="input" />
@@ -528,6 +528,16 @@ const sectionTitleClass = "text-md mb-4 flex items-center font-bold text-slate-9
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">虚拟网卡名</label>
<input v-model="formData.tun_name" type="text" placeholder="默认为vnt-tun" class="input" />
</div>
<div>
<label class="mb-2 block text-sm font-medium text-slate-600 dark:text-slate-300">绑定出口网卡</label>
<input
v-model="formData.outbound_interface"
type="text"
placeholder="例如 Ethernet、Wi-Fi、eth0"
class="input"
/>
<p class="mt-1.5 text-xs leading-5 text-slate-400">服务端通信P2P 打洞及转发流量将使用此网卡</p>
</div>
</div>
</div>