transport

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func (*Client) Activate

func (c *Client) Activate(wsURL string, restURL string)

func (*Client) Close

func (c *Client) Close() error

func (*Client) GetID

func (c *Client) GetID() string

func (*Client) GetKeepAlive

func (c *Client) GetKeepAlive() time.Duration

func (*Client) GetReadLimit

func (c *Client) GetReadLimit() int64

func (*Client) GetTimeout

func (c *Client) GetTimeout() time.Duration

func (*Client) IsActive

func (c *Client) IsActive() bool

func (*Client) Receive

func (c *Client) Receive() (*packet.Packet, error)

func (*Client) Send

func (c *Client) Send(p *packet.Packet) error

func (*Client) SetKeepAlive

func (c *Client) SetKeepAlive(ka time.Duration)

func (*Client) SetOnClose

func (c *Client) SetOnClose(callback func(t Transport, e error))

func (*Client) SetReadLimit

func (*Client) SetReadLimit(limit int64)

func (*Client) SetTimeout

func (c *Client) SetTimeout(to time.Duration)

type Handler

type Handler struct {
	ID string
	// contains filtered or unexported fields
}

func (*Handler) Activate

func (h *Handler) Activate()

func (*Handler) Close

func (h *Handler) Close() error

func (*Handler) GetID

func (h *Handler) GetID() string

func (*Handler) GetReadLimit

func (h *Handler) GetReadLimit() int64

func (*Handler) GetTimeout

func (h *Handler) GetTimeout() time.Duration

func (*Handler) IsActive

func (h *Handler) IsActive() bool

func (*Handler) Receive

func (h *Handler) Receive() (*packet.Packet, error)

func (*Handler) Send

func (h *Handler) Send(p *packet.Packet) error

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*Handler) SetOnClose

func (h *Handler) SetOnClose(callback func(t Transport, e error))

func (*Handler) SetReadLimit

func (h *Handler) SetReadLimit(limit int64)

func (*Handler) SetTimeout

func (h *Handler) SetTimeout(to time.Duration)

type ListenHandler

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

func (*ListenHandler) Activate

func (l *ListenHandler) Activate()

func (*ListenHandler) Close

func (l *ListenHandler) Close() error

func (*ListenHandler) CloseTransports

func (l *ListenHandler) CloseTransports() error

func (*ListenHandler) GetReadLimit

func (l *ListenHandler) GetReadLimit() int64

func (*ListenHandler) GetTimeout

func (l *ListenHandler) GetTimeout() time.Duration

func (*ListenHandler) IsActive

func (l *ListenHandler) IsActive() bool

func (*ListenHandler) ServeHTTP

func (l *ListenHandler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*ListenHandler) SetOnAccept

func (l *ListenHandler) SetOnAccept(callback func(l Listener, t Transport) Transport)

func (*ListenHandler) SetOnClose

func (l *ListenHandler) SetOnClose(callback func(t Transport, e error))

func (*ListenHandler) SetOnConnect

func (l *ListenHandler) SetOnConnect(callback func(l Listener, t Transport))

func (*ListenHandler) SetReadLimit

func (l *ListenHandler) SetReadLimit(limit int64)

func (*ListenHandler) SetTimeout

func (l *ListenHandler) SetTimeout(to time.Duration)

type ListenWebsocket

type ListenWebsocket struct {
	Upgrader websocket.Upgrader
	// contains filtered or unexported fields
}

func (*ListenWebsocket) Activate

func (l *ListenWebsocket) Activate()

func (*ListenWebsocket) Close

func (l *ListenWebsocket) Close() error

func (*ListenWebsocket) CloseTransports

func (l *ListenWebsocket) CloseTransports() error

func (*ListenWebsocket) GetReadLimit

func (l *ListenWebsocket) GetReadLimit() int64

func (*ListenWebsocket) GetTimeout

func (l *ListenWebsocket) GetTimeout() time.Duration

func (*ListenWebsocket) IsActive

func (l *ListenWebsocket) IsActive() bool

func (*ListenWebsocket) ServeHTTP

func (l *ListenWebsocket) ServeHTTP(writer http.ResponseWriter, request *http.Request)

func (*ListenWebsocket) SetOnAccept

func (l *ListenWebsocket) SetOnAccept(callback func(l Listener, t Transport) Transport)

func (*ListenWebsocket) SetOnClose

func (l *ListenWebsocket) SetOnClose(callback func(t Transport, e error))

func (*ListenWebsocket) SetOnConnect

func (l *ListenWebsocket) SetOnConnect(callback func(l Listener, t Transport))

func (*ListenWebsocket) SetReadLimit

func (l *ListenWebsocket) SetReadLimit(limit int64)

func (*ListenWebsocket) SetTimeout

func (l *ListenWebsocket) SetTimeout(to time.Duration)

type Listener

type Listener interface {
	IsActive() bool
	Close() error
	SetOnAccept(callback func(l Listener, t Transport) Transport)
	SetOnConnect(callback func(l Listener, t Transport))
	SetOnClose(callback func(t Transport, e error))
	CloseTransports() error
	SetTimeout(to time.Duration)
	GetTimeout() time.Duration
	SetReadLimit(limit int64)
	GetReadLimit() int64
}

type MultiListener

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

func NewMultiListener

func NewMultiListener(listeners []Listener, onAccept func(l Listener, t Transport) Transport, onConnect func(l Listener, t Transport), onClose func(t Transport, e error), timeout time.Duration, readLimit int64) *MultiListener

func (*MultiListener) AddListener

func (m *MultiListener) AddListener(l Listener)

func (*MultiListener) ClearListeners

func (m *MultiListener) ClearListeners()

func (*MultiListener) Close

func (m *MultiListener) Close() error

func (*MultiListener) CloseTransports

func (m *MultiListener) CloseTransports() error

func (*MultiListener) GetListeners

func (m *MultiListener) GetListeners() []Listener

func (*MultiListener) GetReadLimit

func (m *MultiListener) GetReadLimit() int64

func (*MultiListener) GetTimeout

func (m *MultiListener) GetTimeout() time.Duration

func (*MultiListener) IsActive

func (m *MultiListener) IsActive() bool

func (*MultiListener) RemoveListener

func (m *MultiListener) RemoveListener(l Listener)

func (*MultiListener) SetOnAccept

func (m *MultiListener) SetOnAccept(callback func(l Listener, t Transport) Transport)

func (*MultiListener) SetOnClose

func (m *MultiListener) SetOnClose(callback func(t Transport, e error))

func (*MultiListener) SetOnConnect

func (m *MultiListener) SetOnConnect(callback func(l Listener, t Transport))

func (*MultiListener) SetReadLimit

func (m *MultiListener) SetReadLimit(limit int64)

func (*MultiListener) SetTimeout

func (m *MultiListener) SetTimeout(to time.Duration)

type Transport

type Transport interface {
	GetID() string
	IsActive() bool
	Send(p *packet.Packet) error
	Receive() (*packet.Packet, error)
	Close() error
	SetOnClose(callback func(t Transport, e error))
	SetTimeout(to time.Duration)
	GetTimeout() time.Duration
	SetReadLimit(limit int64)
	GetReadLimit() int64
}

type Websocket

type Websocket struct {
	ID string
	// contains filtered or unexported fields
}

func (*Websocket) Activate

func (w *Websocket) Activate(conn *websocket.Conn)

func (*Websocket) Close

func (w *Websocket) Close() error

func (*Websocket) GetID

func (w *Websocket) GetID() string

func (*Websocket) GetReadLimit

func (w *Websocket) GetReadLimit() int64

func (*Websocket) GetTimeout

func (w *Websocket) GetTimeout() time.Duration

func (*Websocket) IsActive

func (w *Websocket) IsActive() bool

func (*Websocket) Receive

func (w *Websocket) Receive() (*packet.Packet, error)

func (*Websocket) Send

func (w *Websocket) Send(p *packet.Packet) error

func (*Websocket) SetOnClose

func (w *Websocket) SetOnClose(callback func(t Transport, e error))

func (*Websocket) SetReadLimit

func (w *Websocket) SetReadLimit(limit int64)

func (*Websocket) SetTimeout

func (w *Websocket) SetTimeout(to time.Duration)

Jump to

Keyboard shortcuts

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