Documentation ¶
Index ¶
Constants ¶
View Source
const ( PT_SIZE = uint32(512) // packet len in byte PT_SIZE_BYTE_LEN = 4 // packet len value in bits )
View Source
const ( IP_PROTOCOL = "ipv4" DEFAULT_POOL_SIZE = 10 )
Variables ¶
View Source
var ( CustomHandleConn = func(c *TCPConnection, packet []byte) { logs.Warn("forget rrserver.CustomHandleConn = YourCustomHandleConn in init func?") } )
View Source
var (
ErrClosed = fmt.Errorf("pool not created or closed")
)
Functions ¶
Types ¶
type TCPConnection ¶
type TCPConnection struct {
// contains filtered or unexported fields
}
func NewTCPConnection ¶
func NewTCPConnection(conn net.Conn) *TCPConnection
func (*TCPConnection) Close ¶
func (c *TCPConnection) Close() error
func (*TCPConnection) LocalAddr ¶
func (c *TCPConnection) LocalAddr() string
func (*TCPConnection) Read ¶
func (c *TCPConnection) Read() (error, []byte)
func (*TCPConnection) RemoteAddr ¶
func (c *TCPConnection) RemoteAddr() string
func (*TCPConnection) SetKeepAlive ¶
func (c *TCPConnection) SetKeepAlive(v bool) error
func (*TCPConnection) Write ¶
func (c *TCPConnection) Write(msg []byte) error
type TCPConnectionPool ¶
type TCPConnectionPool struct {
// contains filtered or unexported fields
}
func CreateTCPConnectionPool ¶
func CreateTCPConnectionPool(poolSize int) *TCPConnectionPool
func (*TCPConnectionPool) Add ¶
func (s *TCPConnectionPool) Add(addr string, c *TCPConnection) error
func (*TCPConnectionPool) CloseAll ¶
func (s *TCPConnectionPool) CloseAll(addr string)
func (*TCPConnectionPool) Get ¶
func (s *TCPConnectionPool) Get(addr string) (error, *TCPConnection)
type TCPServer ¶
type TCPServer struct {
// contains filtered or unexported fields
}
func CreateTCPServerByAddr ¶
Click to show internal directories.
Click to hide internal directories.