utils

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkString

func ChunkString(input string, chunkSize int) []string

func Decrypt

func Decrypt(ciphertext string, secret string) (string, error)

func Encrypt

func Encrypt(plaintext string, secret string) (string, error)

func EnsureAbsoluteUrl

func EnsureAbsoluteUrl(req *http.Request, url string) string

func ExpandEnvironmentVariableBoolean

func ExpandEnvironmentVariableBoolean(value string, defaultValue bool) (bool, error)

func ExpandEnvironmentVariableString

func ExpandEnvironmentVariableString(value string) string

Expands the environment variable if it is enclosed in ${}. If the variable is not present, the original value is returned. Also supports reading the value from a file via ${file:/path/to/file}, eg. to consume a Docker/Kubernetes secret mounted as a file, since environment variables can be read by anyone with access to `docker inspect`.

func FillHostSchemeFromRequest

func FillHostSchemeFromRequest(req *http.Request, u *url.URL) *url.URL

func GetFullHost

func GetFullHost(req *http.Request) string

func IsHtmlRequest

func IsHtmlRequest(req *http.Request) bool

func ParseBigInt

func ParseBigInt(s string) (*big.Int, error)

func ParseInt

func ParseInt(s string) (int, error)

func ParseUrl

func ParseUrl(rawUrl string) (*url.URL, error)

func UrlIsAbsolute

func UrlIsAbsolute(u *url.URL) bool

func ValidateRedirectUri

func ValidateRedirectUri(redirectUri string, validUris []string, wildcardsEnabled bool) (string, error)

ValidateRedirectUri checks redirectUri against validUris. Exact matches are always allowed. Wildcards are a security-sensitive, operator-controlled opt-in.

Types

type AcceptType

type AcceptType struct {
	Type   string
	Weight float64
}

func ParseAcceptHeader

func ParseAcceptHeader(raw string) []AcceptType

func ParseAcceptType

func ParseAcceptType(raw string) AcceptType

Jump to

Keyboard shortcuts

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