server

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnNotify

type ConnNotify func(conn.Connection)

notify a new connection

type LoggerFilter

type LoggerFilter struct{}

http server logger filter

func (*LoggerFilter) Write

func (f *LoggerFilter) Write(p []byte) (n int, err error)

type Options

type Options struct {
	Addr               string
	TLS                *tls.Config
	ConnNotify         ConnNotify
	OnReadTransportErr func(nodeID, projectID string)
	ConnMgr            *cmgr.ConnectionManager
	ConnNumMax         int
	AutoRoute          bool
	HandshakeTimeout   time.Duration
	Handler            mux.Handler
	Consumer           io.Writer
}

server options

type ProtocolServer

type ProtocolServer interface {
	ListenAndServeTLS() error
	Close() error
}

protocol server

type QuicServer

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

func NewQuicServer

func NewQuicServer(opts Options, exOpts interface{}) *QuicServer

func (*QuicServer) Close

func (srv *QuicServer) Close() error

func (*QuicServer) ListenAndServeTLS

func (srv *QuicServer) ListenAndServeTLS() error

type Server

type Server struct {
	// protocol type used
	Type string
	// the server address
	Addr string
	// the tls config
	TLSConfig *tls.Config
	// ConnNotify will be called when a new connection coming
	ConnNotify ConnNotify
	// OnReadTransportErr is invoked when the connection read message err
	OnReadTransportErr func(nodeID, projectID string)
	// the local connection store
	ConnMgr *cmgr.ConnectionManager
	//auto route
	AutoRoute bool
	// handshake timeout
	HandshakeTimeout time.Duration
	// mux handler
	Handler mux.Handler
	// consumer for raw data
	Consumer io.Writer
	// extend options
	ExOpts interface{}
	// contains filtered or unexported fields
}

func (*Server) Close

func (s *Server) Close() error

close the server

func (*Server) ListenAndServeTLS

func (s *Server) ListenAndServeTLS(certFile, keyFile string) error

listen and serve

type WSServer

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

websocket protocol server

func NewWSServer

func NewWSServer(opts Options, exOpts interface{}) *WSServer

func (*WSServer) Close

func (srv *WSServer) Close() error

func (*WSServer) ListenAndServeTLS

func (srv *WSServer) ListenAndServeTLS() error

func (*WSServer) ServeHTTP

func (srv *WSServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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