netserver

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: Apache-2.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 Config

type Config struct {
	Type string

	// The hostname to be used for TLS configurations
	Hostname string

	// The port the server binds to and listens on
	ListenPort string

	// TLS configuration
	TLS *caddytls.Config

	Parameters []string
	Tokens     map[string][]string
}

Config contains configuration details about a net server type

func GetConfig

func GetConfig(c *caddy.Controller) *Config

GetConfig gets the Config that corresponds to c. If none exist (should only happen in tests), then a new, empty one will be created.

func (Config) Host

func (c Config) Host() string

Host returns c.Hostname

func (Config) Port

func (c Config) Port() string

Port returns c.ListenPort

func (Config) TLSConfig

func (c Config) TLSConfig() *caddytls.Config

TLSConfig returns c.TLS.

type EchoServer

type EchoServer struct {
	LocalTCPAddr string
	// contains filtered or unexported fields
}

EchoServer is an echo implementation of the caddy.Server interface type

func NewEchoServer

func NewEchoServer(l string, c *Config) (*EchoServer, error)

NewEchoServer returns a new echo server

func (*EchoServer) Listen

func (s *EchoServer) Listen() (net.Listener, error)

Listen starts listening by creating a new listener and returning it. It does not start accepting connections.

func (*EchoServer) ListenPacket

func (s *EchoServer) ListenPacket() (net.PacketConn, error)

ListenPacket starts listening by creating a new Packet listener and returning it. It does not start accepting connections.

func (*EchoServer) OnStartupComplete

func (s *EchoServer) OnStartupComplete()

OnStartupComplete lists the sites served by this server and any relevant information

func (*EchoServer) Serve

func (s *EchoServer) Serve(ln net.Listener) error

Serve starts serving using the provided listener. Serve blocks indefinitely, or in other words, until the server is stopped.

func (*EchoServer) ServePacket

func (s *EchoServer) ServePacket(con net.PacketConn) error

ServePacket starts serving using the provided listener. ServePacket blocks indefinitely, or in other words, until the server is stopped.

func (*EchoServer) Stop

func (s *EchoServer) Stop() error

Stop stops s gracefully and closes its listener.

type ProxyServer

type ProxyServer struct {
	LocalTCPAddr string
	DestTCPAddr  string
	// contains filtered or unexported fields
}

ProxyServer is an implementation of the caddy.Server interface type

func NewProxyServer

func NewProxyServer(l string, d string, c *Config) (*ProxyServer, error)

NewProxyServer returns a new proxy server

func (*ProxyServer) Listen

func (s *ProxyServer) Listen() (net.Listener, error)

Listen starts listening by creating a new listener and returning it. It does not start accepting connections.

func (*ProxyServer) ListenPacket

func (s *ProxyServer) ListenPacket() (net.PacketConn, error)

ListenPacket starts listening by creating a new Packet listener and returning it. It does not start accepting connections.

func (*ProxyServer) OnStartupComplete

func (s *ProxyServer) OnStartupComplete()

OnStartupComplete lists the sites served by this server and any relevant information

func (*ProxyServer) Serve

func (s *ProxyServer) Serve(ln net.Listener) error

Serve starts serving using the provided listener. Serve blocks indefinitely, or in other words, until the server is stopped.

func (*ProxyServer) ServePacket

func (s *ProxyServer) ServePacket(con net.PacketConn) error

ServePacket starts serving using the provided listener. ServePacket blocks indefinitely, or in other words, until the server is stopped.

func (*ProxyServer) Stop

func (s *ProxyServer) Stop() error

Stop stops s gracefully and closes its listener.

Jump to

Keyboard shortcuts

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