proxy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCert

func GenerateCert(validFor time.Duration, hosts []string) (cert, key []byte, err error)

hosts is a list of ip / dns names for the certificate

Types

type BuilderConfigHub

type BuilderConfigHub interface {
	PublishConfig(info BuilderInfo) error
	GetBuilders() ([]BuilderInfo, error)
}

type BuilderInfo

type BuilderInfo struct {
	Cert            []byte
	OrderflowSigner common.Address
}

type Config

type Config struct {
	Log *slog.Logger

	UsersListenAddr   string
	NetworkListenAddr string
	CertListenAddr    string
	BuilderEndpoint   string

	CertValidDuration time.Duration
	CertHosts         []string

	BuilderConfigHub BuilderConfigHub
}

type JSONRPCError

type JSONRPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    *any   `json:"data,omitempty"`
}

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string            `json:"jsonrpc"`
	ID      any               `json:"id"`
	Method  string            `json:"method"`
	Params  []json.RawMessage `json:"params"`
}

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string           `json:"jsonrpc"`
	ID      any              `json:"id"`
	Result  *json.RawMessage `json:"result,omitempty"`
	Error   *JSONRPCError    `json:"error,omitempty"`
}

type MockBuilderConfigHub

type MockBuilderConfigHub struct{}

func (MockBuilderConfigHub) GetBuilders

func (m MockBuilderConfigHub) GetBuilders() ([]BuilderInfo, error)

func (MockBuilderConfigHub) PublishConfig

func (m MockBuilderConfigHub) PublishConfig(info BuilderInfo) error

type Proxy

type Proxy struct {
	Config Config
	// contains filtered or unexported fields
}

func New

func New(config Config) (*Proxy, error)

func (*Proxy) GenerateAndPublish

func (prx *Proxy) GenerateAndPublish() error

func (*Proxy) HandleRequest

func (prx *Proxy) HandleRequest(req JSONRPCRequest, signer common.Address, publicEndpoint bool) *JSONRPCError

func (*Proxy) ServeHTTP

func (prx *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Proxy) ServeProxyRequest

func (prx *Proxy) ServeProxyRequest(w http.ResponseWriter, r *http.Request, publicEndpoint bool)

func (*Proxy) StartServersInBackground

func (prx *Proxy) StartServersInBackground() error

Jump to

Keyboard shortcuts

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