项目作者: tep

项目描述 :
A net.Listener implementation leveraging Unix domain socket features to reliably identify client processes.
高级语言: Go
项目地址: git://github.com/tep/net-peercredlistener.git
创建时间: 2019-05-25T23:19:11Z
项目社区:https://github.com/tep/net-peercredlistener

开源协议:MIT License

下载


peercredlistener

import "toolman.org/net/peercredlistener"

Overview" class="reference-link">Overview

Package peercredlistener is deprecated in favor of toolman.org/net/peercred.

Index" class="reference-link">Index

Package files" class="reference-link">Package files

listener.go

Constants" class="reference-link">Constants

  1. 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

  1. type PeerCredConn struct {
  2. Ucred *unix.Ucred
  3. net.Conn
  4. }

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

  1. type PeerCredListener struct {
  2. net.Listener
  3. }

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

  1. 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 (*PeerCredListener) Accept

  1. 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 (*PeerCredListener) AcceptPeerCred

  1. 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.