server

package
v0.0.0-...-af7e2a9 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2014 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSessionRegistry

func NewSessionRegistry() *sessionRegistry

Types

type Binders

type Binders map[string]binder.Binder

type NoopSessionHooks

type NoopSessionHooks int

func (*NoopSessionHooks) OnAuth

func (*NoopSessionHooks) OnAuth(*Session, *proto.Auth) error

func (*NoopSessionHooks) OnBind

func (*NoopSessionHooks) OnBind(*Session, *proto.Bind) error

func (*NoopSessionHooks) OnClose

func (*NoopSessionHooks) OnClose(*Session) error

type NoopTunnelHooks

type NoopTunnelHooks int

func (*NoopTunnelHooks) OnConnectionClose

func (*NoopTunnelHooks) OnConnectionClose(*Tunnel, conn.Conn, time.Duration, int64, int64) error

func (*NoopTunnelHooks) OnConnectionOpen

func (*NoopTunnelHooks) OnConnectionOpen(*Tunnel, conn.Conn) error

func (*NoopTunnelHooks) OnTunnelClose

func (*NoopTunnelHooks) OnTunnelClose(*Tunnel) error

func (*NoopTunnelHooks) OnTunnelOpen

func (*NoopTunnelHooks) OnTunnelOpen(*Tunnel) error

type Server

type Server struct {
	log.Logger // logger for the server object

	Binders      // a map of protocol name -> tunnel binder
	SessionHooks // user-defined hooks to customize session behavior
	TunnelHooks  // user-definied hooks to customize tunnel behavior
	// contains filtered or unexported fields
}

A Server accepts new go-tunnel connections from clients and establishes a Session on which it wil services their requests to listen for connections on the Server's ports and/or hostnames of well-known protocols.

Servers with custom behaviors maybe implemented by setting the SessionHooks and TunnelHooks properties before calling .Run()

func NewServer

func NewServer(listener net.Listener, binders Binders) *Server

NewServer creates a new server which binds tunnels with binders on sessions it accepts from the given listener.

func Serve

func Serve(network, addr string, binders Binders) (*Server, error)

Serve creates a Server listening for new connections on the given address. It binds tunnels on those sessions with the given binders.

func ServeTLS

func ServeTLS(network, addr string, tlsConfig *tls.Config, binders Binders) (*Server, error)

ServeTLS creates a Server listening for new TLS connections which binds tunnels with the given binders.

func (*Server) Run

func (s *Server) Run() error

Run loops forever accepting new tunnel sessions from remote clients

type Session

type Session struct {
	// logger
	log.Logger

	// synchronization for accessing Session.tunnels
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSession

func NewSession(mux muxado.Session, registry *sessionRegistry, sessHooks SessionHooks, tunnelHooks TunnelHooks, binders Binders) *Session

func (*Session) Auth

func (s *Session) Auth() *proto.Auth

func (*Session) Id

func (s *Session) Id() string

func (*Session) Run

func (s *Session) Run() (err error)

Run runs the the tunnel session

func (*Session) Shutdown

func (s *Session) Shutdown()

func (*Session) Start

func (s *Session) Start() time.Time

type SessionHooks

type SessionHooks interface {
	OnAuth(*Session, *proto.Auth) error
	OnBind(*Session, *proto.Bind) error
	OnClose(*Session) error
}

type Tunnel

type Tunnel struct {

	// logger
	log.Logger
	// contains filtered or unexported fields
}

Tunnel encapsulates a single binding of a vhost or port over a tunneling session

type TunnelHooks

type TunnelHooks interface {
	OnConnectionOpen(*Tunnel, conn.Conn) error
	OnConnectionClose(*Tunnel, conn.Conn, time.Duration, int64, int64) error
	OnTunnelOpen(*Tunnel) error
	OnTunnelClose(*Tunnel) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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