servers

package
v0.0.1-79 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPServer

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

HTTPServer is a generic implementation of an HTTP server used by the various HTTP servers in this mock.

func NewHTTPServer

func NewHTTPServer(opts NewHTTPServiceOptions) (*HTTPServer, error)

NewHTTPServer instantiates a new instance of the memd server.

func (*HTTPServer) Close

func (s *HTTPServer) Close() error

Close will stop this HTTP server

func (*HTTPServer) ListenPort

func (s *HTTPServer) ListenPort() int

ListenPort returns the port this server is listening on.

type HTTPServerHandlers

type HTTPServerHandlers struct {
	NewRequestHandler func(*mock.HTTPRequest) *mock.HTTPResponse
}

HTTPServerHandlers provides all the handlers for the http server

type MemdClient

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

MemdClient represents a connected memd client.

func (*MemdClient) Close

func (c *MemdClient) Close() error

Close will forcefully disconnect a client

func (*MemdClient) GetContext

func (c *MemdClient) GetContext(valuePtr interface{})

GetContext gets arbitrary context associated with this client

func (*MemdClient) LocalAddr

func (c *MemdClient) LocalAddr() net.Addr

LocalAddr returns the local address of this client.

func (*MemdClient) RemoteAddr

func (c *MemdClient) RemoteAddr() net.Addr

RemoteAddr returns the remote address of this client.

func (*MemdClient) WritePacket

func (c *MemdClient) WritePacket(pak *memd.Packet) error

WritePacket writes a packet to the connection.

type MemdServer

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

MemdServer represents an instance of the memd server.

func NewMemdService

func NewMemdService(opts NewMemdServerOptions) (*MemdServer, error)

NewMemdService instantiates a new instance of the memd server.

func (*MemdServer) Close

func (s *MemdServer) Close() error

Close causes this memd server to be forcefully stopped and all clients dropped.

func (*MemdServer) GetAllClients

func (s *MemdServer) GetAllClients() []*MemdClient

GetAllClients returns a list of all clients which are connected.

func (*MemdServer) ListenPort

func (s *MemdServer) ListenPort() int

ListenPort returns the port this server is listening on.

type MemdServerHandlers

type MemdServerHandlers struct {
	NewClientHandler  func(*MemdClient)
	LostClientHandler func(*MemdClient)
	PacketHandler     func(*MemdClient, *memd.Packet)
}

MemdServerHandlers provides all the handlers for the memd server

type NewHTTPServiceOptions

type NewHTTPServiceOptions struct {
	Name      string
	Handlers  HTTPServerHandlers
	TLSConfig *tls.Config
}

NewHTTPServiceOptions enables the specification of default options for a new http server.

type NewMemdServerOptions

type NewMemdServerOptions struct {
	TLSConfig *tls.Config
	Handlers  MemdServerHandlers
}

NewMemdServerOptions enables the specification of default options for a new memd server.

Jump to

Keyboard shortcuts

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