Documentation ¶
Overview ¶
Package pathsocket is a helper library to facilitate dealing with unix domain sockets and named pipes (unix domain socket on *nix and pipes on windows). It provides a unified abstraction on top, so code would compile and work fine on both family of operating systems.
Index ¶
- Variables
- func GetSocketPath(dir string, pipeName string) string
- func NewDialer(socketPath string, flags ...DialFlag) common.Upstream
- func NewListener(socketPath string, params string) (common.Listener, error)
- func RetrieveConnectionInfo(conn net.Conn) (any, error)
- type ContextKey
- type DialFlag
- type PathUpstream
- type ResolvedUcred
Constants ¶
This section is empty.
Variables ¶
var ( // PathCred is a context key that is used when saving Ucred information into the context. PathCred = &ContextKey{"path-creds"} )
Functions ¶
func GetSocketPath ¶
GetSocketPath is a helper function for unit tests so we can run them platform agnostic
func NewListener ¶
NewListener creates a new unix domain socket listener Params is platform specific and optional (empty string is ok). On unix, the following parameters are supported (separated by `:`): - permission (filemode e.g. 0660) - userName (e.g. root) - groupName (e.g. sudoers) The default permission is 0600. The default userName and groupName is "-" which means chown is not executed (the listener inode is owned by the current process).
func RetrieveConnectionInfo ¶
RetrieveConnectionInfo retrieves info about the connection. On unix, this returns *ResolvedUcred - ucred information along with the Uid and Gid resolved into their textual representation. On other platforms currently, it returns nil.
Types ¶
type ContextKey ¶
type ContextKey struct {
Name string
}
ContextKey is root type of info that is added into the context.
type DialFlag ¶
type DialFlag int
DialFlag allows customizing the dialing behaviour.
const ( // Grpc indicates that the upstream is a Grpc listener Grpc DialFlag = 1 )
type PathUpstream ¶
type PathUpstream struct {
// contains filtered or unexported fields
}
PathUpstream implements the Upstream interface to access the containerd listener.