Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Conf = struct { // The newly created stream has a higher write priority. FastWriteDuration time.Duration // The duration a connection needs to be idle before mux begins sending out keep-alive probe. IdleProbeDuration time.Duration // If no data is read for more than this time, the connection is closed. IdleReplyDuration time.Duration // Packet size. Since the size of the packet header is 4, this value must be greater than 4. If the value is too // small, the transmission efficiency will be reduced, and if it is too large, the concurrency capability of mux // will be reduced. PacketSize int }{ FastWriteDuration: time.Second * 16, IdleProbeDuration: time.Second * 32, IdleReplyDuration: time.Second * 48, PacketSize: 2048, }
Conf is acting as package level configuration.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client implemented the czar protocol.
func NewClient ¶
NewClient returns a new Client. Cipher is a password in string form, with no length limit.
type Err ¶
type Err struct {
// contains filtered or unexported fields
}
Err is an object that will only store an error once.
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux is used to wrap a reliable ordered connection and to multiplex it into multiple streams.
func NewMuxClient ¶
func NewMuxClient(conn io.ReadWriteCloser) *Mux
NewMuxClient returns a new MuxClient.
func NewMuxServer ¶
func NewMuxServer(conn io.ReadWriteCloser) *Mux
NewMuxServer returns a new MuxServer.
func (*Mux) Accept ¶
Accept is used to block until the next available stream is ready to be accepted.
func (*Mux) Close ¶
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
type Server ¶
Server implemented the czar protocol.
type Sip ¶
type Sip struct {
// contains filtered or unexported fields
}
A stream id generator. Stream id can be reused, and the smallest available stream id is guaranteed to be generated each time.