client

package
v0.0.0-...-80056bb Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2015 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPDialer

func HTTPDialer(network, proxyUrl, addr string, tlsConfig *tls.Config) func() (muxado.Session, error)

func SOCKS5Dialer

func SOCKS5Dialer(network, proxyAddr, user, password, addr string, tlsConfig *tls.Config) func() (muxado.Session, error)

Types

type Addr

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

func (*Addr) Network

func (a *Addr) Network() string

func (*Addr) String

func (a *Addr) String() string

type RawSession

type RawSession struct {
	log.Logger // logger for this client
	// contains filtered or unexported fields
}

A RawSession is a client session which handles authorization with the tunnel server, then listening and unlistening of tunnels.

When RawSession.Accept() returns an error, that means the session is dead. Client sessions run over a muxado session.

func NewRawSession

func NewRawSession(mux muxado.Session) *RawSession

Creates a new client tunnel session with the given id running over the given muxado session.

func (*RawSession) Accept

func (s *RawSession) Accept() (conn.Conn, error)

Accept returns the next stream initiated by the server over the underlying muxado session

func (*RawSession) Auth

func (s *RawSession) Auth(id string, extra interface{}) (resp *proto.AuthResp, err error)

Auth sends an authentication message to the server and returns the server's response. The id string will be empty unless reconnecting an existing session. extra is an opaque struct useful for passing application-specific data.

func (*RawSession) Listen

func (s *RawSession) Listen(protocol string, opts interface{}, extra interface{}) (resp *proto.BindResp, err error)

Listen sends a listen message to the server and returns the server's response protocol is the requested protocol to listen. opts are protocol-specific options for listening. extra is an opaque struct useful for passing application-specific data.

func (*RawSession) Unlisten

func (s *RawSession) Unlisten(url string) (resp *proto.UnbindResp, err error)

Unlisten sends an unlisten message to the server and returns the server's response. url is the url of the open, bound tunnel to unlisten

type ReconnectingSession

type ReconnectingSession struct {
	*Session
	// contains filtered or unexported fields
}

func NewReconnectingSession

func NewReconnectingSession(dialer func() (muxado.Session, error), authExtra interface{}) (*ReconnectingSession, error)

func (*ReconnectingSession) Wait

func (s *ReconnectingSession) Wait() error

type Session

type Session struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Session is a higher-level client session interface. You will almost always prefer this over RawSession.

Unlike RawSession, when you listen a new tunnel on Session, you are returned a Tunnel object which allows you to recieve new connections from that listen.

func NewSession

func NewSession(mux muxado.Session) *Session

func (*Session) Auth

func (s *Session) Auth(id string, extra interface{}) error

func (*Session) Listen

func (s *Session) Listen(protocol string, opts interface{}, extra interface{}) (*Tunnel, error)

Listen negotiates with the server to create a new remote listen for the given protocol and options. It returns a *Tunnel on success from which the caller can accept new connections over the listen.

Applications will typically prefer to call the protocol-specific methods like ListenHTTP, ListenTCP, etc.

func (*Session) ListenHTTP

func (s *Session) ListenHTTP(opts *proto.HTTPOptions, extra interface{}) (*Tunnel, error)

ListenHTTP listens on a new HTTP endpoint and returns a *Tunnel which accepts connections on the remote listener.

func (*Session) ListenHTTPAndHTTPS

func (s *Session) ListenHTTPAndHTTPS(opts *proto.HTTPOptions, extra interface{}) (*Tunnel, *Tunnel, error)

ListenHTTPAndHTTPS listens a new HTTP and HTTPS endpoint on the same hostname. It returns a two *Tunnel objects which accept connections on the remote HTTP and HTTPS listens, respectively.

func (*Session) ListenHTTPS

func (s *Session) ListenHTTPS(opts *proto.HTTPOptions, extra interface{}) (*Tunnel, error)

ListenHTTP listens on a new HTTPS endpoint and returns a *Tunnel which accepts connections on the remote listener.

func (*Session) ListenTCP

func (s *Session) ListenTCP(opts *proto.TCPOptions, extra interface{}) (*Tunnel, error)

ListenTLS listens on a new TCP endpoint and returns a *Tunnel which accepts connections on the remote listener.

func (*Session) ListenTLS

func (s *Session) ListenTLS(opts *proto.TLSOptions, extra interface{}) (*Tunnel, error)

ListenTLS listens on a new TLS endpoint and returns a *Tunnel which accepts connections on the remote listener.

type Tunnel

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

A Tunnel is a net.Listener that Accept()'s connections from a remote machine.

func (*Tunnel) Accept

func (t *Tunnel) Accept() (net.Conn, error)

func (*Tunnel) Addr

func (t *Tunnel) Addr() net.Addr

func (*Tunnel) Close

func (t *Tunnel) Close() error

Jump to

Keyboard shortcuts

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