Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrExpired indicates a signed URL token has expired. ErrExpired = errors.New("bunnysign: token expired") // ErrInvalidSignature indicates the signature does not match. ErrInvalidSignature = errors.New("bunnysign: invalid signature") // ErrMissingToken indicates the URL does not contain a signature token. ErrMissingToken = errors.New("bunnysign: missing token parameter") // ErrMissingExpires indicates the URL does not contain an expiration timestamp. ErrMissingExpires = errors.New("bunnysign: missing expires parameter") )
Functions ¶
Types ¶
type ClientOption ¶
type ClientOption func(*PurgeClient)
ClientOption configures a PurgeClient.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ClientOption
WithHTTPClient overrides the HTTP client.
func WithPullZoneID ¶
func WithPullZoneID(id string) ClientOption
WithPullZoneID sets the default pull zone ID.
type Options ¶
type Options struct {
// Expires sets the absolute expiration time. Takes precedence over TTL.
Expires time.Time
// TTL is added to the current time to compute the expiration timestamp.
TTL time.Duration
// UserIP optionally restricts the token to a specific client IP address.
UserIP string
// TokenPath specifies an optional directory path to sign instead of the full file path.
TokenPath string
// UseHourlyCache truncates the expiration time to the current hour for deterministic caching.
UseHourlyCache bool
}
Options specifies URL signing parameters.
type PurgeClient ¶
type PurgeClient struct {
// contains filtered or unexported fields
}
PurgeClient interacts with the Bunny.net purge API.
func NewPurgeClient ¶
func NewPurgeClient(apiKey string, opts ...ClientOption) *PurgeClient
NewPurgeClient creates a client for the Bunny.net cache purge API.
func (*PurgeClient) PurgeCacheTag ¶
PurgeCacheTag invalidates cached items matching one or more Edge Cache Tags.
func (*PurgeClient) PurgePullZone ¶
func (c *PurgeClient) PurgePullZone(ctx context.Context, pullZoneID string) error
PurgePullZone invalidates the entire cache for a pull zone.
Click to show internal directories.
Click to hide internal directories.