fix(inbounds): drop listen address from auto-generated inbound tag

A non-empty, non-any Address (listen) leaked into the tag as
in-<listen>:<port>-<transport> (e.g. in-127.0.0.1:443-tcp). The tag is
now always in-<port>-<transport>, with the node prefix and numeric dedup
suffix still handling uniqueness across nodes and same-port/different-listen
inbounds. Mirrored in the Go authority and the TS form preview, kept in
parity by tests.

Existing colon-form tags are now treated as custom, so editing such an
inbound preserves its tag rather than rewriting it; new inbounds (or a
cleared tag field) get the clean form.
This commit is contained in:
MHSanaei
2026-06-01 09:33:49 +02:00
parent 48f470c465
commit a3dca4b82d
6 changed files with 33 additions and 45 deletions
+3 -8
View File
@@ -49,12 +49,8 @@ function transportTagSuffix(bits: TransportBits): string {
return 'any';
}
function isAnyListen(listen: string): boolean {
return listen === '' || listen === '0.0.0.0' || listen === '::' || listen === '::0';
}
function baseInboundTag(listen: string, port: number): string {
return isAnyListen(listen) ? `in-${port}` : `in-${listen}:${port}`;
function baseInboundTag(port: number): string {
return `in-${port}`;
}
function nodeTagPrefix(nodeId: number | null | undefined): string {
@@ -62,7 +58,6 @@ function nodeTagPrefix(nodeId: number | null | undefined): string {
}
export interface InboundTagInput {
listen: string;
port: number;
nodeId: number | null | undefined;
protocol: string;
@@ -74,7 +69,7 @@ export function composeInboundTag(input: InboundTagInput): string {
const bits = inboundTransports(input.protocol, input.streamSettings, input.settings);
return (
nodeTagPrefix(input.nodeId)
+ baseInboundTag(input.listen ?? '', input.port ?? 0)
+ baseInboundTag(input.port ?? 0)
+ '-'
+ transportTagSuffix(bits)
);