Documentation ¶
Index ¶
- Constants
- Variables
- func AddRollingLogConfig(cmd *cobra.Command)
- func BaseTimePerCU(cu uint64) time.Duration
- func CapContextTimeout(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
- func ContextOutOfTime(ctx context.Context) bool
- func FindSequenceNumber(sequence string) (int, error)
- func GetExtensionNames(extensionCollection []*spectypes.Extension) (extensions []string)
- func GetIpFromGrpcContext(ctx context.Context) string
- func GetRemainingTimeoutFromContext(ctx context.Context) (timeRemaining time.Duration)
- func GetTimePerCu(cu uint64) time.Duration
- func GetTokenFromGrpcContext(ctx context.Context) string
- func GetUniqueToken(consumerAddress string, ip string) string
- func IsTestMode(ctx context.Context) bool
- func IsTimeout(errArg error) bool
- func LocalNodeTimePerCu(cu uint64) time.Duration
- func ParseEndpointArgs(endpoint_strings, yaml_config_properties []string, endpointsConfigName string) (viper_endpoints *viper.Viper, err error)
- func SetupRollingLogger() func()
- func ValidateEndpoint(endpoint, apiInterface string) error
- func VerifyAndHandleUnsupportedFlags(currentFlags *pflag.FlagSet) error
- type AuthConfig
- type ChainMessageGetApiInterface
- type ConflictHandlerInterface
- type ConsumerCmdFlags
- type NodeUrl
- func (url *NodeUrl) LowerContextTimeout(ctx context.Context, chainMessage ChainMessageGetApiInterface, ...) (context.Context, context.CancelFunc)
- func (url *NodeUrl) LowerContextTimeoutWithDuration(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)
- func (url *NodeUrl) SetAuthHeaders(ctx context.Context, headerSetter func(string, string))
- func (url *NodeUrl) SetIpForwardingIfNecessary(ctx context.Context, headerSetter func(string, string))
- func (nurl NodeUrl) String() string
- func (nurl *NodeUrl) UrlStr() string
- type ProviderInfo
- type RelayResult
- type Test_mode_ctx_key
- type TxResultData
Constants ¶
View Source
const ( RollingLogLevelFlag = "rolling-log-level" RollingLogMaxSizeFlag = "rolling-log-max-size" RollingLogMaxAgeFlag = "rolling-log-max-age" RollingLogBackupsFlag = "rolling-log-backups" RollingLogFileLocationFlag = "rolling-log-file-location" RollingLogFormat = "rolling-log-format" )
View Source
const ( ProcessStartLogText = "Process Started" // cors related flags CorsHeadersFlag = "cors-headers" // comma separated list of headers, or * for all, default simple cors specification headers CorsCredentialsFlag = "cors-credentials" // comma separated list of headers, or * for all, default simple cors specification headers CorsOriginFlag = "cors-origin" // comma separated list of origins, or * for all, default enabled completely CorsMethodsFlag = "cors-methods" // comma separated list of methods, default "GET,POST,PUT,DELETE,OPTIONS" CDNCacheDurationFlag = "cdn-cache-duration" // how long to cache the preflight response default 24 hours (in seconds) "86400" RelaysHealthEnableFlag = "relays-health-enable" // enable relays health check, default true RelayHealthIntervalFlag = "relays-health-interval" // interval between each relay health check, default 5m )
View Source
const ( CONSISTENCY_SELECT_ALLPROVIDERS = 1 NOSTATE = 0 )
View Source
const ( EndpointsConfigName = "endpoints" SaveConfigFlagName = "save-conf" GeolocationFlag = "geolocation" TestModeFlagName = "test-mode" MaximumConcurrentProvidersFlagName = "concurrent-providers" StatusCodeMetadataKey = "status-code" VersionMetadataKey = "lavap-version" )
View Source
const ( URL_QUERY_PARAMETERS_SEPARATOR_FROM_PATH = "?" URL_QUERY_PARAMETERS_SEPARATOR_OTHER_PARAMETERS = "&" IP_FORWARDING_HEADER_NAME = "X-Forwarded-For" PROVIDER_ADDRESS_HEADER_NAME = "Lava-Provider-Address" RETRY_COUNT_HEADER_NAME = "Lava-Retries" GUID_HEADER_NAME = "Lava-Guid" // these headers need to be lowercase BLOCK_PROVIDERS_ADDRESSES_HEADER_NAME = "lava-providers-block" RELAY_TIMEOUT_HEADER_NAME = "lava-relay-timeout" EXTENSION_OVERRIDE_HEADER_NAME = "lava-extension" FORCE_CACHE_REFRESH_HEADER_NAME = "lava-force-cache-refresh" // send http request to /lava/health to see if the process is up - (ret code 200) DEFAULT_HEALTH_PATH = "/lava/health" MAXIMUM_ALLOWED_TIMEOUT_EXTEND_MULTIPLIER_BY_THE_CONSUMER = 4 )
View Source
const ( TimePerCU = uint64(100 * time.Millisecond) MinimumTimePerRelayDelay = time.Second DataReliabilityTimeoutIncrease = 5 * time.Second AverageWorldLatency = 300 * time.Millisecond CommunicateWithLocalLavaNodeTimeout = (3 * time.Second) + AverageWorldLatency )
Variables ¶
View Source
var ( ContextDeadlineExceededError = sdkerrors.New("ContextDeadlineExceeded Error", 300, "context deadline exceeded") StatusCodeError504 = sdkerrors.New("Disallowed StatusCode Error", 504, "Disallowed status code error") StatusCodeError429 = sdkerrors.New("Disallowed StatusCode Error", 429, "Disallowed status code error") StatusCodeErrorStrict = sdkerrors.New("Disallowed StatusCode Error", 800, "Disallowed status code error") )
Functions ¶
func AddRollingLogConfig ¶
default rolling logs behavior (if enabled) will store 3 files each 100MB for up to 1 day every time.
func BaseTimePerCU ¶
func CapContextTimeout ¶
func ContextOutOfTime ¶
func FindSequenceNumber ¶
extract requested sequence number from tx error.
func GetExtensionNames ¶
func GetIpFromGrpcContext ¶
func GetTimePerCu ¶
func GetTokenFromGrpcContext ¶
func GetUniqueToken ¶
func IsTestMode ¶
func LocalNodeTimePerCu ¶
func ParseEndpointArgs ¶
func SetupRollingLogger ¶
func SetupRollingLogger() func()
func ValidateEndpoint ¶
Types ¶
type AuthConfig ¶
type AuthConfig struct { AuthHeaders map[string]string `yaml:"auth-headers,omitempty" json:"auth-headers,omitempty" mapstructure:"auth-headers"` AuthQuery string `yaml:"auth-query,omitempty" json:"auth-query,omitempty" mapstructure:"auth-query"` UseTLS bool `yaml:"use-tls,omitempty" json:"use-tls,omitempty" mapstructure:"use-tls"` AllowInsecure bool `yaml:"allow-insecure,omitempty" json:"allow-insecure,omitempty" mapstructure:"allow-insecure"` KeyPem string `yaml:"key-pem,omitempty" json:"key-pem,omitempty" mapstructure:"key-pem"` CertPem string `yaml:"cert-pem,omitempty" json:"cert-pem,omitempty" mapstructure:"cert-pem"` CaCert string `yaml:"cacert-pem,omitempty" json:"cacert-pem,omitempty" mapstructure:"cacert-pem"` }
func (*AuthConfig) AddAuthPath ¶
func (ac *AuthConfig) AddAuthPath(url string) string
func (*AuthConfig) GetCaCertificateParams ¶
func (ac *AuthConfig) GetCaCertificateParams() string
File containing trusted root certificates for verifying the server.
func (*AuthConfig) GetLoadingCertificateParams ¶
func (ac *AuthConfig) GetLoadingCertificateParams() (string, string)
File containing client certificate (public key), to present to the server. + File containing client private key, to present to the server.
func (*AuthConfig) GetUseTls ¶
func (ac *AuthConfig) GetUseTls() bool
type ConflictHandlerInterface ¶
type ConflictHandlerInterface interface { ConflictAlreadyReported() bool StoreConflictReported() }
type ConsumerCmdFlags ¶
type ConsumerCmdFlags struct { HeadersFlag string // comma separated list of headers, or * for all, default simple cors specification headers CredentialsFlag string // access-control-allow-credentials, defaults to "true" OriginFlag string // comma separated list of origins, or * for all, default enabled completely MethodsFlag string // whether to allow access control headers *, most proxies have their own access control so its not required CDNCacheDuration string // how long to cache the preflight response defaults 24 hours (in seconds) "86400" RelaysHealthEnableFlag bool // enables relay health check RelaysHealthIntervalFlag time.Duration // interval for relay health check }
helper struct to propagate flags deeper into the code in an organized manner
type NodeUrl ¶
type NodeUrl struct { Url string `yaml:"url,omitempty" json:"url,omitempty" mapstructure:"url"` InternalPath string `yaml:"internal-path,omitempty" json:"internal-path,omitempty" mapstructure:"internal-path"` AuthConfig AuthConfig `yaml:"auth-config,omitempty" json:"auth-config,omitempty" mapstructure:"auth-config"` IpForwarding bool `yaml:"ip-forwarding,omitempty" json:"ip-forwarding,omitempty" mapstructure:"ip-forwarding"` Timeout time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" mapstructure:"timeout"` Addons []string `yaml:"addons,omitempty" json:"addons,omitempty" mapstructure:"addons"` SkipVerifications []string `yaml:"skip-verifications,omitempty" json:"skip-verifications,omitempty" mapstructure:"skip-verifications"` }
func (*NodeUrl) LowerContextTimeout ¶
func (url *NodeUrl) LowerContextTimeout(ctx context.Context, chainMessage ChainMessageGetApiInterface, averageBlockTime time.Duration) (context.Context, context.CancelFunc)
func (*NodeUrl) LowerContextTimeoutWithDuration ¶
func (*NodeUrl) SetAuthHeaders ¶
func (*NodeUrl) SetIpForwardingIfNecessary ¶
type ProviderInfo ¶
type RelayResult ¶
type RelayResult struct { Request *pairingtypes.RelayRequest Reply *pairingtypes.RelayReply ProviderInfo ProviderInfo ReplyServer *pairingtypes.Relayer_RelaySubscribeClient Finalized bool ConflictHandler ConflictHandlerInterface StatusCode int }
func (*RelayResult) GetProvider ¶
func (rr *RelayResult) GetProvider() string
func (*RelayResult) GetReply ¶
func (rr *RelayResult) GetReply() *pairingtypes.RelayReply
func (*RelayResult) GetReplyServer ¶
func (rr *RelayResult) GetReplyServer() *pairingtypes.Relayer_RelaySubscribeClient
func (*RelayResult) GetStatusCode ¶
func (rr *RelayResult) GetStatusCode() int
type Test_mode_ctx_key ¶
type Test_mode_ctx_key struct{}
type TxResultData ¶
func ParseTransactionResult ¶
func ParseTransactionResult(parsedValues map[string]any) (retData TxResultData, err error)
Click to show internal directories.
Click to hide internal directories.