Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrInvalidToken = "invalid_token" ErrRateLimitExceeded = "rate_limit_exceeded" ErrConnectionLimitReached = "connection_limit_reached" ErrInvalidTunnelInfo = "invalid_tunnel_info" ErrUnknownMessageType = "unknown_message_type" ErrTLSHandshakeFailed = "tls_handshake_failed" ErrAuthenticationFailed = "authentication_failed" ErrTunnelCreationFailed = "tunnel_creation_failed" ErrHeartbeatFailed = "heartbeat_failed" )
Error codes as defined in the requirements
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RelayError ¶
type RelayError struct {
Code string `json:"code"`
Message string `json:"message"`
Retry bool `json:"retry,omitempty"`
Delay time.Duration `json:"delay,omitempty"`
}
RelayError represents a relay-specific error
func HandleError ¶
func HandleError(err error) (*RelayError, error)
HandleError handles relay-specific errors and returns appropriate actions
func NewRelayError ¶
func NewRelayError(code, message string) *RelayError
NewRelayError creates a new relay error
func (*RelayError) GetDelay ¶
func (e *RelayError) GetDelay() time.Duration
GetDelay returns the delay before retry
func (*RelayError) IsRetryable ¶
func (e *RelayError) IsRetryable() bool
IsRetryable returns true if the error can be retried
type RetryStrategy ¶
type RetryStrategy struct {
MaxRetries int
BackoffMultiplier float64
MaxBackoff time.Duration
CurrentRetry int
}
RetryStrategy defines retry behavior
func NewRetryStrategy ¶
func NewRetryStrategy(maxRetries int, backoffMultiplier float64, maxBackoff time.Duration) *RetryStrategy
NewRetryStrategy creates a new retry strategy
func (*RetryStrategy) GetNextDelay ¶
func (rs *RetryStrategy) GetNextDelay(err error) time.Duration
GetNextDelay calculates the delay for the next retry
func (*RetryStrategy) ShouldRetry ¶
func (rs *RetryStrategy) ShouldRetry(err error) bool
ShouldRetry determines if an operation should be retried
Click to show internal directories.
Click to hide internal directories.