type Protocol … const TCP … const UDP … type LocalPort … // NewLocalPort returns a LocalPort instance and ensures IPFamily and IP are // consistent and that the given protocol is valid. func NewLocalPort(desc, ip string, ipFamily IPFamily, port int, protocol Protocol) (*LocalPort, error) { … } func (lp *LocalPort) String() string { … } type Closeable … type PortOpener … type listenPortOpener … var ListenPortOpener … // OpenLocalPort holds the given local port open. func (l *listenPortOpener) OpenLocalPort(lp *LocalPort) (Closeable, error) { … } func openLocalPort(lp *LocalPort) (Closeable, error) { … }