server

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChannelRegex = regexp.MustCompile("^(/[a-z0-9_^/]*)->((tcp|udp|unix|unixgram|unixpacket):(.*))$")

Functions

func AcceptConnection

func AcceptConnection(conn net.Conn, manager cert.TlsConfig, secure bool, channels Channels) error

func DefaultListenerFromPacketConn added in v2.1.0

func DefaultListenerFromPacketConn(block kcp.BlockCrypt, conn net.PacketConn) (net.Listener, error)

Types

type AbstractChannel

type AbstractChannel struct {
	addr.ProtoName `yaml:",inline"`
	Address        addr.ProtoAddress `json:"address"`
}

func (*AbstractChannel) Name

func (u *AbstractChannel) Name() string

type Channel

type Channel interface {
	fmt.Stringer
	Name() string
	OpenConnection() (net.Conn, error)
}

type Channels

type Channels []Channel

func (*Channels) Filter

func (chl *Channels) Filter(names []string) (Channels, error)

Filter will return a list of channels if they are contained in the list of names. It will throw an error if no channels can be identified (either this list is empty or no match if found). If the list of names is empty or nil, it will return all the channels

func (*Channels) Find

func (chl *Channels) Find(name string) (Channel, error)

Find finds an endpoint by name (case sensitive). If the endpoint does not exist, it returns an error

func (*Channels) String

func (chl *Channels) String() string

func (*Channels) UnmarshalFlag

func (chl *Channels) UnmarshalFlag(endpoint string) error

func (*Channels) UnmarshalJSON

func (chl *Channels) UnmarshalJSON(b []byte) error

func (*Channels) UnmarshalYAML

func (chl *Channels) UnmarshalYAML(unmarshal func(interface{}) error) error

type ConnectionHandler

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

ConnectionHandler will overlay a logical connection multiplexer over a pyhisical line

func (*ConnectionHandler) HandleConnection

func (ch *ConnectionHandler) HandleConnection(conn net.Conn) (err error)

Create a logical mutex session of a pyhisical link

type DnsServer

type DnsServer struct {
	SocketServer
	Domain string `json:"domain"`
}

func NewDnsServer

func NewDnsServer() *DnsServer

func (*DnsServer) Shutdown added in v2.1.0

func (st *DnsServer) Shutdown() error

func (*DnsServer) Startup added in v2.1.0

func (st *DnsServer) Startup(channels Channels) error

func (*DnsServer) String

func (st *DnsServer) String() string

type HttpEndpoint

type HttpEndpoint struct {
	Channels          []string `json:"channels"`
	Endpoint          string   `json:"endpoint"`
	EnableCompression bool     `json:"enableCompression"`
}

func (*HttpEndpoint) String

func (wsm *HttpEndpoint) String() string

type HttpServer

type HttpServer struct {
	cert.ServerConfig

	Address   addr.ProtoAddress     `json:"address"`
	Endpoints WebsocketEndpointList `json:"endpoints"`
	// contains filtered or unexported fields
}

func NewHttpServer

func NewHttpServer() *HttpServer

func (*HttpServer) EndpointHandler

func (ws *HttpServer) EndpointHandler(ep *HttpEndpoint, upstreams Channels) (http.HandlerFunc, error)

func (*HttpServer) Shutdown

func (ws *HttpServer) Shutdown() error

func (*HttpServer) Startup

func (ws *HttpServer) Startup(channels Channels) error

noinspection GoUnusedParameter

func (*HttpServer) String

func (ws *HttpServer) String() string

type IoServer

type IoServer struct {
	cert.ServerConfig

	Address  addr.ProtoAddress `json:"address"`
	Channels []string          `json:"channels"`

	Input  io.ReadCloser
	Output io.WriteCloser
	// contains filtered or unexported fields
}

func NewIoServer

func NewIoServer() *IoServer

func (*IoServer) Shutdown

func (st *IoServer) Shutdown() error

func (*IoServer) Startup

func (st *IoServer) Startup(channels Channels) error

func (*IoServer) String

func (st *IoServer) String() string

type ListenerFromPacketConn added in v2.1.0

type ListenerFromPacketConn func(block kcp.BlockCrypt, conn net.PacketConn) (net.Listener, error)

type NetworkChannel

type NetworkChannel struct {
	AbstractChannel
}

Channel is a configuration of one of the server that are going to be multiplexed in the connection

func (*NetworkChannel) OpenConnection

func (u *NetworkChannel) OpenConnection() (net.Conn, error)

OpenConnection will open a connection the the upstream server

func (*NetworkChannel) String

func (u *NetworkChannel) String() string

type NextHandlerFunc

type NextHandlerFunc func(next http.Handler) http.Handler

func GetRequestLogger

func GetRequestLogger(address *net.TCPAddr) (logger NextHandlerFunc)

type PacketServer added in v2.1.0

type PacketServer struct {
	cert.ServerConfig

	Address  addr.ProtoAddress `json:"address"`
	Channels []string          `json:"channels"`

	PacketConnection net.PacketConn
	// contains filtered or unexported fields
}

func NewPacketServer added in v2.1.0

func NewPacketServer() *PacketServer

func (*PacketServer) Shutdown added in v2.1.0

func (st *PacketServer) Shutdown() error

func (*PacketServer) Startup added in v2.1.0

func (st *PacketServer) Startup(channels Channels) error

func (*PacketServer) StartupPacket added in v2.1.0

func (st *PacketServer) StartupPacket(channels Channels, createListenerFunc ListenerFromPacketConn) error

func (*PacketServer) String added in v2.1.0

func (st *PacketServer) String() string

type Server

type Server interface {
	fmt.Stringer

	Startup(channels Channels) error
	Shutdown() error
}

type Servers

type Servers []Server

func (*Servers) UnmarshalFlag

func (se *Servers) UnmarshalFlag(value string) error

func (*Servers) UnmarshalJSON

func (se *Servers) UnmarshalJSON(b []byte) error

func (*Servers) UnmarshalYAML

func (se *Servers) UnmarshalYAML(unmarshal func(interface{}) error) error

type SocketServer

type SocketServer struct {
	cert.ServerConfig

	Address  addr.ProtoAddress `json:"address"`
	Channels []string          `json:"channels"`
	// contains filtered or unexported fields
}

func NewSocketServer

func NewSocketServer() *SocketServer

func (*SocketServer) Shutdown

func (st *SocketServer) Shutdown() error

func (*SocketServer) Startup

func (st *SocketServer) Startup(channels Channels) error

func (*SocketServer) String

func (st *SocketServer) String() string

type SocksChannel

type SocksChannel struct {
	AbstractChannel
}

func (*SocksChannel) OpenConnection

func (u *SocksChannel) OpenConnection() (net.Conn, error)

func (*SocksChannel) String

func (u *SocksChannel) String() string

type WebsocketEndpointList

type WebsocketEndpointList []HttpEndpoint

func (*WebsocketEndpointList) String

func (epl *WebsocketEndpointList) String() string

Jump to

Keyboard shortcuts

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