* Whether a ProxyJump token carries an explicit `:port` (vs. relying on the * default). Handles an optional `user@` prefix and bracketed IPv6 (`[host]:port`).
(token: string)
| 419 | * default). Handles an optional `user@` prefix and bracketed IPv6 (`[host]:port`). |
| 420 | */ |
| 421 | function tokenHasExplicitPort(token: string): boolean { |
| 422 | const atIndex = token.indexOf('@'); |
| 423 | const hostPart = atIndex !== -1 ? token.slice(atIndex + 1) : token; |
| 424 | return hostPart.startsWith('[') ? /\]:\d+$/.test(hostPart) : /:\d+$/.test(hostPart); |
| 425 | } |