Documentation ¶
Overview ¶
Package protocommon contains shared elements between ADC and NMDC connections.
Index ¶
- Constants
- Variables
- type BaseConn
- func (c *BaseConn) BinaryMode() bool
- func (c *BaseConn) Close() error
- func (c *BaseConn) DisableWriterZlib() error
- func (c *BaseConn) EnableReaderZlib() error
- func (c *BaseConn) EnableWriterZlib() error
- func (c *BaseConn) LogLevel() log.Level
- func (c *BaseConn) ReadBinary() ([]byte, error)
- func (c *BaseConn) ReadMessage() (string, error)
- func (c *BaseConn) RemoteLabel() string
- func (c *BaseConn) SetBinaryMode(val bool)
- func (c *BaseConn) SetSyncMode(val bool)
- func (c *BaseConn) Write(in []byte)
- func (c *BaseConn) WriteSync(in []byte) error
- type MsgBinary
- type MsgDecodable
- type MsgEncodable
Constants ¶
const ReStrIP = "[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}"
ReStrIP is the regex to parse an IPv4.
const ReStrNick = "[^\\$ \\|\n]+"
ReStrNick is the regex to parse a nickname.
const ReStrPort = "[0-9]{1,5}"
ReStrPort is the regex to parse a port.
Variables ¶
var ErrorTerminated = fmt.Errorf("terminated")
ErrorTerminated is raised when the connection is terminated.
Functions ¶
This section is empty.
Types ¶
type BaseConn ¶
type BaseConn struct {
// contains filtered or unexported fields
}
BaseConn is the base connection used by DC protocols.
func NewBaseConn ¶
func NewBaseConn(logLevel log.Level, remoteLabel string, nconn net.Conn, applyReadTimeout bool, applyWriteTimeout bool, msgDelim byte, ) *BaseConn
NewBaseConn allocates a BaseConn.
func (*BaseConn) BinaryMode ¶
BinaryMode returns the binary mode.
func (*BaseConn) DisableWriterZlib ¶
DisableWriterZlib disables zlib on writings.
func (*BaseConn) EnableReaderZlib ¶
EnableReaderZlib enables zlib on readings.
func (*BaseConn) EnableWriterZlib ¶
EnableWriterZlib enables zlib on writings.
func (*BaseConn) ReadBinary ¶
ReadBinary reads binary data.
func (*BaseConn) ReadMessage ¶
ReadMessage reads a message.
func (*BaseConn) RemoteLabel ¶
RemoteLabel returns the remote label.
func (*BaseConn) SetBinaryMode ¶
SetBinaryMode sets the binary mode.
func (*BaseConn) SetSyncMode ¶
SetSyncMode sets the sync mode.
type MsgDecodable ¶
type MsgDecodable interface{}
MsgDecodable is implemented by all decodable messages.
type MsgEncodable ¶
type MsgEncodable interface{}
MsgEncodable is implemented by all encodable messages.