proxy

package
v0.0.0-...-5760214 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultTarget

func DefaultTarget(localPort int) string

DefaultTarget returns the default localhost URL for a given port.

func HandleRequest

func HandleRequest(req types.TunnelRequest, upstream string) types.TunnelResponse

HandleRequest proxies a tunnel request to the given upstream base URL.

Types

type UpstreamResolver

type UpstreamResolver func(msg types.WSOpen) string

UpstreamResolver returns the upstream base URL for a WS open, or "" for default.

type WSRelay

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

WSRelay manages proxied visitor WebSocket sessions for a single tunnel connection.

func NewWSRelay

func NewWSRelay(defaultUpstream string, subdomain string, writeJSON func(v any) error, resolve UpstreamResolver, pipeline interface {
	NotifyWSFrame(subdomain, sessionID, direction string, isText bool, payload string, size int)
	NotifyWSSessionStart(subdomain, sessionID string, sender func(isText bool, payload []byte) error)
	NotifyWSSessionEnd(subdomain, sessionID string)
}) *WSRelay

func (*WSRelay) HandleClose

func (r *WSRelay) HandleClose(msg types.WSClose)

HandleClose closes a local WebSocket session.

func (*WSRelay) HandleFrame

func (r *WSRelay) HandleFrame(msg types.WSFrame)

HandleFrame forwards a tunnel frame to the local WebSocket.

func (*WSRelay) HandleOpen

func (r *WSRelay) HandleOpen(msg types.WSOpen)

HandleOpen dials the upstream WebSocket server and starts relaying frames.

Jump to

Keyboard shortcuts

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