connpool

package
v3.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2018 License: BSD-3-Clause, GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BALANCE_INTERVAL = 60
	DIAL_RETRY       = 2
	AUTH_TIMEOUT     = 10
)

Variables

View Source
var (
	ErrNoSession       = errors.New("session in pool but can't pick one.")
	ErrSessionNotFound = errors.New("session not found.")
	ErrNoCreator       = errors.New("can't create tunnel with no creator.")
)

Functions

func HandlerLookup

func HandlerLookup(w http.ResponseWriter, req *http.Request)

Types

type Dialer

type Dialer struct {
	*Pool
	MinSess int
	MaxConn int
	// contains filtered or unexported fields
}

func NewDialer

func NewDialer(MinSess, MaxConn int) (dialer *Dialer)

func (*Dialer) AddDialerCreator

func (dialer *Dialer) AddDialerCreator(orig *tunnel.DialerCreator)

func (*Dialer) Dial

func (dialer *Dialer) Dial(network, address string) (net.Conn, error)

func (*Dialer) Get

func (dialer *Dialer) Get() (tun tunnel.Tunnel, err error)

Get one or create one.

type Pool

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

func NewPool

func NewPool() (pool *Pool)

func (*Pool) Add

func (pool *Pool) Add(tun tunnel.Tunnel)

func (*Pool) CutAll

func (pool *Pool) CutAll()

func (*Pool) GetSize

func (pool *Pool) GetSize() int

func (*Pool) GetTunnels

func (pool *Pool) GetTunnels() (tuns TunSlice)

func (*Pool) HandlerCutoff

func (pool *Pool) HandlerCutoff(w http.ResponseWriter, req *http.Request)

func (*Pool) HandlerMain

func (pool *Pool) HandlerMain(w http.ResponseWriter, req *http.Request)

func (*Pool) Register

func (pool *Pool) Register(mux *http.ServeMux)

func (*Pool) Remove

func (pool *Pool) Remove(tun tunnel.Tunnel) (err error)

type Server

type Server struct {
	*Pool
	tunnel.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(auth *map[string]string) (server *Server)

func (*Server) AuthPass

func (server *Server) AuthPass(username, password string) bool

func (*Server) Handle

func (server *Server) Handle(conn net.Conn) (err error)

type TunSlice

type TunSlice []tunnel.Tunnel

func (TunSlice) Len

func (ts TunSlice) Len() int

func (TunSlice) Less

func (ts TunSlice) Less(i, j int) bool

func (TunSlice) Swap

func (ts TunSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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