types

package
v1.28.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthType

type AuthType string

AuthType represents the authentication type

const (
	AuthTypeToken       AuthType = "token"
	AuthTypeCredentials AuthType = "credentials"
	AuthTypePublic      AuthType = "public"
)

type BandwidthLimit

type BandwidthLimit = limiter.BandwidthLimit

BandwidthLimit and ClientBandwidthLimits are now defined in limiter package These are kept here for backward compatibility, but should use limiter package types

type BandwidthLimiter

type BandwidthLimiter = limiter.BandwidthLimiter

BandwidthLimiter interface is now defined in limiter package

type CallbackContainer

type CallbackContainer interface {
	Get(tcpId string, requestId string) CallbackFunc
	Take(tcpId string, requestId string) CallbackFunc
	Set(tcpId string, requestId string, callback CallbackFunc)
	Remove(tcpId string)
}

CallbackContainer interface for callback operations

type CallbackFunc

type CallbackFunc func(data string)

CallbackFunc is a function type for handling HTTP responses

type ClientBandwidthLimits

type ClientBandwidthLimits = limiter.ClientBandwidthLimits

type Context

type Context struct {
	Config            *ServerConfig
	DomainMappings    DomainMappingContainer
	CallbackContainer CallbackContainer
	Container         TunnelContainer
	TrafficStats      TrafficStatsContainer
	BandwidthLimiter  BandwidthLimiter
	// HTTPStreamDispatch handles semantic HTTP response frames (MessageType 0x09/0x0a) from the client.
	// msgType is the binary protocol message type byte. Returns true if the frame was consumed.
	HTTPStreamDispatch func(tcpID, requestID string, msgType uint8, payload []byte, fin bool) bool
}

Context contains all server context components

type DomainMapping

type DomainMapping struct {
	WSSocket       *websocket.Conn
	TCPSocket      *net.Conn
	ClientID       string
	HTTPAuths      []client.HTTPTunnelAuth
	Adapter        interface{} // protocol.ProtocolAdapter (using interface{} to avoid circular import)
	UseNewProtocol bool
}

DomainMapping represents a domain mapping entry

type DomainMappingContainer

type DomainMappingContainer interface {
	Get(id string) *DomainMapping
	GetAll() map[string]*DomainMapping
	Has(id string) bool
	BindWS(wsSocket *websocket.Conn, subDomain string) string
	UnbindWS(id string)
	BindTCP(id string, tcpSocket *net.Conn)
}

DomainMappingContainer interface for domain mapping operations

type GetToken

type GetToken func(authType AuthType, clientId string, options *GetTokenOptions) (*TokenResponse, error)

GetToken is a function type for retrieving tokens

type GetTokenOptions

type GetTokenOptions struct {
	Type        TunnelType `json:"type,omitempty"`
	OpaqueChild bool       `json:"opaqueChild,omitempty"` // true: spawned session; omit tunnel list in token
}

GetTokenOptions contains options for token retrieval

type ServerConfig

type ServerConfig struct {
	Version                    string
	BinName                    string
	PackageName                string
	WSPath                     string // Legacy protocol path (/_client)
	WSMonitorPath              string // New protocol monitor channel path (/_/monitor)
	WSDataPath                 string // New protocol data channel path (/_/data)
	DefaultRemote              string
	DefaultTCPPort             int
	DefaultSecure              bool
	DefaultHealthCheckInterval time.Duration
}

ServerConfig contains server configuration

func DefaultServerConfig

func DefaultServerConfig() *ServerConfig

DefaultServerConfig returns the default server configuration

type TokenResponse

type TokenResponse struct {
	AuthType AuthType       `json:"authType"`
	Token    string         `json:"token"`
	Config   *client.Config `json:"config,omitempty"`
}

TokenResponse represents the response from GetToken function

type TrafficStats

type TrafficStats = stats.TrafficStats

TrafficStats and TrafficStatsData are now defined in stats package These are kept here for backward compatibility, but should use stats package types

type TrafficStatsContainer

type TrafficStatsContainer = stats.TrafficStatsContainer

TrafficStatsContainer interface is now defined in stats package

type TrafficStatsData

type TrafficStatsData = stats.TrafficStatsData

type TunnelContainer

type TunnelContainer interface {
	Create(id string, token GetToken, wsSocket *websocket.Conn, auth *client.Authentication, writeMu *sync.Mutex)
	Get(id string) *TunnelMapping
	Set(id string, key string, value interface{}) error
	Remove(id string)
	RegisterRequest(containerId string, requestId string, sourceSocket *net.Conn)
	ConnectRequest(containerId string, requestId string, targetSocket *net.Conn) error
}

TunnelContainer interface for tunnel container operations

type TunnelMapping

type TunnelMapping struct {
	WSSocket        *websocket.Conn
	DataSockets     map[string]*websocket.Conn // Per-stream data channel connections
	DataWriteMu     map[string]*sync.Mutex     // Per-stream data channel write mutex
	DataMu          *sync.RWMutex              // Guard for data channel maps
	WriteMu         *sync.Mutex                // Mutex for write operations (gorilla/websocket requires serialized writes)
	Token           GetToken
	Type            TunnelType
	Port            int
	TargetPort      *int
	SourcePort      *int
	SourceServer    net.Listener
	Version         string
	AuthType        AuthType
	ClientId        string
	Signature       string
	ClientTimestamp int64
	TunnelPort      *int
	Requests        map[string]*net.Conn
	Adapter         interface{} // protocol.ProtocolAdapter (using interface{} to avoid circular import)
	UseNewProtocol  bool
	Destroy         func()
}

TunnelMapping represents a tunnel container mapping

type TunnelType

type TunnelType string

TunnelType represents the type of tunnel

const (
	TunnelTypeHTTP TunnelType = "http"
	TunnelTypeTCP  TunnelType = "tcp"
)

Jump to

Keyboard shortcuts

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