Documentation
¶
Overview ¶
Package ports provides port-holder identification utilities for the nSelf CLI. It augments the raw TCP port probing in internal/docker with process-level information so that conflict error messages name the offending process.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatConflictMessage ¶
FormatConflictMessage formats a human-readable port conflict error message. Example: "port 5432 is held by postgres (pid 1234) — stop it or change POSTGRES_PORT" If holder is nil (port is free or detection unavailable), the message omits holder info.
Types ¶
type Holder ¶
type Holder struct {
PID int
Name string // process name (short, e.g. "postgres")
Command string // full command line
IsOurs bool // true if the holder is one of our own Docker containers
}
Holder describes the process that is listening on a TCP port.
func WhoHoldsPort ¶
WhoHoldsPort returns the process holding the given TCP port. Returns nil (not an error) if the port is free or if holder detection is unavailable on the current platform (e.g. lsof/ss not installed). A non-nil error is returned only for unexpected failures after a holder was partially identified.