utils

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidKey    = &ValidationError{Code: "INVALID_KEY", Message: "Invalid API key"}
	ErrDisabled      = &ValidationError{Code: "DISABLED", Message: "API key is disabled"}
	ErrExpired       = &ValidationError{Code: "EXPIRED", Message: "API key has expired"}
	ErrRevoked       = &ValidationError{Code: "REVOKED", Message: "API key was revoked"}
	ErrBlocked       = &ValidationError{Code: "BLOCKED", Message: "API key is blocked"}
	ErrRateLimited   = &ValidationError{Code: "RATE_LIMITED", Message: "Rate limit exceeded"}
	ErrQuotaExceeded = &ValidationError{Code: "QUOTA_EXCEEDED", Message: "Quota exceeded"}
	ErrNotFound      = &ValidationError{Code: "NOT_FOUND", Message: "Resource not found"}
	ErrForbidden     = &ValidationError{Code: "FORBIDDEN", Message: "Access forbidden"}
	ErrUnauthorized  = &ValidationError{Code: "UNAUTHORIZED", Message: "Unauthorized - check API key"}
	ErrServerError   = &ValidationError{Code: "SERVER_ERROR", Message: "Server error"}
	ErrNetworkError  = &ValidationError{Code: "NETWORK_ERROR", Message: "Network error"}
	ErrTimeout       = &ValidationError{Code: "TIMEOUT", Message: "Request timed out"}
	ErrUnknown       = &ValidationError{Code: "UNKNOWN", Message: "Unknown error"}
)
View Source
var SkipSSRFCheck bool

Functions

func Base64Decode added in v1.0.8

func Base64Decode(s string) ([]byte, error)

func CalculateShannonEntropy added in v1.0.6

func CalculateShannonEntropy(str string) float64

func Decrypt added in v1.0.6

func Decrypt(data []byte, password string) ([]byte, error)

func Encrypt added in v1.0.6

func Encrypt(data []byte, password string) ([]byte, error)

func ParseAPIError

func ParseAPIError(body []byte, apiKey string) string

func ParseRetryAfter

func ParseRetryAfter(respHeaders map[string][]string) int

func ScrubAPIKey added in v1.0.5

func ScrubAPIKey(msg, apiKey string) string

func ValidateURL added in v1.0.5

func ValidateURL(rawURL string) error

Types

type BloomFilter added in v1.0.8

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

func NewBloomFilter added in v1.0.8

func NewBloomFilter(n uint64, p float64) *BloomFilter

func (*BloomFilter) Add added in v1.0.8

func (bf *BloomFilter) Add(data string)

func (*BloomFilter) Test added in v1.0.8

func (bf *BloomFilter) Test(data string) bool

type ValidationError added in v1.0.3

type ValidationError struct {
	Code    string
	Message string
	Detail  string
}

func ParseErrorFromResponse added in v1.0.3

func ParseErrorFromResponse(body []byte, statusCode int, apiKey string) *ValidationError

func (*ValidationError) Error added in v1.0.3

func (e *ValidationError) Error() string

Jump to

Keyboard shortcuts

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