Documentation
¶
Index ¶
- Variables
- type RelayMinerConfig
- func (relayMinerConfig *RelayMinerConfig) HydratePocketNodeUrls(yamlPocketNodeConfig *YAMLRelayMinerPocketNodeConfig) error
- func (relayMinerConfig *RelayMinerConfig) HydrateServers(yamlSupplierConfigs []YAMLRelayMinerSupplierConfig) error
- func (relayMinerConfig *RelayMinerConfig) HydrateSuppliers(yamlSupplierConfigs []YAMLRelayMinerSupplierConfig) error
- type RelayMinerMetricsConfig
- type RelayMinerPocketNodeConfig
- type RelayMinerPprofConfig
- type RelayMinerServerConfig
- type RelayMinerServerType
- type RelayMinerSupplierConfig
- type RelayMinerSupplierServiceAuthentication
- type RelayMinerSupplierServiceConfig
- type YAMLRelayMinerConfig
- type YAMLRelayMinerMetricsConfig
- type YAMLRelayMinerPocketNodeConfig
- type YAMLRelayMinerPprofConfig
- type YAMLRelayMinerSupplierConfig
- type YAMLRelayMinerSupplierServiceAuthentication
- type YAMLRelayMinerSupplierServiceConfig
Constants ¶
This section is empty.
Variables ¶
var ( ErrRelayMinerConfigUnmarshalYAML = sdkerrors.Register(codespace, 2100, "config reader cannot unmarshal yaml content") ErrRelayMinerConfigInvalidNodeUrl = sdkerrors.Register(codespace, 2101, "invalid node url in RelayMiner config") ErrRelayMinerConfigInvalidSigningKeyName = sdkerrors.Register(codespace, 2102, "invalid signing key name in RelayMiner config") ErrRelayMinerConfigInvalidSmtStorePath = sdkerrors.Register(codespace, 2103, "invalid smt store path in RelayMiner config") ErrRelayMinerConfigEmpty = sdkerrors.Register(codespace, 2104, "empty RelayMiner config") ErrRelayMinerConfigInvalidSupplier = sdkerrors.Register(codespace, 2105, "invalid supplier in RelayMiner config") ErrRelayMinerConfigInvalidServer = sdkerrors.Register(codespace, 2106, "invalid server in RelayMiner config") )
Functions ¶
This section is empty.
Types ¶
type RelayMinerConfig ¶
type RelayMinerConfig struct { DefaultSigningKeyNames []string Metrics *RelayMinerMetricsConfig PocketNode *RelayMinerPocketNodeConfig Pprof *RelayMinerPprofConfig Servers map[string]*RelayMinerServerConfig SmtStorePath string }
RelayMinerConfig is the structure describing the RelayMiner config
func ParseRelayMinerConfigs ¶
func ParseRelayMinerConfigs(configContent []byte) (*RelayMinerConfig, error)
ParseRelayMinerConfigs parses the relay miner config file into a RelayMinerConfig
func (*RelayMinerConfig) HydratePocketNodeUrls ¶
func (relayMinerConfig *RelayMinerConfig) HydratePocketNodeUrls( yamlPocketNodeConfig *YAMLRelayMinerPocketNodeConfig, ) error
HydratePocketNodeUrls populates the pocket node fields of the RelayMinerConfig that are relevant to the "pocket_node" section in the config file.
func (*RelayMinerConfig) HydrateServers ¶
func (relayMinerConfig *RelayMinerConfig) HydrateServers( yamlSupplierConfigs []YAMLRelayMinerSupplierConfig, ) error
HydrateServers populates the servers fields of the RelayMinerConfig.
func (*RelayMinerConfig) HydrateSuppliers ¶
func (relayMinerConfig *RelayMinerConfig) HydrateSuppliers( yamlSupplierConfigs []YAMLRelayMinerSupplierConfig, ) error
HydrateSuppliers populates the suppliers fields of the RelayMinerConfig that are relevant to the "suppliers" section in the config file.
type RelayMinerMetricsConfig ¶
RelayMinerMetricsConfig is the structure resulting from parsing the metrics section of the RelayMiner config file
type RelayMinerPocketNodeConfig ¶
type RelayMinerPocketNodeConfig struct { QueryNodeRPCUrl *url.URL QueryNodeGRPCUrl *url.URL TxNodeRPCUrl *url.URL }
RelayMinerPocketNodeConfig is the structure resulting from parsing the pocket node URLs section of the RelayMiner config file
type RelayMinerPprofConfig ¶
RelayMinerPprofConfig is the structure resulting from parsing the pprof config section of a RelayMiner config.
type RelayMinerServerConfig ¶
type RelayMinerServerConfig struct { // ServerType is the transport protocol used by the server like (http, https, etc.) ServerType RelayMinerServerType // ListenAddress is the host on which the relay miner server will listen // for incoming relay requests ListenAddress string // XForwardedHostLookup is a flag that indicates whether the relay miner server // should lookup the host from the X-Forwarded-Host header before falling // back to the Host header. XForwardedHostLookup bool // SupplierConfigsMap is a map of serviceIds -> RelayMinerSupplierConfig SupplierConfigsMap map[string]*RelayMinerSupplierConfig }
RelayMinerServerConfig is the structure resulting from parsing the supplier's server section of the RelayMiner config file. Each server section embeds a map of supplier configs that are associated with it. TODO_IMPROVE: Other server types may embed other fields in the future; eg. "https" may embed a TLS config.
type RelayMinerServerType ¶
type RelayMinerServerType int
const (
RelayMinerServerTypeHTTP RelayMinerServerType = iota
)
type RelayMinerSupplierConfig ¶
type RelayMinerSupplierConfig struct { // ServiceId is the serviceId corresponding to the current configuration. ServiceId string // ServerType is the transport protocol used by the supplier, it must match the // type of the relay miner server it is associated with. ServerType RelayMinerServerType // PubliclyExposedEndpoints is a list of hosts advertised on-chain by the supplier, // the corresponding relay miner server will accept relay requests for these hosts. PubliclyExposedEndpoints []string // ServiceConfig is the config of the service that relays will be proxied to. // Other supplier types may embed other fields in the future. eg. "https" may // embed a TLS config. ServiceConfig *RelayMinerSupplierServiceConfig // SigningKeyNames: a list of key names that can accept relays for that supplier. // If empty, we copy the values from `DefaultSigningKeyNames`. SigningKeyNames []string }
RelayMinerSupplierConfig is the structure resulting from parsing the supplier section of the RelayMiner config file.
func (*RelayMinerSupplierConfig) HydrateSupplier ¶
func (supplierConfig *RelayMinerSupplierConfig) HydrateSupplier( yamlSupplierConfig YAMLRelayMinerSupplierConfig, ) error
HydrateSupplier populates a single supplier's fields of the RelayMinerConfig that are relevant to each supplier in the "suppliers" section of the config file.
type RelayMinerSupplierServiceAuthentication ¶
RelayMinerSupplierServiceAuthentication is the structure resulting from parsing the supplier service basic auth of the RelayMiner config file when the supplier is of type "http".
type RelayMinerSupplierServiceConfig ¶
type RelayMinerSupplierServiceConfig struct { // BackendUrl is the URL of the service that relays will be proxied to. BackendUrl *url.URL // Authentication is the basic auth structure used to authenticate to the // request being proxied from the current relay miner server. // If the service the relay requests are forwarded to requires basic auth // then this field must be populated. // TODO_TECHDEBT(@red-0ne): Pass the authentication to the service instance // when the relay request is forwarded to it. Authentication *RelayMinerSupplierServiceAuthentication // Headers is a map of headers to be used for other authentication means. // If the service the relay requests are forwarded to requires header based // authentication then this field must be populated accordingly. // For example: { "Authorization": "Bearer <token>" } // TODO_TECHDEBT(@red-0ne): Add these headers to the forwarded request // before sending it to the service instance. Headers map[string]string }
RelayMinerSupplierServiceConfig is the structure resulting from parsing the supplier service sub-section of the RelayMiner config file.
type YAMLRelayMinerConfig ¶
type YAMLRelayMinerConfig struct { DefaultSigningKeyNames []string `yaml:"default_signing_key_names"` Metrics YAMLRelayMinerMetricsConfig `yaml:"metrics"` PocketNode YAMLRelayMinerPocketNodeConfig `yaml:"pocket_node"` Pprof YAMLRelayMinerPprofConfig `yaml:"pprof"` SmtStorePath string `yaml:"smt_store_path"` Suppliers []YAMLRelayMinerSupplierConfig `yaml:"suppliers"` }
YAMLRelayMinerConfig is the structure used to unmarshal the RelayMiner config file
type YAMLRelayMinerMetricsConfig ¶
YAMLRelayMinerMetricsConfig is the structure used to unmarshal the metrics section of the RelayMiner config file.
type YAMLRelayMinerPocketNodeConfig ¶
type YAMLRelayMinerPocketNodeConfig struct { QueryNodeRPCUrl string `yaml:"query_node_rpc_url"` QueryNodeGRPCUrl string `yaml:"query_node_grpc_url"` TxNodeRPCUrl string `yaml:"tx_node_rpc_url"` }
YAMLRelayMinerPocketNodeConfig is the structure used to unmarshal the pocket node URLs section of the RelayMiner config file.
type YAMLRelayMinerPprofConfig ¶
type YAMLRelayMinerPprofConfig struct { Enabled bool `yaml:"enabled,omitempty"` Addr string `yaml:"addr,omitempty"` }
YAMLRelayMinerPprofConfig is the structure used to unmarshal the config for `pprof`.
type YAMLRelayMinerSupplierConfig ¶
type YAMLRelayMinerSupplierConfig struct { ListenUrl string `yaml:"listen_url"` ServiceConfig YAMLRelayMinerSupplierServiceConfig `yaml:"service_config"` ServiceId string `yaml:"service_id"` SigningKeyNames []string `yaml:"signing_key_names"` XForwardedHostLookup bool `yaml:"x_forwarded_host_lookup"` }
YAMLRelayMinerSupplierConfig is the structure used to unmarshal the supplier section of the RelayMiner config file
type YAMLRelayMinerSupplierServiceAuthentication ¶
type YAMLRelayMinerSupplierServiceAuthentication struct { Username string `yaml:"username,omitempty"` Password string `yaml:"password,omitempty"` }
YAMLRelayMinerSupplierServiceAuthentication is the structure used to unmarshal the supplier service basic auth of the RelayMiner config file when the supplier is of type "http"
type YAMLRelayMinerSupplierServiceConfig ¶
type YAMLRelayMinerSupplierServiceConfig struct { Authentication YAMLRelayMinerSupplierServiceAuthentication `yaml:"authentication,omitempty"` BackendUrl string `yaml:"backend_url"` Headers map[string]string `yaml:"headers,omitempty"` PubliclyExposedEndpoints []string `yaml:"publicly_exposed_endpoints"` }
YAMLRelayMinerSupplierServiceConfig is the structure used to unmarshal the supplier service sub-section of the RelayMiner config file.