shared

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NOPAD = "nopad"
	CBC   = "cbc"
	CTR   = "ctr"
	PKCS7 = "pkcs7"
)

Ident values constants

Variables

View Source
var BlockSizeMap = map[string]int{
	"aes128": 16,
	"aes192": 24,
	"aes256": 32,
}
View Source
var ErrInvalidMultiByteSequence = errors.New("Invalid multi-byte sequence")

Functions

func Base64Decode added in v1.11.0

func Base64Decode(src string) string

Standard base64 decoding

func Base64Encode added in v1.11.0

func Base64Encode(src string) string

Standard base64 encoding

func Base64UrlDecode added in v1.11.0

func Base64UrlDecode(src string) string

base64-url decoding

func Base64UrlDecodeNoPad added in v1.11.0

func Base64UrlDecodeNoPad(src string) string

base64-url nopadding decoding

func Base64UrlEncode added in v1.11.0

func Base64UrlEncode(src string) string

base64-url encoding

func Base64UrlEncodeNoPad added in v1.11.0

func Base64UrlEncodeNoPad(src string) string

base64-url nopadding encoding

func IsNegativeZero

func IsNegativeZero(v float64) bool

func IsPositiveZero

func IsPositiveZero(v float64) bool

func IsSubnormalFloat64

func IsSubnormalFloat64(v float64) bool

func IsValidHeader

func IsValidHeader(name string) bool

func UrlDecode added in v1.11.0

func UrlDecode(src string) (string, error)

Percent decoding function for urldecode() builtin function

func UrlEncode added in v1.11.0

func UrlEncode(src string) (string, error)

Percent encoding function for urlencode() builtin function

Types

type CryptoCodec

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

CryptoCodec is common cryptographic for Fastly builtin function

func NewCryptoCodec

func NewCryptoCodec(
	name string,
	cipherId, mode, padding string,
) (*CryptoCodec, error)

func (*CryptoCodec) Decrypt

func (c *CryptoCodec) Decrypt(hexKey, hexIv string, text []byte) ([]byte, error)

func (*CryptoCodec) Encrypt

func (c *CryptoCodec) Encrypt(hexKey, hexIv string, text []byte) ([]byte, error)

type QueryString

type QueryString struct {
	Key   string
	Value []string // nil indicates not set in VCL
}

type QueryStrings

type QueryStrings struct {
	Prefix string // protocol, host, port, path
	Items  []*QueryString
}

We implement original querytring struct in order to maname URL queries keeping its order. url.Values are useful in Golang but Encode() result does not care its order because it is managed in map and always sort by query name. On VCL, we need to keep query raw-order as present, this struct solved them.

func ParseQuery

func ParseQuery(qs string) (*QueryStrings, error)

func (*QueryStrings) Add

func (q *QueryStrings) Add(name, val string)

func (*QueryStrings) Clean

func (q *QueryStrings) Clean()

func (*QueryStrings) Filter

func (q *QueryStrings) Filter(filter func(name string) bool)

func (*QueryStrings) Get

func (q *QueryStrings) Get(name string) *string

func (*QueryStrings) Set

func (q *QueryStrings) Set(name, val string)

func (*QueryStrings) Sort

func (q *QueryStrings) Sort(mode SortMode)

func (*QueryStrings) String

func (q *QueryStrings) String() string

type SortMode

type SortMode string
const (
	SortAsc  SortMode = "asc"
	SortDesc SortMode = "desc"
)

Jump to

Keyboard shortcuts

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