stickycookie

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESValue

type AESValue struct {
	// contains filtered or unexported fields
}

AESValue manages hashed sticky value.

func NewAESValue

func NewAESValue(key []byte, ttl time.Duration) (*AESValue, error)

NewAESValue takes a fixed-size key and returns an CookieValue or an error. Key size must be exactly one of 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

func (*AESValue) FindURL

func (v *AESValue) FindURL(raw string, urls []*url.URL) (*url.URL, error)

FindURL gets url from array that match the value.

func (*AESValue) Get

func (v *AESValue) Get(raw *url.URL) string

Get hashes the sticky value.

type CookieValue

type CookieValue interface {
	// Get converts raw value to an expected sticky format.
	Get(*url.URL) string

	// FindURL gets url from array that match the value.
	FindURL(string, []*url.URL) (*url.URL, error)
}

CookieValue interface to manage the sticky cookie value format. It will be used by the load balancer to generate the sticky cookie value and to retrieve the matching url.

type FallbackValue

type FallbackValue struct {
	// contains filtered or unexported fields
}

FallbackValue manages hashed sticky value.

func NewFallbackValue

func NewFallbackValue(from CookieValue, to CookieValue) (*FallbackValue, error)

NewFallbackValue creates a new FallbackValue

func (*FallbackValue) FindURL

func (v *FallbackValue) FindURL(raw string, urls []*url.URL) (*url.URL, error)

FindURL gets url from array that match the value. If it is a symmetric algorithm, it decodes the URL, otherwise it compares the ciphered values.

func (*FallbackValue) Get

func (v *FallbackValue) Get(raw *url.URL) string

Get hashes the sticky value.

type HashValue

type HashValue struct {
	// Salt secret to anonymize the hashed cookie
	Salt string
}

HashValue manages hashed sticky value.

func (*HashValue) FindURL

func (v *HashValue) FindURL(raw string, urls []*url.URL) (*url.URL, error)

FindURL gets url from array that match the value.

func (*HashValue) Get

func (v *HashValue) Get(raw *url.URL) string

Get hashes the sticky value.

type RawValue

type RawValue struct{}

RawValue is a no-op that returns the raw strings as-is.

func (*RawValue) FindURL

func (v *RawValue) FindURL(raw string, urls []*url.URL) (*url.URL, error)

FindURL gets url from array that match the value.

func (*RawValue) Get

func (v *RawValue) Get(raw *url.URL) string

Get returns the raw value.

Jump to

Keyboard shortcuts

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