Documentation
¶
Index ¶
- type Client
- func (c *Client[T]) Close() error
- func (c *Client[T]) Conn() Conn
- func (c *Client[T]) Connect()
- func (c *Client[T]) GetDailTimeout() time.Duration
- func (c *Client[T]) GetRouter() *router.Router[*socket.Stream[Conn], T]
- func (c *Client[T]) LocalAddr() net.Addr
- func (c *Client[T]) RemoteAddr() net.Addr
- func (c *Client[T]) Sender() socket.Emitter[Conn]
- func (c *Client[T]) SetRouter(router *router.Router[*socket.Stream[Conn], T]) *Client[T]
- func (c *Client[T]) Use(middle ...func(Middle) Middle)
- type Conn
- type Middle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client[T any] struct { Name string Addr string HeartBeatTimeout time.Duration HeartBeatInterval time.Duration ReconnectInterval time.Duration HeartBeat func(conn Conn) error Mtu int ReadBufferSize int WriteBufferSize int DailTimeout time.Duration OnOpen func(conn Conn) OnClose func(conn Conn) OnMessage func(conn Conn, msg []byte) OnError func(stream *socket.Stream[Conn], err error) OnException func(err error) OnSuccess func() OnReconnecting func() OnUnknown func(conn Conn, message []byte, next Middle) PingHandler func(conn Conn) func(data string) error PongHandler func(conn Conn) func(data string) error Protocol protocol.UDPProtocol // contains filtered or unexported fields }
func (*Client[T]) GetDailTimeout ¶
func (*Client[T]) RemoteAddr ¶
type Conn ¶
type Conn interface {
Name() string
SetName(name string)
LocalAddr() net.Addr
RemoteAddr() net.Addr
Read(b []byte) (n int, addr *net.UDPAddr, err error)
Write(b []byte) (int, error)
WriteToUDP(b []byte, addr *net.UDPAddr) (int, error)
Close() error
Conn() *net.UDPConn
LastPong() time.Time
SetLastPong(t time.Time)
Ping() error
Pong() error
SendClose() error
SendOpen() error
SetDeadline(t time.Time) error
socket.Packer
}
Click to show internal directories.
Click to hide internal directories.