handlers

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 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 cluster.

type ClickHouseHandler

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

ClickHouseHandler handles requests to ClickHouse clusters. Clusters may be added or removed at runtime (e.g. by autodiscovery), so all access to the cluster 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 cluster 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 cluster name.

func (*ClickHouseHandler) Clusters

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

Clusters returns the list of configured cluster names.

func (*ClickHouseHandler) HasCluster added in v0.26.0

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

HasCluster reports whether a cluster is currently configured.

func (*ClickHouseHandler) RemoveCluster added in v0.26.0

func (h *ClickHouseHandler) RemoveCluster(name string)

RemoveCluster removes a ClickHouse cluster at runtime.

func (*ClickHouseHandler) ServeHTTP

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

ServeHTTP handles ClickHouse requests. The cluster 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) *GitHubHandler

NewGitHubHandler creates a new GitHub handler.

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 LokiConfig

type LokiConfig struct {
	Name        string
	RouteName   string
	Description string
	URL         string
	Username    string
	Password    string
	SkipVerify  bool
	Timeout     int
}

LokiConfig holds Loki proxy configuration for a single instance.

type LokiHandler

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

LokiHandler handles requests to Loki instances.

func NewLokiHandler

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

NewLokiHandler creates a new Loki handler.

func (*LokiHandler) Instances

func (h *LokiHandler) Instances() []string

Instances returns the list of configured instance names.

func (*LokiHandler) ServeHTTP

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

ServeHTTP handles Loki requests. The instance is specified via X-Datasource header.

type PrometheusConfig

type PrometheusConfig struct {
	Name        string
	RouteName   string
	Description string
	URL         string
	Username    string
	Password    string
	SkipVerify  bool
	Timeout     int
}

PrometheusConfig holds Prometheus proxy configuration for a single instance.

type PrometheusHandler

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

PrometheusHandler handles requests to Prometheus instances.

func NewPrometheusHandler

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

NewPrometheusHandler creates a new Prometheus handler.

func (*PrometheusHandler) Instances

func (h *PrometheusHandler) Instances() []string

Instances returns the list of configured instance names.

func (*PrometheusHandler) ServeHTTP

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

ServeHTTP handles Prometheus requests. The instance is specified via X-Datasource header.

Jump to

Keyboard shortcuts

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