MCPcopy Create free account
hub / github.com/bytebase/dbhub / validatePort

Function validatePort

src/utils/ssh-config-parser.ts:243–247  ·  view source on GitHub ↗

* Validate a port number and throw an error if invalid * @param port The port number to validate * @param jumpHostStr The original jump host string for error messages * @throws Error if port is invalid (NaN, <= 0, or > 65535)

(port: number, jumpHostStr: string)

Source from the content-addressed store, hash-verified

241 * @throws Error if port is invalid (NaN, <= 0, or > 65535)
242 */
243function validatePort(port: number, jumpHostStr: string): void {
244 if (isNaN(port) || port <= 0 || port > 65535) {
245 throw new Error(`Invalid port number in "${jumpHostStr}": port must be between 1 and 65535`);
246 }
247}
248
249/**
250 * Parse a jump host string in the format [user@]host[:port]

Callers 1

parseJumpHostFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected