Versions in this module Expand all Collapse all v1 v1.1.2 Mar 20, 2024 Changes in this version + const FreePortAddress + func GetFreePort() (port int, err error) + func GetFreePorts(count int) (ports []int, err error) + func LoadKeyCrt(crtFile, keyFile string) (*tls.Config, error) + func MustGetFreePort() int + func NewNetConn(address string, timeout ...time.Duration) (net.Conn, error) + func NewNetConnKeyCrt(addr, crtFile, keyFile string, timeout ...time.Duration) (net.Conn, error) + func NewNetConnTLS(address string, tlsConfig *tls.Config, timeout ...time.Duration) (net.Conn, error) + func Send(address string, data []byte, retry ...Retry) error + func SendPkg(address string, data []byte, option ...PkgOption) error + func SendPkgWithTimeout(address string, data []byte, timeout time.Duration, option ...PkgOption) error + func SendRecv(address string, data []byte, length int, retry ...Retry) ([]byte, error) + func SendRecvPkg(address string, data []byte, option ...PkgOption) ([]byte, error) + func SendRecvPkgWithTimeout(address string, data []byte, timeout time.Duration, option ...PkgOption) ([]byte, error) + func SendRecvWithTimeout(address string, data []byte, receive int, timeout time.Duration, ...) ([]byte, error) + func SendWithTimeout(address string, data []byte, timeout time.Duration, retry ...Retry) error + type Conn struct + func NewConn(addr string, timeout ...time.Duration) (*Conn, error) + func NewConnByNetConn(conn net.Conn) *Conn + func NewConnKeyCrt(addr, crtFile, keyFile string) (*Conn, error) + func NewConnTLS(addr string, tlsConfig *tls.Config) (*Conn, error) + func (c *Conn) Recv(length int, retry ...Retry) ([]byte, error) + func (c *Conn) RecvLine(retry ...Retry) ([]byte, error) + func (c *Conn) RecvPkg(option ...PkgOption) (result []byte, err error) + func (c *Conn) RecvPkgWithTimeout(timeout time.Duration, option ...PkgOption) (data []byte, err error) + func (c *Conn) RecvTill(til []byte, retry ...Retry) ([]byte, error) + func (c *Conn) RecvWithTimeout(length int, timeout time.Duration, retry ...Retry) (data []byte, err error) + func (c *Conn) Send(data []byte, retry ...Retry) error + func (c *Conn) SendPkg(data []byte, option ...PkgOption) error + func (c *Conn) SendPkgWithTimeout(data []byte, timeout time.Duration, option ...PkgOption) (err error) + func (c *Conn) SendRecv(data []byte, length int, retry ...Retry) ([]byte, error) + func (c *Conn) SendRecvPkg(data []byte, option ...PkgOption) ([]byte, error) + func (c *Conn) SendRecvPkgWithTimeout(data []byte, timeout time.Duration, option ...PkgOption) ([]byte, error) + func (c *Conn) SendRecvWithTimeout(data []byte, length int, timeout time.Duration, retry ...Retry) ([]byte, error) + func (c *Conn) SendWithTimeout(data []byte, timeout time.Duration, retry ...Retry) (err error) + func (c *Conn) SetBufferWaitRecv(bufferWaitDuration time.Duration) + func (c *Conn) SetDeadline(t time.Time) (err error) + func (c *Conn) SetDeadlineRecv(t time.Time) (err error) + func (c *Conn) SetDeadlineSend(t time.Time) (err error) + type PkgOption struct + HeaderSize int + MaxDataSize int + Retry Retry + type PoolConn struct + func NewPoolConn(addr string, timeout ...time.Duration) (*PoolConn, error) + func (c *PoolConn) Close() error + func (c *PoolConn) Recv(length int, retry ...Retry) ([]byte, error) + func (c *PoolConn) RecvLine(retry ...Retry) ([]byte, error) + func (c *PoolConn) RecvPkg(option ...PkgOption) ([]byte, error) + func (c *PoolConn) RecvPkgWithTimeout(timeout time.Duration, option ...PkgOption) (data []byte, err error) + func (c *PoolConn) RecvTill(til []byte, retry ...Retry) ([]byte, error) + func (c *PoolConn) RecvWithTimeout(length int, timeout time.Duration, retry ...Retry) (data []byte, err error) + func (c *PoolConn) Send(data []byte, retry ...Retry) error + func (c *PoolConn) SendPkg(data []byte, option ...PkgOption) (err error) + func (c *PoolConn) SendPkgWithTimeout(data []byte, timeout time.Duration, option ...PkgOption) (err error) + func (c *PoolConn) SendRecv(data []byte, receive int, retry ...Retry) ([]byte, error) + func (c *PoolConn) SendRecvPkg(data []byte, option ...PkgOption) ([]byte, error) + func (c *PoolConn) SendRecvPkgWithTimeout(data []byte, timeout time.Duration, option ...PkgOption) ([]byte, error) + func (c *PoolConn) SendRecvWithTimeout(data []byte, receive int, timeout time.Duration, retry ...Retry) ([]byte, error) + func (c *PoolConn) SendWithTimeout(data []byte, timeout time.Duration, retry ...Retry) (err error) + type Retry struct + Count int + Interval time.Duration + type Server struct + func GetServer(name ...interface{}) *Server + func NewServer(address string, handler func(*Conn), name ...string) *Server + func NewServerKeyCrt(address, crtFile, keyFile string, handler func(*Conn), name ...string) (*Server, error) + func NewServerTLS(address string, tlsConfig *tls.Config, handler func(*Conn), name ...string) *Server + func (s *Server) Close() error + func (s *Server) GetAddress() string + func (s *Server) GetListenedAddress() string + func (s *Server) GetListenedPort() int + func (s *Server) Run() (err error) + func (s *Server) SetAddress(address string) + func (s *Server) SetHandler(handler func(*Conn)) + func (s *Server) SetTLSConfig(tlsConfig *tls.Config) + func (s *Server) SetTLSKeyCrt(crtFile, keyFile string) error