handlers

package
v0.32.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package handlers provides reverse proxy handlers for each datasource type.

Index

Constants

View Source
const DatasourceHeader = "X-Datasource"

DatasourceHeader is the HTTP header used to specify which datasource to route to.

Variables

This section is empty.

Functions

func WithDatasourceRoute added in v0.25.0

func WithDatasourceRoute(ctx context.Context, routeName string) context.Context

WithDatasourceRoute stores the selected backend route for the current request.

Types

type ClickHouseConfig

type ClickHouseConfig struct {
	Name        string
	RouteName   string
	Description string
	Host        string
	Port        int
	Database    string
	Username    string
	Password    string
	Secure      bool
	SkipVerify  bool
	Timeout     int
}

ClickHouseConfig holds ClickHouse proxy configuration for a single datasource.

type ClickHouseHandler

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

ClickHouseHandler handles requests to ClickHouse datasources. Datasources may be added or removed at runtime (e.g. by autodiscovery), so all access to the datasource map and name list is guarded by mu.

func NewClickHouseHandler

func NewClickHouseHandler(log logrus.FieldLogger, configs []ClickHouseConfig) *ClickHouseHandler

NewClickHouseHandler creates a new ClickHouse handler.

func (*ClickHouseHandler) AddCluster added in v0.26.0

func (h *ClickHouseHandler) AddCluster(cfg ClickHouseConfig)

AddCluster adds or replaces a ClickHouse datasource at runtime.

func (*ClickHouseHandler) ClusterConfig added in v0.26.0

func (h *ClickHouseHandler) ClusterConfig(name string) (ClickHouseConfig, bool)

ClusterConfig returns the current configuration for a datasource name.

func (*ClickHouseHandler) Clusters

func (h *ClickHouseHandler) Clusters() []string

Clusters returns the list of configured ClickHouse datasource names.

func (*ClickHouseHandler) HasCluster added in v0.26.0

func (h *ClickHouseHandler) HasCluster(name string) bool

HasCluster reports whether a datasource is currently configured.

func (*ClickHouseHandler) RemoveCluster added in v0.26.0

func (h *ClickHouseHandler) RemoveCluster(name string)

RemoveCluster removes a ClickHouse datasource at runtime.

func (*ClickHouseHandler) ServeHTTP

func (h *ClickHouseHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles ClickHouse requests. The datasource is specified via X-Datasource header.

type EthNodeConfig

type EthNodeConfig struct {
	Username string
	Password string
}

EthNodeConfig holds credentials for Ethereum node API access. A single credential pair is used for all bn-*.srv.*.ethpandaops.io and rpc-*.srv.*.ethpandaops.io endpoints.

type EthNodeHandler

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

EthNodeHandler proxies requests to Ethereum beacon and execution nodes. Unlike other handlers that use static reverse proxies per instance, this handler constructs upstream URLs dynamically from path segments.

func NewEthNodeHandler

func NewEthNodeHandler(log logrus.FieldLogger, cfg EthNodeConfig) *EthNodeHandler

NewEthNodeHandler creates a new Ethereum node handler.

func (*EthNodeHandler) ServeHTTP

func (h *EthNodeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles beacon and execution node requests. Path format: /{beacon|execution}/{network}/{instance}/... The first segment (beacon/execution) determines the upstream host pattern.

type GitHubConfig added in v0.22.0

type GitHubConfig struct {
	Token string
}

GitHubConfig holds GitHub API proxy configuration.

type GitHubHandler added in v0.22.0

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

GitHubHandler handles GitHub API requests.

func NewGitHubHandler added in v0.22.0

func NewGitHubHandler(log logrus.FieldLogger, cfg GitHubConfig, globalLimiter GlobalTriggerRateLimiter) *GitHubHandler

NewGitHubHandler creates a new GitHub handler. globalLimiter enforces the cross-workflow trigger budget; it may be nil to disable that budget.

func (*GitHubHandler) ServeHTTP added in v0.22.0

func (h *GitHubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP routes GitHub API requests.

type GitHubRunStatusRequest added in v0.22.0

type GitHubRunStatusRequest struct {
	Repository string `json:"repository"`
	RunID      int64  `json:"run_id"`
}

GitHubRunStatusRequest is the request for checking a run's status.

type GitHubRunStatusResponse added in v0.22.0

type GitHubRunStatusResponse struct {
	RunID      int64  `json:"run_id"`
	Status     string `json:"status"`
	Conclusion string `json:"conclusion"`
	HTMLURL    string `json:"html_url"`
}

GitHubRunStatusResponse is the response from a run status check.

type GitHubTriggerRequest added in v0.22.0

type GitHubTriggerRequest struct {
	// Repository is the target GitHub repository (e.g. "ethpandaops/eth-client-docker-image-builder").
	Repository string `json:"repository"`
	// Workflow is the workflow filename (e.g. "build-push-geth.yml").
	Workflow string `json:"workflow"`
	// Ref is the git ref to run the workflow on (typically "master").
	Ref string `json:"ref"`
	// Inputs are the workflow_dispatch inputs.
	Inputs map[string]string `json:"inputs,omitempty"`
}

GitHubTriggerRequest is the request body for triggering a workflow.

type GitHubTriggerResponse added in v0.22.0

type GitHubTriggerResponse struct {
	WorkflowURL string `json:"workflow_url"`
	RunID       int64  `json:"run_id,omitempty"`
	RunURL      string `json:"run_url,omitempty"`
}

GitHubTriggerResponse is the response from a successful workflow trigger.

type GlobalTriggerRateLimiter added in v0.30.0

type GlobalTriggerRateLimiter interface {
	Allow(key string) bool
}

GlobalTriggerRateLimiter enforces the cross-workflow trigger budget. It is satisfied by the proxy's generic rate limiter; Allow consumes one unit from the bucket identified by key and reports whether the trigger may proceed.

type LokiConfig

type LokiConfig struct {
	Name        string
	RouteName   string
	Description string
	URL         string
	Username    string
	Password    string
}

LokiConfig holds Loki proxy configuration for a single datasource.

type LokiHandler

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

LokiHandler handles requests to Loki datasources. The datasource is specified via the X-Datasource header.

func NewLokiHandler

func NewLokiHandler(log logrus.FieldLogger, configs []LokiConfig) *LokiHandler

NewLokiHandler creates a new Loki handler.

func (LokiHandler) ServeHTTP

func (h LokiHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP routes a request to the upstream named by the X-Datasource header.

type PrometheusConfig

type PrometheusConfig struct {
	Name        string
	RouteName   string
	Description string
	URL         string
	Username    string
	Password    string
}

PrometheusConfig holds Prometheus proxy configuration for a single datasource.

type PrometheusHandler

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

PrometheusHandler handles requests to Prometheus datasources. The datasource is specified via the X-Datasource header.

func NewPrometheusHandler

func NewPrometheusHandler(log logrus.FieldLogger, configs []PrometheusConfig) *PrometheusHandler

NewPrometheusHandler creates a new Prometheus handler.

func (PrometheusHandler) ServeHTTP

func (h PrometheusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP routes a request to the upstream named by the X-Datasource header.

Jump to

Keyboard shortcuts

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