Documentation
¶
Index ¶
- Variables
- func ContainsLogLevel(line, level string) bool
- func FileOrDirectoryExists(path string) bool
- func GenerateRandomString(n int) string
- func GetAllowedMime(path string) (string, bool)
- func GetBasePath() (string, error)
- func GetCodeMessage(code int) string
- func GetIPAddresses() (string, string, error)
- func GetMimeTypeFromCompressedFilePath(path string) string
- func GetTLSVersion(req *http.Request) string
- func IsAllowedExtension(path string) bool
- func IsFileCompressed(filePath string) bool
- func ParseLogTimestamp(line string) (time.Time, error)
- func SHA256Base64URL(verifier string) string
- func SanitizeInput(input string) string
- func StringToSameSite(s string) http.SameSite
- func URLEncode(s string) string
- type APIResponse
- type HTTPError
Constants ¶
This section is empty.
Variables ¶
View Source
var AllowedExtensions = map[string]string{
".css": "text/css",
".js": "application/javascript",
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".ico": "image/x-icon",
".svg": "image/svg+xml",
".webp": "image/webp",
".gif": "image/gif",
".json": "application/json",
".map": "application/octet-stream",
".wasm": "application/wasm",
".woff": "font/woff",
".woff2": "font/woff2",
".ttf": "font/ttf",
".otf": "font/otf",
".wav": "audio/wav",
".mp3": "audio/mpeg",
".ogg": "audio/ogg",
".html": "text/html",
".txt": "text/plain; charset=utf-8",
".xml": "application/xml",
}
Functions ¶
func ContainsLogLevel ¶
func FileOrDirectoryExists ¶
func GenerateRandomString ¶ added in v1.3.0
func GetAllowedMime ¶
func GetBasePath ¶
func GetCodeMessage ¶
func GetIPAddresses ¶
func GetTLSVersion ¶
func IsAllowedExtension ¶
func IsFileCompressed ¶ added in v1.5.0
IsFileCompressed reports whether a file path ends with a known compression extension. This is used to decide whether a pre-compressed asset is being served.
func SHA256Base64URL ¶ added in v1.6.0
SHA256Base64URL generates a PKCE code_challenge from a verifier RFC 7636 compliant: BASE64URL-ENCODE(SHA256(verifier))
func SanitizeInput ¶
func StringToSameSite ¶ added in v1.5.0
Types ¶
type APIResponse ¶ added in v1.4.0
type APIResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
APIResponse is the standard structure for all API responses
Click to show internal directories.
Click to hide internal directories.