api

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// proposer endpoints
	PathStatus            = "/eth/v1/builder/status"
	PathRegisterValidator = "/eth/v1/builder/validators"
	PathGetHeader         = "/eth/v1/builder/header/{slot:[0-9]+}/{parent_hash:0x[a-fA-F0-9]+}/{pubkey:0x[a-fA-F0-9]+}"
	PathGetPayload        = "/eth/v1/builder/blinded_blocks"

	// builder endpoints
	PathGetValidators = "/relay/v1/builder/validators"
	PathSubmitBlock   = "/relay/v1/builder/blocks"

	// data api
	PathBuilderBlocksReceived     = "/relay/v1/data/bidtraces/builder_blocks_received"
	PathProposerPayloadsDelivered = "/relay/v1/data/bidtraces/proposer_payload_delivered"
	PathSpecificRegistration      = "/relay/v1/data/validator_registration"
)

Router paths

Variables

View Source
var (
	ErrParamNotFound = errors.New("not found")
)
View Source
var ErrTooManyCalls = errors.New("too many calls")

Functions

func ParseHeaderRequest

func ParseHeaderRequest(r *http.Request) structs.HeaderRequest

Types

type API

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

func NewApi

func NewApi(l log.Logger, enabled *EnabledEndpoints, r Relay, reg Registrations, st State, lim RateLimitter, dataLimit int, errorsOnDisable bool) (a *API)

func (*API) AttachMetrics

func (api *API) AttachMetrics(m *metrics.Metrics)

func (*API) AttachToHandler

func (a *API) AttachToHandler(m *http.ServeMux)

func (*API) OnConfigChange added in v0.6.0

func (a *API) OnConfigChange(c structs.OldNew) (err error)

type APIMetrics

type APIMetrics struct {
	ApiReqCounter *prometheus.CounterVec
	ApiReqTiming  *prometheus.HistogramVec
	ApiReqElCount *prometheus.HistogramVec

	RelayTiming *prometheus.HistogramVec
}

type Cache added in v0.6.0

type Cache interface {
	Get([48]byte) (*rate.Limiter, bool)
	Add([48]byte, *rate.Limiter) bool
	Purge()
}

type EnabledEndpoints added in v0.4.13

type EnabledEndpoints struct {
	GetHeader   bool
	GetPayload  bool
	SubmitBlock bool
}

func (*EnabledEndpoints) GetBool added in v0.4.13

func (ee *EnabledEndpoints) GetBool(key string) (bool, error)

func (*EnabledEndpoints) SetBool added in v0.4.13

func (ee *EnabledEndpoints) SetBool(key string, val bool) error

type Limitter

type Limitter struct {
	AllowedBuilders map[[48]byte]struct{}

	RateLimit         rate.Limit
	Burst             int
	LimitterCacheSize int
	// contains filtered or unexported fields
}

func NewLimitter

func NewLimitter(l log.Logger, ratel int, burst int, c Cache) *Limitter

func (*Limitter) Allow

func (l *Limitter) Allow(ctx context.Context, pubkey [48]byte) error

func (*Limitter) OnConfigChange added in v0.6.0

func (l *Limitter) OnConfigChange(c structs.OldNew) (err error)

func (*Limitter) ParseInitialConfig added in v0.6.0

func (l *Limitter) ParseInitialConfig(keys []string) (err error)

type RateLimitter

type RateLimitter interface {
	Allow(ctx context.Context, pubkey [48]byte) error
}

type State

type State interface {
	ForkVersion(epoch structs.Slot) structs.ForkVersion
	HeadSlot() structs.Slot
}

Directories

Path Synopsis
Would have been internal if only it wasnt reserved keyword
Would have been internal if only it wasnt reserved keyword
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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