manager

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConnection      = errors.New("no connection available")
	ErrSubdomainNotFound = errors.New("subdomain not found")
)

Functions

func SendHttpResponse

func SendHttpResponse(conn net.Conn, statusCode int, msg string, args ...any)

Types

type Manager

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

Manager handles routing of connections between clients and local services.

func New

func New() *Manager

New creates a new router.

func (*Manager) Acquire

func (m *Manager) Acquire(subdomain string) (transport.Stream, error)

func (*Manager) ForEachClient

func (m *Manager) ForEachClient(fn func(subdomain string, info *connection.Connection))

ForEachClient iterates over all clients and calls the provided function for each one.

func (*Manager) HandleConnection

func (m *Manager) HandleConnection(transp transport.Transport)

HandleConnection handles a new connection.

func (*Manager) HandleHTTPConnection

func (r *Manager) HandleHTTPConnection(conn net.Conn)

HandleHTTPConnection handles an HTTP connection.

func (*Manager) HandleStream

func (m *Manager) HandleStream(client *connection.Connection, msg *protocol.Message) error

func (*Manager) HandleStreamDude

func (m *Manager) HandleStreamDude(stream transport.Stream)

func (*Manager) IsAuthorized

func (m *Manager) IsAuthorized(token string) bool

IsAuthorized evaluates the provided token using the installed validator. When no validator is configured, it returns true (allow).

func (*Manager) Release

func (m *Manager) Release(subdomain string, stream transport.Stream)

func (*Manager) SetGunnelSubdomainHandler

func (m *Manager) SetGunnelSubdomainHandler(handler http.HandlerFunc)

func (*Manager) SetTokenValidator

func (m *Manager) SetTokenValidator(validator func(string) bool)

SetTokenValidator defines a callback used to authorize client registration tokens. If not set, all registrations are allowed.

type ResponseWriterWrapper

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

func NewResponseWriterWrapper

func NewResponseWriterWrapper(conn net.Conn) *ResponseWriterWrapper

func (*ResponseWriterWrapper) Flush

func (rw *ResponseWriterWrapper) Flush()

func (*ResponseWriterWrapper) Header

func (rw *ResponseWriterWrapper) Header() http.Header

func (*ResponseWriterWrapper) Write

func (rw *ResponseWriterWrapper) Write(data []byte) (int, error)

func (*ResponseWriterWrapper) WriteHeader

func (rw *ResponseWriterWrapper) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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