provider

package
v0.0.0-...-29ee96b Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the provider client.

func NewClient

func NewClient(config Config, logger *zap.Logger) *Client

NewClient creates a new provider Client.

func (*Client) Run

func (c *Client) Run(ctx context.Context) error

Run connects to the broker and accepts streams, reconnecting with backoff on failure. Blocks until ctx is cancelled.

type Config

type Config struct {
	BrokerURL          string
	Endpoint           string
	PollInterval       time.Duration
	RetryBackoff       time.Duration
	DialTimeout        time.Duration
	ScrubHeaders       bool
	InsecureSkipVerify bool   // Skip TLS certificate verification
	AuthToken          string // Authentication token for broker
	// CoalesceWindow is passed through to pollmux.Connector; <= 0 uses
	// pollmux.DefaultCoalesceWindow.
	CoalesceWindow time.Duration
	// PollMode is "" or "stream" (default) to request stream mode, or
	// "batch" to opt out and force the older discrete poll mode.
	PollMode string
	// PollGrace is passed through to pollmux.Connector; <= 0 uses
	// pollmux.DefaultPollGrace. Raise it when the broker sits behind a
	// reverse proxy/CDN whose own latency can push a stream-mode poll's
	// response headers past the default 10s.
	PollGrace time.Duration
	// UploadStreamPreference is passed through to
	// pollmux.Connector.UploadStreamPreference: "" (default) auto-detects,
	// "stream" forces it, "batch" disables it. See that field's doc.
	UploadStreamPreference string
	// UploadProbeTimeout is passed through to
	// pollmux.Connector.UploadProbeTimeout; <= 0 uses pollmux's default (15s).
	UploadProbeTimeout time.Duration
	// PreferWebSocket is passed through to pollmux.Connector.PreferWebSocket.
	// Takes effect only if the broker also has EnableWebSocket on; otherwise
	// negotiation falls back to PollMode as if this were false.
	PreferWebSocket bool
}

Config holds provider configuration.

type ScrubConn

type ScrubConn struct {
	net.Conn
	// contains filtered or unexported fields
}

ScrubConn wraps a net.Conn and scrubs proxy headers from HTTP requests. For TLS or non-HTTP traffic, it passes through unchanged.

func NewScrubConn

func NewScrubConn(conn net.Conn) *ScrubConn

NewScrubConn wraps conn with HTTP proxy header scrubbing.

func (*ScrubConn) Write

func (s *ScrubConn) Write(p []byte) (int, error)

Write inspects data on first call. If HTTP, scrubs proxy headers. After the first HTTP request headers are processed, passes through directly.

type StreamHandler

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

StreamHandler handles a single tunnel stream from the broker.

func NewStreamHandler

func NewStreamHandler(
	dialTimeout time.Duration,
	scrubHeaders bool,
	logger *zap.Logger,
) *StreamHandler

NewStreamHandler creates a new StreamHandler.

func (*StreamHandler) Handle

func (h *StreamHandler) Handle(stream net.Conn)

Handle reads the target address, dials the target, and bridges the stream. This runs in its own goroutine per stream.

Jump to

Keyboard shortcuts

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