支持设置端口

This commit is contained in:
lbl
2026-02-28 17:49:11 +08:00
parent 5a31ad89f4
commit 2aa423062e
7 changed files with 78 additions and 85 deletions
+2
View File
@@ -195,6 +195,7 @@ pub struct StartConfig {
pub udp_stun: Vec<String>,
#[serde(default)]
pub tcp_stun: Vec<String>,
pub tunnel_port: Option<u16>,
}
#[derive(Deserialize)]
@@ -955,6 +956,7 @@ fn convert_config(cfg: StartConfig) -> anyhow::Result<CoreConfig> {
udp_stun,
tcp_stun,
fec: cfg.fec,
tunnel_port: cfg.tunnel_port,
})
}
+11 -3
View File
@@ -985,6 +985,11 @@
<input v-model.number="formData.mtu" type="number" placeholder="1380"
class="w-full bg-slate-800 border border-slate-600 rounded-lg px-3 py-2 text-white placeholder-slate-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent">
</div>
<div>
<label class="block text-sm font-medium text-slate-300 mb-2">隧道端口</label>
<input v-model.number="formData.tunnel_port" type="number" placeholder="0 (自动分配)"
class="w-full bg-slate-800 border border-slate-600 rounded-lg px-3 py-2 text-white placeholder-slate-500 focus:ring-2 focus:ring-blue-500 focus:border-transparent">
</div>
</div>
</div>
@@ -1742,7 +1747,8 @@
cert_mode: "skip",
fingerprint: "",
udp_stun: [],
tcp_stun: []
tcp_stun: [],
tunnel_port: null
});
// 从TOML解析到表单
@@ -1770,7 +1776,8 @@
cert_mode: "skip",
fingerprint: "",
udp_stun: [],
tcp_stun: []
tcp_stun: [],
tunnel_port: null
};
const lines = toml.split('\n');
@@ -2106,7 +2113,8 @@
cert_mode: "skip",
fingerprint: "",
udp_stun: [],
tcp_stun: []
tcp_stun: [],
tunnel_port: null
};
editorContent.value = `# config_name = "配置名称"
# --- 网络配置 ---