Documentation ¶
Overview ¶
Package mux multiplexes a connection using gRPC (http2) streams. The gRPC server is started on a connection that can't be shared. When the client connects to the server the connection is meant to be persistent. Once the connection is establised the client can call NewStream and get multiple streams on a single connection allowing to multiplex the base channel.
Index ¶
- func NewConn(rwc io.ReadWriteCloser) net.Conn
- type Conn
- func (mc *Conn) Close() error
- func (mc *Conn) CloseRead() error
- func (mc *Conn) CloseWrite() error
- func (mc *Conn) LocalAddr() net.Addr
- func (mc *Conn) Read(b []byte) (int, error)
- func (mc *Conn) RemoteAddr() net.Addr
- func (mc *Conn) SetDeadline(t time.Time) error
- func (mc *Conn) SetReadDeadline(t time.Time) error
- func (mc *Conn) SetWriteDeadline(t time.Time) error
- func (mc *Conn) Write(b []byte) (int, error)
- type ConnBuilder
- type Listener
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Conn ¶
type Conn struct {
io.ReadWriteCloser
}
Conn implements net.Conn interface on a ReadWriteCloser.
func (*Conn) CloseRead ¶
CloseRead closes the read side of the ReadWriteCloser if it implements CloseRead, otherwise it closes the closer.
func (*Conn) CloseWrite ¶
CloseWrite closes the write side of the ReadWriteCloser if it implements CloseWrite, otherwise it closes the closer.
func (*Conn) SetDeadline ¶
SetDeadline -> unimplemented, calling it returns an error.
func (*Conn) SetReadDeadline ¶
SetReadDeadline -> unimplemented, calling it returns an error.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline -> unimplemented, calling it returns an error.
type ConnBuilder ¶
type ConnBuilder struct {
// contains filtered or unexported fields
}
ConnBuilder create new connections multiplexed throug gRPC.
func NewConnBuilder ¶
func NewConnBuilder(ctx context.Context, rwc io.ReadWriteCloser) (*ConnBuilder, error)
NewConnBuilder creates a ConnBuilder using a base ReadWriteCloser.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener implements net.Listener multiplexed over a gRPC connection
func NewListener ¶
func NewListener(f io.ReadWriteCloser) *Listener
NewListener returns a Listener backed by gRPC service.
type Message ¶
type Message struct{}
Message implements stream.MessageReadWriteCloser interface
func (Message) BuildMsg ¶
func (sm Message) BuildMsg() interface{}
BuildMsg returns a new message that can be sent through a forwarding stream.
func (Message) CloseMsg ¶
func (sm Message) CloseMsg() interface{}
CloseMsg returns a new message to notify the other side that the stream is closed.