feat: add custom IP selection for nodes, tunnels, and forwards

- Add extra_ips field to nodes for multi-IP servers
- Add connect_ip field to chain_tunnel for specifying connection address
- Add in_ip field to forward_port for specifying listen address
- Frontend: add UI controls for extra IPs on node form
- Frontend: add connect IP input for tunnel chain nodes
- Frontend: add listen IP input for forward form
- Backend: resolve forward ingress with custom listen IP priority

Entire-Checkpoint: 557563462c16
This commit is contained in:
sagitchu
2026-03-03 08:24:15 +08:00
parent 15e4508be4
commit b8193417f5
10 changed files with 255 additions and 87 deletions
+18 -1
View File
@@ -76,6 +76,7 @@ interface Node {
port: string;
tcpListenAddr?: string;
udpListenAddr?: string;
extraIPs?: string;
version?: string;
http?: number; // 0 关 1 开
tls?: number; // 0 关 1 开
@@ -99,7 +100,7 @@ interface Node {
rollbackLoading?: boolean;
}
interface NodeForm {
interface NodeForm {
id: number | null;
name: string;
serverHost: string;
@@ -109,6 +110,7 @@ interface NodeForm {
tcpListenAddr: string;
udpListenAddr: string;
interfaceName: string;
extraIPs: string;
http: number; // 0 关 1 开
tls: number; // 0 关 1 开
socks: number; // 0 关 1 开
@@ -183,6 +185,7 @@ export default function NodePage() {
tcpListenAddr: "[::]",
udpListenAddr: "[::]",
interfaceName: "",
extraIPs: "",
http: 0,
tls: 0,
socks: 0,
@@ -590,6 +593,7 @@ export default function NodePage() {
tcpListenAddr: node.tcpListenAddr || "[::]",
udpListenAddr: node.udpListenAddr || "[::]",
interfaceName: (node as any).interfaceName || "",
extraIPs: node.extraIPs || "",
http: typeof node.http === "number" ? node.http : 1,
tls: typeof node.tls === "number" ? node.tls : 1,
socks: typeof node.socks === "number" ? node.socks : 1,
@@ -817,6 +821,7 @@ export default function NodePage() {
const { serverHost, ...rest } = form;
const data = {
...rest,
extraIPs: form.extraIPs,
serverIp:
form.serverIpV4?.trim() ||
form.serverIpV6?.trim() ||
@@ -880,6 +885,7 @@ export default function NodePage() {
tcpListenAddr: "[::]",
udpListenAddr: "[::]",
interfaceName: "",
extraIPs: "",
http: 0,
tls: 0,
socks: 0,
@@ -1637,6 +1643,17 @@ export default function NodePage() {
}
/>
<Input
description="多IP服务器可填写额外IP地址,逗号分隔"
label="额外IP地址"
placeholder="例如: 192.168.1.100, 10.0.0.5"
value={form.extraIPs}
variant="bordered"
onChange={(e) =>
setForm((prev) => ({ ...prev, extraIPs: e.target.value }))
}
/>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<Input
errorMessage={errors.tcpListenAddr}