util

package
v0.0.0-...-77b0776 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEnvStr

func CheckEnvStr(key string) string

func GetEnvBool

func GetEnvBool(key string) bool

func GetEnvInt

func GetEnvInt(key string) int

func GetEnvStr

func GetEnvStr(key string) string

func HealthzHandler

func HealthzHandler(w http.ResponseWriter, r *http.Request)

HealthzHandler responds to health check requests.

func HealthzStatus

func HealthzStatus() int

func HealthzStatusHandler

func HealthzStatusHandler(w http.ResponseWriter, r *http.Request)

func ReadinessHandler

func ReadinessHandler(w http.ResponseWriter, r *http.Request)

ReadinessHandler responds to readiness check requests.

func ReadinessStatus

func ReadinessStatus() int

func ReadinessStatusHandler

func ReadinessStatusHandler(w http.ResponseWriter, r *http.Request)

func RunHealthServer

func RunHealthServer(healthAddr *string, errChan chan error)

func SetHealthzStatus

func SetHealthzStatus(status int)

func SetReadinessStatus

func SetReadinessStatus(status int)

Types

type URLGenerator

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

URLGenerator handle URL generation service

func NewURLGenerator

func NewURLGenerator(baseURL string, signingKey string) *URLGenerator

NewURLGenerator instanciate a new URLGenerator

func (URLGenerator) GenerateSignatureForURL

func (u URLGenerator) GenerateSignatureForURL(URL string) string

GenerateSignatureForURL generates a hmac sha256 signature for a given URL.

func (URLGenerator) SignedURL

func (u URLGenerator) SignedURL(path string, ttl time.Duration) string

SignedURL returns a signed url for a given path.

func (URLGenerator) ValidateURISignature

func (u URLGenerator) ValidateURISignature(URI string) bool

ValidateURISignature validates a URL signature.

type URLGeneratorInterface

type URLGeneratorInterface interface {
	SignedURL(URL string, ttl time.Duration) string
	ValidateURISignature(URI string) bool
}

URLGeneratorInterface should be implemented by url generate service

Jump to

Keyboard shortcuts

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