proto

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1"

Variables

View Source
var TypeMap map[string]reflect.Type

Functions

func Pack

func Pack(payload interface{}) ([]byte, error)

func ReadMsgInto

func ReadMsgInto(c conn.Conn, msg Message) (err error)

func UnpackInterfaceField

func UnpackInterfaceField(interfaceField, deserializeInto interface{}) error

UnpackInterfaceField allows the caller to unpack anything that is specified in the protocol as an interface{} This includes the all Extra fields and the Options for a Bind. This is one of the most awful hacks in the whole library. The trouble is that anything that is passed as an empty interface in the protocol will be deserialized into a map[string]interface{}. So in order to get them in the form we want, we write them out as JSON again and then read them back in with the now-known proper type for deserializion

func UnpackInto

func UnpackInto(buffer []byte, msg Message) (err error)

func WriteMsg

func WriteMsg(c conn.Conn, msg interface{}) (err error)

Types

type Auth

type Auth struct {
	Version  []string    // protocol versions supported, ordered by preference
	ClientId string      // empty for new sessions
	Extra    interface{} // clients may add whatever data the like to auth messages
}

When a client opens a new control channel to the server it must start by sending an Auth message.

type AuthResp

type AuthResp struct {
	Version  string // protocol version chosen
	ClientId string
	Error    string
	Extra    interface{}
}

A server responds to an Auth message with an AuthResp message over the control channel.

If Error is not the empty string the server has indicated it will not accept the new session and will close the connection.

The server response includes a unique ClientId that is used to associate and authenticate future proxy connections via the same field in RegProxy messages.

type Bind

type Bind struct {
	Protocol string      // the protocol to bind
	Options  interface{} // options for the bind - protocol dependent
	Extra    interface{} // anything extra the application wants to send
}

A client sends this message to the server over a new stream to request the server bind a remote port/hostname on the client's behalf.

type BindResp

type BindResp struct {
	Url      string
	Protocol string
	Error    string
	Extra    interface{}
}

The server responds with a BindResp message to notify the client of the success or failure of a bind.

type Envelope

type Envelope struct {
	Type    string
	Payload json.RawMessage
}

type HTTPOptions

type HTTPOptions struct {
	Hostname  string
	Subdomain string
	Auth      string
}

type Message

type Message interface{}

func ReadMsg

func ReadMsg(c conn.Conn) (msg Message, err error)

func Unpack

func Unpack(buffer []byte) (msg Message, err error)

type StartProxy

type StartProxy struct {
	Url        string // URL of the tunnel this connection connection is being proxied for
	ClientAddr string // Network address of the client initiating the connection to the tunnel
}

This message is sent first over a new stream from the server to the client to provide it with metadata about the connection it will tunnel over the stream.

type TCPOptions

type TCPOptions struct {
	RemotePort uint16
}

type TLSOptions

type TLSOptions struct {
	Hostname  string
	Subdomain string
}

type Unbind

type Unbind struct {
	Url   string
	Extra interface{}
}

A client sends this message to the server over a new stream to request the server unbind a previously bound tunnel

type UnbindResp

type UnbindResp struct {
	Error string
	Extra interface{}
}

The server response with an UnbindResp message to notify the client of the success or failure of the unbind.

Jump to

Keyboard shortcuts

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