MCPcopy
hub / github.com/coder/mux / makeConnectionKey

Function makeConnectionKey

src/node/runtime/sshConnectionPool.ts:645–656  ·  view source on GitHub ↗

* Generate stable key from config. * Identical configs produce identical keys. * Includes local username to prevent cross-user socket collisions.

(config: SSHConnectionConfig)

Source from the content-addressed store, hash-verified

643 * Includes local username to prevent cross-user socket collisions.
644 */
645function makeConnectionKey(config: SSHConnectionConfig): string {
646 // Note: srcBaseDir is intentionally excluded - connection identity is determined
647 // by user + host + port + key. This allows health tracking and multiplexing
648 // to be shared across workspaces on the same host.
649 const parts = [
650 os.userInfo().username, // Include local user to prevent cross-user collisions
651 config.host,
652 config.port?.toString() ?? "22",
653 config.identityFile ?? "default",
654 ];
655 return parts.join(":");
656}
657
658/**
659 * Generate deterministic hash for controlPath naming.

Callers 6

acquireConnectionMethod · 0.70
getConnectionHealthMethod · 0.70
resetBackoffMethod · 0.70
markHealthyMethod · 0.70
reportFailureMethod · 0.70
getControlPathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected