Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrorNotVerifyHost = fmt.Errorf("not verify host")
ErrorNotVerifyHost is returned when URL host verification fails in strict mode.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides URL generation and key extraction for storage backends. It manages the relationship between storage keys and their public URLs.
func NewHandler ¶
NewHandler creates a new URL handler with the specified public base URL. The public base URL is used to generate full URLs for storage keys.
func (*Handler) ExtractKeyFromURL ¶
ExtractKeyFromURL extracts the storage key from a URL with strict host verification enabled. Returns an empty string if host verification fails or if there's a parsing error.
func (*Handler) ExtractKeyFromURLWithMode ¶
ExtractKeyFromURLWithMode extracts the storage key from a URL with optional host verification. When strict is true, it validates that the URL belongs to the configured host. Returns an error if strict mode validation fails.
func (*Handler) GenerateURL ¶
GenerateURL creates a public URL for the given storage key. If the key already contains a full URL, it returns the key unchanged.
func (*Handler) GenerateURLs ¶
GenerateURLs creates public URLs for multiple storage keys in batch.