A net.Listener implementation leveraging Unix domain socket features to reliably identify client processes.
import "toolman.org/net/peercredlistener"
Package peercredlistener is deprecated in favor of toolman.org/net/peercred.
const ErrAddrInUse = unix.EADDRINUSE
ErrAddrInUse is a convenience wrapper around the Posix errno value for EADDRINUSE.
Deprecated: Use package toolman.org/net/peercred instead.
type PeerCredConn struct {
Ucred *unix.Ucred
net.Conn
}
PeerCredConn is a net.Conn containing the process credentials for the client
side of a Unix domain socket connection.
Deprecated: Use package toolman.org/net/peercred instead.
type PeerCredListener struct {
net.Listener
}
PeerCredListener is an implementation of net.Listener that extracts
the identity (i.e. pid, uid, gid) from the connection’s client process.
This information is then made available through the Ucred member of
the *PeerCredConn returned by AcceptPeerCred or Accept (after a type
assertion).
Deprecated: Use package toolman.org/net/peercred instead.
func New(ctx context.Context, addr string) (*PeerCredListener, error)
New returns a new PeerCredListener listening on the Unix domain socket addr.
Deprecated: Use package toolman.org/net/peercred instead.
func (pcl *PeerCredListener) Accept() (net.Conn, error)
Accept is a convenience wrapper around AcceptPeerCred allowing
PeerCredListener callers that utilize net.Listener to function
as expected. The returned net.Conn is a *PeerCredConn which may
be accessed through a type assertion. See AcceptPeerCred for
details on possible error conditions.
Accept contributes to implementing the net.Listener interface.
Deprecated: Use package toolman.org/net/peercred instead.
func (pcl *PeerCredListener) AcceptPeerCred() (*PeerCredConn, error)
AcceptPeerCred accepts a connection from the receiver’s listener
returning a *PeerCredConn containing the process credentials for
the client. If the underlying Accept fails or if process credentials
cannot be extracted, AcceptPeerCred returns nil and an error.
Deprecated: Use package toolman.org/net/peercred instead.