proto

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package proto defines tunnel client server communication protocol.

Index

Constants

View Source
const (
	// DefaultControlPath is http.Handler url path for control connection.
	DefaultControlPath = "/_controlPath"

	// DefaultControlMethod is HTTP method used by default.
	DefaultControlMethod = "POST"

	// ClientIdentifierHeader is a header carrying information about tunnel identifier.
	ClientIdentifierHeader = "X-Tunnel-Identifier"

	// ClientIdentifierSignature is a header carrying salted SHA-1 hash of ClientIdentifierHeader
	ClientIdentifierSignature = "X-Tunnel-Signature"

	// Connected is message sent by server to client when control connection was established.
	Connected = "200 Connected to Tunnel"
	// HandshakeRequest is hello message sent by client to server.
	HandshakeRequest = "controlHandshake"
	// HandshakeResponse is response to HandshakeRequest sent by server to client.
	HandshakeResponse = "controlOk"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action int

Action represents type of ControlMsg request.

const (
	RequestClientSession Action = iota + 1
)

ControlMessage actions.

type ConnectionConfig

type ConnectionConfig struct {
	Http HTTPConfig `json:"http"`
}

type ControlMessage

type ControlMessage struct {
	Action    Action `json:"action"`
	Protocol  Type   `json:"transportProtocol"`
	LocalPort int    `json:"localPort"`
}

ControlMessage is sent from server to client to establish tunneled connection.

type HTTPConfig

type HTTPConfig struct {
	Domain  string            `json:"domain"`
	Target  string            `json:"target"`
	Rewrite []HTTPRewriteRule `json:"rewrite"`
}

type HTTPRewriteRule

type HTTPRewriteRule struct {
	From string `json:"from"`
	To   string `json:"to"`
}

type Type

type Type int

Type represents tunneled connection type.

const (
	HTTP Type = iota + 1
	TCP
	WS
)

ControlMessage protocols.

Jump to

Keyboard shortcuts

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