handler

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 24 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ChannelKeyHeader = "X-Channel-Key"

ChannelKeyHeader carries a secret of the client when auth is disabled. The channel is bound to it, so that only the same client can issue the channel again (e.g. after a restart) or connect to it.

View Source
const (

	// DefaultWebhookMaxBodySize is the default limit of a webhook request body.
	DefaultWebhookMaxBodySize = 10 << 20
)

Variables

This section is empty.

Functions

func GetLocalIP

func GetLocalIP() string

Types

type ClientConn

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

type InternalChannelsResp

type InternalChannelsResp struct {
	WsChannels      []string `json:"ws_channels"`
	WebhookChannels []string `json:"webhook_channels"`
	ServerURL       string   `json:"server_url"`
}

type MemberlistHandler

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

MemberlistHandler serves the tunnel for clusters whose nodes can reach each other directly. Traefik routes each channel to the node holding its WebSocket using /traefik-config.

func NewMemberlistHandler

func NewMemberlistHandler(opts Options, c cluster.PeerCluster) *MemberlistHandler

NewMemberlistHandler creates the handler and subscribes it to messages from the cluster. The cluster must be started by the caller after this.

func (*MemberlistHandler) BuildMux

func (h *MemberlistHandler) BuildMux() *http.ServeMux

BuildMux constructs the HTTP route table for the server.

func (*MemberlistHandler) CleanNonActiveSession

func (h *MemberlistHandler) CleanNonActiveSession()

type Options

type Options struct {
	MyIP string
	Port int
	// ServerCtx is canceled when the server shuts down, to notify WebSocket connections.
	ServerCtx context.Context
	// WebhookMaxBodySize limits the webhook request body in bytes. DefaultWebhookMaxBodySize is used if 0.
	WebhookMaxBodySize int64

	AuthEnabled        bool
	JwtSecret          []byte
	GithubClientID     string
	GithubClientSecret string
	GithubOrg          string
}

type PubSubHandler

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

PubSubHandler serves the tunnel when nodes cannot reach each other directly (e.g. replicas spread across clusters). Any node can accept /new, /ws and /webhook; a webhook is relayed through the broker to the node holding the channel's WebSocket, and the response is relayed back.

func NewPubSubHandler

func NewPubSubHandler(opts Options, relay cluster.Relay) *PubSubHandler

NewPubSubHandler creates the handler and registers its callbacks to the relay. The relay must be started by the caller after this.

func (*PubSubHandler) BuildMux

func (h *PubSubHandler) BuildMux() *http.ServeMux

func (*PubSubHandler) CleanNonActiveSession

func (h *PubSubHandler) CleanNonActiveSession()

type TunnelMessage

type TunnelMessage struct {
	ReqID   string `json:"req_id"`
	Payload []byte `json:"payload,omitempty"`
	EOF     bool   `json:"eof,omitempty"`
}

Jump to

Keyboard shortcuts

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