unixsocket

package
v0.0.0-...-9ba4394 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

package unixsocket implements type Usock which supports out-of-band transfer of open files. The API is {Read,Write}{FD,Message}. Messages are buffered in both directions.

When ReadFD is called, it will interpret the first queued OOB datum already received, if any. Otherwise it will attempt to receive OOB data from the next packet. The packet will be assumed to be a UnixRights message, granting access to an open file from another process, and will be decoded as such.

ReadFD will not always block if called in a scenario where there is pending data but no OOB data in the first pending packet. This situation is undefined (realistically, currently un-thought-about, as zeus has a very regular protocol that obviates this concern).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetZeusSockName

func SetZeusSockName(n string)

SetZeusSockName sets the socket name used for zeus clients. It is primarily exposed for testing purpose and is not safe to modify after Zeus has started.

func Socketpair

func Socketpair(typ int) (a, b *os.File, err error)

func ZeusSockName

func ZeusSockName() string

Types

type Usock

type Usock struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(conn *net.UnixConn) *Usock

func NewFromFile

func NewFromFile(f *os.File) (*Usock, error)

func (*Usock) Close

func (u *Usock) Close()

func (*Usock) ReadFD

func (u *Usock) ReadFD() (int, error)

func (*Usock) ReadMessage

func (u *Usock) ReadMessage() (s string, err error)

func (*Usock) WriteFD

func (u *Usock) WriteFD(fd int) error

func (*Usock) WriteMessage

func (u *Usock) WriteMessage(msg string) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL