impl

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2022 License: MulanPSL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HeaderMinLength = 0
View Source
var UDPHeaderMinLength = 0

Functions

func DialTCP

func DialTCP(config interface{}, fc conn.FRecvChan) (conn.Connection, error)

参数config应为*TCPConfig

func DialUDP

func DialUDP(config interface{}, fc conn.FRecvChan) (conn.Connection, error)

func NewTCPListener

func NewTCPListener(oc interface{}) (conn.Listener, error)

func NewUDPListener

func NewUDPListener(oc interface{}) (conn.Listener, error)

Types

type TCPConfig

type TCPConfig struct {
	ListenAddress string `json:"listenAddress,omitempty"`
	BufferLength  int    `json:"bufferLength,omitempty"`

	WriteTimeoutMS int `json:"writeTimeoutMS,omitempty"`
	DialTimeoutMS  int `json:"dialTimeoutMS,omitempty"`
}

func DefaultTCPConfig

func DefaultTCPConfig() *TCPConfig

type TCPConnection

type TCPConnection struct {
	// contains filtered or unexported fields
}

func (*TCPConnection) BindOwner

func (c *TCPConnection) BindOwner(o conn.ConnectionOwner)

func (*TCPConnection) Close

func (c *TCPConnection) Close()

func (*TCPConnection) ConfoundCode

func (c *TCPConnection) ConfoundCode() []byte

func (*TCPConnection) Done

func (c *TCPConnection) Done() <-chan struct{}

func (*TCPConnection) Owner

func (c *TCPConnection) Owner() conn.ConnectionOwner

func (*TCPConnection) RecvChan

func (c *TCPConnection) RecvChan() <-chan *protocol.Packet

func (*TCPConnection) Remote

func (c *TCPConnection) Remote() net.Addr

func (*TCPConnection) Send

func (c *TCPConnection) Send(pac *protocol.Packet) error

func (*TCPConnection) SetConfoundCode

func (c *TCPConnection) SetConfoundCode(code []byte)

func (*TCPConnection) Start

func (c *TCPConnection) Start(s *conn.Sender) error

type TCPListener

type TCPListener struct {
	// contains filtered or unexported fields
}

func (*TCPListener) Accept

func (lis *TCPListener) Accept(fc conn.FRecvChan) (conn.Connection, error)

func (*TCPListener) Addr

func (lis *TCPListener) Addr() net.Addr

func (*TCPListener) Close

func (lis *TCPListener) Close()

type UDPConfig

type UDPConfig struct {
	ListenAddress   string `json:"listenAddress,omitempty"`
	ReceiveGoNum    int    `json:"receiveGoNum,omitempty"`
	DialTimeoutMS   int    `json:"dialTimeoutMS,omitempty"`
	ActiveTimeoutMS int    `json:"activeTimeoutMS,omitempty"`

	MTUBufferLength int    `json:"mtuBufferLength,omitempty"`
	SignCode        string `json:"signCode,omitempty"`
}

func DefaultUDPConfig

func DefaultUDPConfig() *UDPConfig

type UDPConnection

type UDPConnection struct {
	// contains filtered or unexported fields
}

func (*UDPConnection) BindOwner

func (c *UDPConnection) BindOwner(o conn.ConnectionOwner)

func (*UDPConnection) Close

func (c *UDPConnection) Close()

func (*UDPConnection) ConfoundCode

func (c *UDPConnection) ConfoundCode() []byte

func (*UDPConnection) Done

func (c *UDPConnection) Done() <-chan struct{}

func (*UDPConnection) Owner

func (c *UDPConnection) Owner() conn.ConnectionOwner

func (*UDPConnection) RecvChan

func (c *UDPConnection) RecvChan() <-chan *protocol.Packet

func (*UDPConnection) Remote

func (c *UDPConnection) Remote() net.Addr

func (*UDPConnection) Send

func (c *UDPConnection) Send(pac *protocol.Packet) error

func (*UDPConnection) SetConfoundCode

func (c *UDPConnection) SetConfoundCode(code []byte)

func (*UDPConnection) Start

func (c *UDPConnection) Start(s *conn.Sender) error

type UDPListener

type UDPListener struct {
	// contains filtered or unexported fields
}

func (*UDPListener) Accept

func (lis *UDPListener) Accept(fc conn.FRecvChan) (conn.Connection, error)

func (*UDPListener) Addr

func (lis *UDPListener) Addr() net.Addr

func (*UDPListener) Close

func (lis *UDPListener) Close()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL