Documentation
¶
Overview ¶
Package channel provides implementations of the chirp.Channel interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Direct ¶
Direct constructs a connected pair of in-memory channels that pass packets directly without encoding into binary. Packets sent to A are received by B and vice versa.
func NetConn ¶ added in v0.1.3
NetConn returns the net.Conn impementation underlying c, if one is available, or else nil. If c implements NetConner its corresponding method will be called to locate a connection. If c == nil, NetConn reports nil.
The chirp.Channel retains ownership of any net.Conn that is returned. Note that sending or receiving data, or otherwise changing the state of the resulting connection may invalidate assumptions of the channel that uses it.
Types ¶
type IOChannel ¶
type IOChannel struct {
// contains filtered or unexported fields
}
An IOChannel sends and receives packets on a reader and a writer.
func IO ¶
func IO(r io.Reader, wc io.WriteCloser) IOChannel
IO constructs a channel that receives from r and sends to wc.
func (IOChannel) Close ¶
Close implements a method of the chirp.Channel interface.
func (IOChannel) NetConn ¶ added in v0.1.3
NetConn implements the optional NetConner interface. It returns a non-nil value if c was constructed with a net.Conn as its writer.
func (IOChannel) Recv ¶
Recv implements a method of the chirp.Channel interface.
type NetConner ¶ added in v0.1.3
NetConner is an optional interface that a chirp.Channel may implement to expose an underlying net.Conn used by its implementation. The method should report nil if its receiver does not have a net.Conn.
type Pipe ¶ added in v0.4.5
type Pipe struct {
// contains filtered or unexported fields
}
A Pipe implements the chirp.Channel interface around an os.Pipe.
func ConnectPipe ¶ added in v0.4.5
ConnectPipe constructs a new Pipe wrapping the specified files.
func NewPipe ¶ added in v0.4.10
NewPipe establishes a connected pair of os.Pipe for a pair of peers, and returns Pipe values wrapping them. Sends to A are received by B and vice versa. Each call to NewPipe returns a distinct pair of pipes.
func (*Pipe) Close ¶ added in v0.4.10
Close implements part of the chirp.Channel interface.
func (*Pipe) Recv ¶ added in v0.4.10
Recv implements part of the chirp.Channel interface.