proxy

package
v0.0.0-...-b8c38bb Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRelayerProxyUnsupportedRPCType        = sdkerrors.Register(codespace, 1, "unsupported rpc type")
	ErrRelayerProxyInvalidSession            = sdkerrors.Register(codespace, 2, "invalid session in relayer request")
	ErrRelayerProxyInvalidSupplier           = sdkerrors.Register(codespace, 3, "supplier does not belong to session")
	ErrRelayerProxyUndefinedSigningKeyName   = sdkerrors.Register(codespace, 4, "supplier signing key name is undefined")
	ErrRelayerServicesConfigsUndefined       = sdkerrors.Register(codespace, 5, "services configurations are undefined")
	ErrRelayerProxyInvalidRelayRequest       = sdkerrors.Register(codespace, 6, "invalid relay request")
	ErrRelayerProxyInvalidRelayResponse      = sdkerrors.Register(codespace, 7, "invalid relay response")
	ErrRelayerProxyServiceEndpointNotHandled = sdkerrors.Register(codespace, 8, "service endpoint not handled by relayer proxy")
	ErrRelayerProxyUnsupportedTransportType  = sdkerrors.Register(codespace, 9, "unsupported proxy transport type")
)

Functions

func NewRelayerProxy

func NewRelayerProxy(
	deps depinject.Config,
	opts ...relayer.RelayerProxyOption,
) (relayer.RelayerProxy, error)

NewRelayerProxy creates a new relayer proxy with the given dependencies or returns an error if the dependencies fail to resolve or the options are invalid.

Required dependencies:

  • cosmosclient.Context
  • client.BlockClient

Available options:

  • WithSigningKeyName
  • WithServicesConfigMap

func NewSynchronousServer

func NewSynchronousServer(
	logger polylog.Logger,
	serverConfig *config.RelayMinerServerConfig,
	supplierServiceMap map[string]*sharedtypes.Service,
	servedRelaysProducer chan<- *types.Relay,
	proxy relayer.RelayerProxy,
) relayer.RelayServer

NewSynchronousServer creates a new HTTP server that listens for incoming relay requests and forwards them to the supported proxied service endpoint. It takes the serviceId, endpointUrl, and the main RelayerProxy as arguments and returns a RelayServer that listens to incoming RelayRequests.

func WithServicesConfigMap

func WithServicesConfigMap(servicesConfigMap map[string]*config.RelayMinerServerConfig) relayer.RelayerProxyOption

WithServicesConfigMap updates the configurations of all the services the RelayMiner proxies requests to. servicesConfigMap is a map of server endpoints to their respective parsed configurations.

func WithSigningKeyName

func WithSigningKeyName(keyName string) relayer.RelayerProxyOption

WithSigningKeyName sets the signing key name used by the relayer proxy to sign relay responses. It is used along with the keyring to get the supplier address and sign the relay responses.

Types

This section is empty.

Jump to

Keyboard shortcuts

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