server

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxConnections = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeadlineListener

type DeadlineListener interface {
	net.Listener

	SetDeadline(deadline time.Time) error
}

for calling Accept(). This is used to check periodically for a quit signal. DeadListener is a listener that allows to set a deadline

type Handler

type Handler interface {
	Handle(ctx context.Context, conn net.Conn)
	Quit() error
}

type Server

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

Server is a generic server implementation that listens on a certain port and starts a new go routine for each new accepted connection. Whatever the goroutine does is defined by the user-defined handler.

func NewServer

func NewServer(lst net.Listener, handler Handler, ctx context.Context) (*Server, error)

func (*Server) Close

func (sv *Server) Close() error

func (*Server) Quit

func (sv *Server) Quit()

func (*Server) Serve

func (sv *Server) Serve() error

Jump to

Keyboard shortcuts

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