acceptor

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Acceptor

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

func NewAcceptor

func NewAcceptor(handler func(conn net.Conn)) *Acceptor

func (*Acceptor) Done

func (p *Acceptor) Done()

func (*Acceptor) Signal

func (p *Acceptor) Signal() <-chan struct{}

type Instance

type Instance interface {
	// Run runs the thread that will receive the connection
	Run(bind string) error

	// Shutdown shuts down the acceptor
	Shutdown()
}

Instance represents a server for accepting connections

type Options

type Options struct {
	Core            int
	ReadBufferSize  int
	WriteBufferSize int
	Keepalive       bool
	WriteDeadline   time.Duration
	ReadDeadline    time.Duration
	LengthOffset    int
}

func DefaultOptions

func DefaultOptions() Options

type TCPAcceptor

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

TCPAcceptor represents tcp acceptor

func NewTCPAcceptor

func NewTCPAcceptor(options Options, handler func(conn net.Conn)) *TCPAcceptor

NewTCPAcceptor returns a new instance of the TCPAcceptor

func (*TCPAcceptor) Run

func (server *TCPAcceptor) Run(bind string) (err error)

Run runs the acceptor

func (*TCPAcceptor) Shutdown

func (acceptor *TCPAcceptor) Shutdown()

Shutdown shuts down acceptor

type WebsocketAcceptor

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

WebsocketAcceptor represents websocket acceptor

func NewWSAcceptor

func NewWSAcceptor(options Options, handler func(conn net.Conn)) *WebsocketAcceptor

NewWSAcceptor return a new instance of the WebsocketAcceptor

func (*WebsocketAcceptor) Run

func (acceptor *WebsocketAcceptor) Run(bind string) (err error)

Run runs websocket acceptor

func (*WebsocketAcceptor) Shutdown

func (acceptor *WebsocketAcceptor) Shutdown()

Shutdown shuts down acceptor

Jump to

Keyboard shortcuts

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