utils

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLength = 32
	MinLength     = 32
	MaxLength     = 96
)
View Source
const (
	StartBackoff = 1 * time.Second
	MaxBackoff   = 5 * time.Second
	MaxTries     = 1
)

Variables

View Source
var RetryCodes = map[int]bool{
	422: true,
	425: true,
	500: true,
	502: true,
	408: true,
}

Functions

func AmazonTraceIDGen added in v0.16.0

func AmazonTraceIDGen() string

func GenerateID

func GenerateID() string

GenerateID returns UUID without dash

func GenerateMessageID

func GenerateMessageID() string

func SetHeader added in v0.14.0

func SetHeader(inner http.RoundTripper, userAgent, xAmazonTraceID string) http.RoundTripper

func UserAgentGen added in v0.13.0

func UserAgentGen() string

Types

type Backoff added in v0.19.0

type Backoff interface {
	// Get delay's duration
	Get(attempt uint) time.Duration
}

Backoff interface

func NewConstantBackoff added in v0.19.0

func NewConstantBackoff(duration time.Duration) Backoff

func NewExponentialBackoff added in v0.19.0

func NewExponentialBackoff(start time.Duration, max time.Duration) Backoff

type CodeVerifier

type CodeVerifier struct {
	Value string
}

func CreateCodeVerifier

func CreateCodeVerifier() (*CodeVerifier, error)

func CreateCodeVerifierFromBytes

func CreateCodeVerifierFromBytes(b []byte) (*CodeVerifier, error)

func CreateCodeVerifierWithLength

func CreateCodeVerifierWithLength(length int) (*CodeVerifier, error)

func (*CodeVerifier) CodeChallengePlain

func (v *CodeVerifier) CodeChallengePlain() string

func (*CodeVerifier) CodeChallengeS256

func (v *CodeVerifier) CodeChallengeS256() string

func (*CodeVerifier) String

func (v *CodeVerifier) String() string

type CustomTransport added in v0.18.0

type CustomTransport struct {
	UserAgent      string
	XAmazonTraceID string
	// contains filtered or unexported fields
}

func (*CustomTransport) RoundTrip added in v0.18.0

func (c *CustomTransport) RoundTrip(r *http.Request) (*http.Response, error)

type Retry added in v0.19.0

type Retry struct {
	RetryCodes map[int]bool
	MaxTries   uint
	Backoff    Backoff
	Transport  http.RoundTripper
	Sleeper    func(duration time.Duration)
}

Retry struct with http.RoundTripper.

func (Retry) RoundTrip added in v0.19.0

func (m Retry) RoundTrip(req *http.Request) (*http.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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