tunnel

package
v0.0.0-...-b81126c Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_TUNNEL_URL = "/"

	CONFIG_COMMON      = "common"
	CONFIG_LOCAL_ADDR  = "local_addr"
	CONFIG_REMOTE_ADDR = "remote_addr"
	CONFIG_TUNNEL_ADDR = "tunnel_addr"
	CONFIG_TUNNEL_URL  = "tunnel_url"
	CONFIG_TOKEN       = "Token"
	CONFIG_SMUX        = "IsSmux"
	CONFIG_MODE        = "Mode"
)

Variables

View Source
var (
	HEADER_REMOTE_ADDR = "REMOTE-ADDR"
	HEADER_TOKEN       = "TOKEN"
	HEADER_IS_SMUX     = "IS_SMUX"
	HEADER_MODE        = "mode"
)

Functions

func NewQuitSignal

func NewQuitSignal() <-chan os.Signal

Types

type Client

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

func NewClient

func NewClient(cc *ClientConfig, options ...ClientOption) *Client

func (*Client) ListenAndServe

func (c *Client) ListenAndServe() error

type ClientConfig

type ClientConfig struct {
	LocalAddr  string
	RemoteAddr string
	TunnelAddr string
	TunnelUrl  string
	Token      string
	IsSmux     bool
	Mode       ConnectMode
}

func (*ClientConfig) String

func (c *ClientConfig) String() string

type ClientConfigs

type ClientConfigs []*ClientConfig

func NewClientConfigsFromFile

func NewClientConfigsFromFile(configFile string) *ClientConfigs

type ClientOption

type ClientOption func(client *Client)

type ConnectMode

type ConnectMode string
const (
	CONNECT_HTTP      ConnectMode = "http"
	CONNECT_WEBSOCKET ConnectMode = "websocket"
)

type Server

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

func NewServer

func NewServer(sc *ServerConfig, options ...ServerOption) *Server

func (*Server) Connect

func (s *Server) Connect(w http.ResponseWriter, r *http.Request)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

type ServerConfig

type ServerConfig struct {
	TunnelAddr string
	TunnelUrl  string
	Token      string
}

func (*ServerConfig) String

func (c *ServerConfig) String() string

type ServerConfigs

type ServerConfigs []*ServerConfig

func NewServerConfigsFrom

func NewServerConfigsFrom(configFile string) *ServerConfigs

type ServerOption

type ServerOption func(server *Server)

Jump to

Keyboard shortcuts

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