Documentation
¶
Overview ¶
Package proxy provides a proxy middleware for engine API requests between Ethereum consensus clients and execution clients via JSON-RPC. Allows for customizing in-flight responses using custom triggers. Useful for performing advanced tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
func WithDestinationAddress ¶
WithDestinationAddress sets the forwarding address requests will be proxied to.
func WithSpoofingCallbacks ¶
func WithSpoofingCallbacks(c *SpoofingCallbacks) Option
WithSpoofingCallbacks sets the proxy spoofing callbacks.
func WithSpoofingConfig ¶
func WithSpoofingConfig(c *SpoofingConfig) Option
WithSpoofingConfig sets the proxy spoofing config.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy server that sits as a middleware between an Ethereum consensus client and an execution client, allowing us to modify in-flight requests and responses for testing purposes.
func New ¶
New creates a proxy server forwarding requests from a consensus client to an execution client.
func (*Proxy) ServeHTTP ¶
func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP by proxying requests from an Ethereum consensus client to an execution client.
func (*Proxy) UpdateSpoofingCallbacks ¶
func (p *Proxy) UpdateSpoofingCallbacks(callbacks *SpoofingCallbacks)
UpdateSpoofingConfig for use at runtime.
func (*Proxy) UpdateSpoofingConfig ¶
func (p *Proxy) UpdateSpoofingConfig(config *SpoofingConfig)
UpdateSpoofingConfig for use at runtime.
type SpoofingCallbacks ¶
type SpoofingCallbacks struct {
// Map of method names to callbacks, where the callback will receive the request bytes as only parameter
RequestCallbacks map[string]func([]byte) *Spoof
// Map of method names to callbacks, where the callback will receive the response bytes as 1st parameter,
// and original request bytes as 2nd parameter
ResponseCallbacks map[string]func([]byte, []byte) *Spoof
}