Documentation
¶
Index ¶
- Constants
- 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 RelayMinerPingConfig
- type RelayMinerPocketNodeConfig
- type RelayMinerPprofConfig
- type RelayMinerServerConfig
- type RelayMinerServerType
- type RelayMinerSupplierConfig
- type RelayMinerSupplierServiceAuthentication
- type RelayMinerSupplierServiceConfig
- type YAMLRelayMinerConfig
- type YAMLRelayMinerMetricsConfig
- type YAMLRelayMinerPingConfig
- type YAMLRelayMinerPocketNodeConfig
- type YAMLRelayMinerPprofConfig
- type YAMLRelayMinerSupplierConfig
- type YAMLRelayMinerSupplierServiceAuthentication
- type YAMLRelayMinerSupplierServiceConfig
Constants ¶
const DefaultRequestTimeoutSeconds = 10
DefaultRequestTimeoutSeconds is the default timeout for requests in seconds. If not specified in the config, it will be used as a fallback.
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") ErrRelayMinerConfigInvalidRequestTimeout = sdkerrors.Register(codespace, 2107, "invalid request timeout specified in RelayMiner config") )
Functions ¶
This section is empty.
Types ¶
type RelayMinerConfig ¶
type RelayMinerConfig struct {
DefaultSigningKeyNames []string
DefaultRequestTimeoutSeconds uint64
Metrics *RelayMinerMetricsConfig
PocketNode *RelayMinerPocketNodeConfig
Pprof *RelayMinerPprofConfig
Servers map[string]*RelayMinerServerConfig
SmtStorePath string
Ping *RelayMinerPingConfig
EnableOverServicing bool
}
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 RelayMinerPingConfig ¶ added in v0.0.14
type RelayMinerPingConfig struct {
Enabled bool
// Addr is the address to bind to (format: hostname:port) where 'hostname' can be a DNS name or an IP
Addr string
}
TODO_TECHDEBT(@red-0ne): Remove this structure altogether. See the discussion here for ref: https://github.com/pokt-network/poktroll/pull/1037/files#r1928599958 RelayMinerPingConfig is the structure resulting from parsing the ping server configuration.
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 RelayMinerServerType
// 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
// RequestTimeoutSeconds is the timeout in seconds for the relay requests forwarded
// to the backend service.
RequestTimeoutSeconds uint64
}
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.
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>" }
Headers map[string]string
// ForwardPocketHeaders toggles if headers prefixed with 'Pocket-' should be forwarded to
// the backend service servicing the relay requests.
ForwardPocketHeaders bool
}
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"`
DefaultRequestTimeoutSeconds uint64 `yaml:"default_request_timeout_seconds"`
Metrics YAMLRelayMinerMetricsConfig `yaml:"metrics"`
PocketNode YAMLRelayMinerPocketNodeConfig `yaml:"pocket_node"`
Pprof YAMLRelayMinerPprofConfig `yaml:"pprof"`
SmtStorePath string `yaml:"smt_store_path"`
Suppliers []YAMLRelayMinerSupplierConfig `yaml:"suppliers"`
Ping YAMLRelayMinerPingConfig `yaml:"ping"`
EnableOverServicing bool `yaml:"enable_over_servicing"`
}
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 YAMLRelayMinerPingConfig ¶ added in v0.0.14
type YAMLRelayMinerPingConfig struct {
Enabled bool `yaml:"enabled"`
// Addr is the address to bind to (format: 'hostname:port') where 'hostname' can be a DNS name or an IP
Addr string `yaml:"addr"`
}
YAMLRelayMinerPingConfig represents the configuration to expose a ping server.
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"`
RequestTimeoutSeconds uint64 `yaml:"request_timeout_seconds"`
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"`
ForwardPocketHeaders bool `yaml:"forward_pocket_headers"`
}
YAMLRelayMinerSupplierServiceConfig is the structure used to unmarshal the supplier service sub-section of the RelayMiner config file.