ports

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package ports contains entry-point related logic for builder-hub. As of now only way to access builder-hub functionality is via http

Index

Constants

View Source
const (
	AttestationTypeHeader string = "X-Flashbots-Attestation-Type"
	MeasurementHeader     string = "X-Flashbots-Measurement"
	ForwardedHeader       string = "X-Forwarded-For"
)

Variables

View Source
var ErrInvalidAuthData = errors.New("invalid auth data")

Functions

This section is empty.

Types

type AuthData

type AuthData struct {
	AttestationType string
	MeasurementData map[string]string
	IP              net.IP
}

type BuilderHubHandler

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

func NewBuilderHubHandler

func NewBuilderHubHandler(builderHubService BuilderHubService, log *httplog.Logger) *BuilderHubHandler

func (*BuilderHubHandler) GetActiveBuilders

func (bhs *BuilderHubHandler) GetActiveBuilders(w http.ResponseWriter, r *http.Request)

func (*BuilderHubHandler) GetActiveBuildersNoAuth

func (bhs *BuilderHubHandler) GetActiveBuildersNoAuth(w http.ResponseWriter, r *http.Request)

func (*BuilderHubHandler) GetAllowedMeasurements

func (bhs *BuilderHubHandler) GetAllowedMeasurements(w http.ResponseWriter, r *http.Request)

func (*BuilderHubHandler) GetConfigSecrets

func (bhs *BuilderHubHandler) GetConfigSecrets(w http.ResponseWriter, r *http.Request)

func (*BuilderHubHandler) RegisterCredentials

func (bhs *BuilderHubHandler) RegisterCredentials(w http.ResponseWriter, r *http.Request)

type BuilderHubService

type BuilderHubService interface {
	GetAllowedMeasurements(ctx context.Context) ([]domain.Measurement, error)
	GetActiveBuilders(ctx context.Context) ([]domain.BuilderWithServices, error)
	VerifyIPAndMeasurements(ctx context.Context, ip net.IP, measurement map[string]string, attestationType string) (*domain.Builder, string, error)
	GetConfigWithSecrets(ctx context.Context, builderName string) ([]byte, error)
	RegisterCredentialsForBuilder(ctx context.Context, builderName, service, tlsCert string, ecdsaPubKey []byte, measurementName, attestationType string) error
}

type BuilderWithServiceCreds

type BuilderWithServiceCreds struct {
	IP           string
	Name         string
	ServiceCreds map[string]ServiceCred
}

func (BuilderWithServiceCreds) MarshalJSON

func (b BuilderWithServiceCreds) MarshalJSON() ([]byte, error)

MarshalJSON is a custom json marshaller. Unfortunately, there seems to be no way to inline map[string]Service when marshalling so we need to be careful when adding new fields, since custom json implementation will ignore it by default

type Measurement

type Measurement struct {
	Name            string                              `json:"measurement_id"`
	AttestationType string                              `json:"attestation_type"`
	Measurements    map[string]domain.SingleMeasurement `json:"measurements"`
}

type ServiceCred

type ServiceCred struct {
	TLSCert     string          `json:"tls_cert,omitempty"`
	ECDSAPubkey *common.Address `json:"ecdsa_pubkey_address,omitempty"`
}

Jump to

Keyboard shortcuts

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