Documentation ¶
Index ¶
- Constants
- func Connect(ctx *UnixConn, name string) (net.Conn, error)
- func Copy(dst Sender, src Receiver) (int, error)
- func FdConn(fd int) (n *net.UnixConn, err error)
- func Listen(conn Sender, name string) (net.Listener, error)
- func MsgDesc(payload []byte, attachment *os.File) string
- func SendRPipe(dst Sender, data []byte) (*os.File, error)
- func SendWPipe(dst Sender, data []byte) (*os.File, error)
- func SocketPair() (a *os.File, b *os.File, err error)
- func USocketPair() (*UnixConn, *UnixConn, error)
- type ReceiveCloser
- type ReceiveSender
- type Receiver
- type Route
- func (r *Route) All() *Route
- func (r *Route) Filter(f func([]byte, *os.File) bool) *Route
- func (route *Route) Handle(payload []byte, attachment *os.File) error
- func (r *Route) Handler(h func([]byte, *os.File) error) *Route
- func (r *Route) HasAttachment() *Route
- func (r *Route) KeyEquals(k string, full ...string) *Route
- func (r *Route) KeyExists(k string) *Route
- func (r *Route) KeyIncludes(k, v string) *Route
- func (r *Route) KeyStartsWith(k string, beginning ...string) *Route
- func (route *Route) Match(payload []byte, attachment *os.File) bool
- func (r *Route) NoKey(k string) *Route
- func (r *Route) Passthrough(dst Sender) *Route
- func (route *Route) Tee(dst Sender) *Route
- type Router
- type SendCloser
- type Sender
- type UnixConn
Constants ¶
const ( R = iota W )
Variables ¶
This section is empty.
Functions ¶
func FdConn ¶
FdConn wraps a file descriptor in a standard *net.UnixConn object, or returns an error if the file descriptor does not point to a unix socket. This creates a duplicate file descriptor. It's the caller's responsibility to close both.
func Listen ¶
Listen is a convenience interface for applications to create service endpoints which can be easily used with existing networking code.
Listen registers a new service endpoint on the beam connection `conn`, using the service name `name`. It returns a listener which can be used in the usual way. Calling Accept() on the listener will block until a new connection is available on the service endpoint. The endpoint is then returned as a regular net.Conn and can be used as a regular network connection.
Note that if the underlying file descriptor received in attachment is nil or does not point to a connection, that message will be skipped.
func MsgDesc ¶
MsgDesc returns a human readable description of a beam message, usually for debugging purposes.
func SendRPipe ¶ added in v0.12.0
SendRPipe create a pipe and sends its *read* end attached in a beam message to `dst`, with `data` as the message payload. It returns the *write* end of the pipe, or an error.
func SendWPipe ¶ added in v0.12.0
SendWPipe create a pipe and sends its *read* end attached in a beam message to `dst`, with `data` as the message payload. It returns the *write* end of the pipe, or an error.
func SocketPair ¶
SocketPair is a convenience wrapper around the socketpair(2) syscall. It returns a unix socket of type SOCK_STREAM in the form of 2 file descriptors not bound to the underlying filesystem. Messages sent on one end are received on the other, and vice-versa. It is the caller's responsibility to close both ends.
func USocketPair ¶
Types ¶
type ReceiveCloser ¶
type ReceiveSender ¶
func Devnull ¶
func Devnull() ReceiveSender
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
func (*Route) HasAttachment ¶
func (*Route) KeyIncludes ¶
func (*Route) Passthrough ¶
type SendCloser ¶
type UnixConn ¶
func (*UnixConn) Receive ¶
Receive waits for a new message on conn, and receives its payload and attachment, or an error if any.
If more than 1 file descriptor is sent in the message, they are all closed except for the first, which is the attachment. It is legal for a message to have no attachment or an empty payload.