handlers

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 18 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

This section is empty.

Types

type ClickHouseConfig

type ClickHouseConfig struct {
	Name        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.

func NewClickHouseHandler

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

NewClickHouseHandler creates a new ClickHouse handler.

func (*ClickHouseHandler) Clusters

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

Clusters returns the list of configured cluster names.

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 LokiConfig

type LokiConfig struct {
	Name        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
	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.

type S3Config

type S3Config struct {
	Endpoint        string
	AccessKey       string
	SecretKey       string
	Bucket          string
	Region          string
	PublicURLPrefix string
}

S3Config holds S3 storage proxy configuration.

type S3Handler

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

S3Handler handles requests to S3-compatible storage.

func NewS3Handler

func NewS3Handler(log logrus.FieldLogger, cfg *S3Config) *S3Handler

NewS3Handler creates a new S3 handler.

func (*S3Handler) Bucket

func (h *S3Handler) Bucket() string

Bucket returns the configured bucket name.

func (*S3Handler) GetPublicURL

func (h *S3Handler) GetPublicURL(ctx context.Context, bucket, key string) string

GetPublicURL returns the public URL for an S3 object.

func (*S3Handler) PublicURLPrefix

func (h *S3Handler) PublicURLPrefix() string

PublicURLPrefix returns the public URL prefix for S3 objects.

func (*S3Handler) ServeHTTP

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

ServeHTTP handles S3 requests. Path format: /s3/{bucket}/{key...} Supports: PUT (upload), GET (download), HEAD (metadata), DELETE

Jump to

Keyboard shortcuts

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