Documentation
¶
Index ¶
- type Conn
- type Middle
- type Server
- func (s *Server[T]) Conn(fd int64) (Conn, error)
- func (s *Server[T]) ConnByAddr(addr string) (Conn, error)
- func (s *Server[T]) ConnLen() int
- func (s *Server[T]) GetDailTimeout() time.Duration
- func (s *Server[T]) GetRouter() *router.Router[*socket.Stream[Conn], T]
- func (s *Server[T]) LocalAddr() net.Addr
- func (s *Server[T]) Range(fn func(conn Conn))
- func (s *Server[T]) Ready()
- func (s *Server[T]) Sender(fd int64) (socket.Emitter[Conn], error)
- func (s *Server[T]) SetRouter(router *router.Router[*socket.Stream[Conn], T]) *Server[T]
- func (s *Server[T]) Shutdown() error
- func (s *Server[T]) Start()
- func (s *Server[T]) Use(middle ...func(Middle) Middle)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface {
Host() string
ClientIP() string
Ping() error
Pong() error
SendClose() error
SendOpen() error
Close() error
Write(msg []byte) (int, error)
WriteToUDP(msg []byte, addr *net.UDPAddr) (int, error)
FD() int64
SetFD(fd int64)
LastPing() time.Time
SetLastPing(t time.Time)
CloseChan() chan struct{}
AcceptChan() chan []byte
Name() string
SetName(name string)
Conn() *net.UDPAddr
SetDeadline(t time.Time) error
socket.Packer
}
type Server ¶
type Server[T any] struct { Name string Addr string OnClose func(conn Conn) OnMessage func(conn Conn, msg []byte) OnOpen func(conn Conn) OnError func(stream *socket.Stream[Conn], err error) OnSuccess func() OnException func(err error) OnUnknown func(conn Conn, message []byte, next Middle) HeartBeatTimeout time.Duration HeartBeatInterval time.Duration HandshakeTimeout time.Duration DailTimeout time.Duration Mtu int ReadBufferSize int // not use yet WriteBufferSize int // not use yet 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 (*Server[T]) GetDailTimeout ¶
Click to show internal directories.
Click to hide internal directories.