server

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2017 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthFunc

type AuthFunc func(id, token string) error

AuthFunc using id and token to authorize a proxy.

type Config

type Config struct {
	Addr     string
	AddrHTTP string
	Auth     AuthFunc
	Load     LoadFunc
	TraffIn  TraffFunc
	TraffOut TraffFunc
}

Config describes the configuration information for the server.

type LoadFunc

type LoadFunc func(loader Loader, id string) error

LoadFunc using loader to load a proxy with id.

type Loader

type Loader interface {
	Proxy(p proxy.Proxy) error
	ProxyTCP(id string, port int) error
	ProxyHTTP(id, domain string) error
}

Loader is used to load proxy.

type Server

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

Server combination net.Listener and vhost.Muxer, manage all proxies. Listen to the client's connection and the user's http connection. The load function loads the proxy using lazy load mode.

func Listen

func Listen(cfg *Config) (s *Server, err error)

Listen tun address and http address, create a server.

func (*Server) Kill

func (s *Server) Kill(id string)

Kill a proxy.

func (*Server) Proxies

func (s *Server) Proxies() []proxy.Proxy

Proxies returns all proxies.

func (*Server) Run

func (s *Server) Run(ctx context.Context) (err error)

Run this server, receive various user connections and client connections, and handle events.

type TraffFunc

type TraffFunc func(id string, b []byte)

TraffFunc records traffic for a proxy.

Jump to

Keyboard shortcuts

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