remotedialer

package
v2.1.6+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Data messageType = iota + 1
	Connect
	Error
	AddClient
	RemoveClient
)

Variables

View Source
var (
	Token = "X-API-Tunnel-Token"
	ID    = "X-API-Tunnel-ID"
)
View Source
var (
	PingWaitDuration  = time.Duration(10 * time.Second)
	PingWriteInterval = time.Duration(5 * time.Second)
	MaxRead           = 8192
)
View Source
var PrintTunnelData bool

PrintTunnelData No tunnel logging by default

Functions

func ClientConnect

func ClientConnect(wsURL string, headers http.Header, dialer *websocket.Dialer, auth ConnectAuthorizer, onConnect func(context.Context) error)

func DefaultErrorWriter

func DefaultErrorWriter(rw http.ResponseWriter, req *http.Request, code int, err error)

Types

type Authorizer

type Authorizer func(req *http.Request) (clientKey string, authed bool, err error)

type ConnectAuthorizer

type ConnectAuthorizer func(proto, address string) bool

type ErrorWriter

type ErrorWriter func(rw http.ResponseWriter, req *http.Request, code int, err error)

type Server

type Server struct {
	PeerID    string
	PeerToken string
	// contains filtered or unexported fields
}

func New

func New(auth Authorizer, errorWriter ErrorWriter) *Server

func (*Server) AddPeer

func (s *Server) AddPeer(url, id, token string)

func (*Server) Dial

func (s *Server) Dial(clientKey string, deadline time.Duration, proto, address string) (net.Conn, error)

func (*Server) Dialer

func (s *Server) Dialer(clientKey string, deadline time.Duration) dialer.Dialer

func (*Server) HasSession

func (s *Server) HasSession(clientKey string) bool

func (*Server) RemovePeer

func (s *Server) RemovePeer(id string)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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