Documentation
¶
Index ¶
- func HandleDimsStatus(config EnvironmentConfig, debug bool, dev bool, w http.ResponseWriter, ...)
- func Handler(kernel Kernel, config Config, w http.ResponseWriter)
- type Command
- type Commands
- type Config
- type EdgeControl
- type EnvironmentConfig
- type Error
- type ErrorImageGenerator
- type Image
- type ImageProcessor
- type Kernel
- type Options
- type OriginCacheControl
- type OutputFormat
- type Request
- func (r *Request) Commands() []Command
- func (r *Request) FetchImage() error
- func (r *Request) SendError(w http.ResponseWriter, status int, message string)
- func (r *Request) SendHeaders(w http.ResponseWriter)
- func (r *Request) SendImage(w http.ResponseWriter, status int, imageFormat string, imageBlob []byte) error
- type Signing
- type Timeout
- type UrlSigner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleDimsStatus ¶
func HandleDimsStatus(config EnvironmentConfig, debug bool, dev bool, w http.ResponseWriter, r *http.Request)
Types ¶
type Config ¶
type Config struct {
DevelopmentMode bool
DebugMode bool
EtagAlgorithm string
EnvironmentConfig
}
type EdgeControl ¶
type EdgeControl struct {
DownstreamTtl int `env:"DIMS_EDGE_CONTROL_DOWNSTREAM_TTL" envDefault:"0"`
}
type EnvironmentConfig ¶
type EnvironmentConfig struct {
Timeout
EdgeControl
Signing
Error
OriginCacheControl
OutputFormat
Options
}
func ReadConfig ¶
func ReadConfig() EnvironmentConfig
type ErrorImageGenerator ¶ added in v0.3.0
type ErrorImageGenerator interface {
GenerateErrorImage(w http.ResponseWriter, status int, message string)
}
type Image ¶
type Image struct {
Bytes []byte // The downloaded image.
Size int // The original image size in bytes.
Format string // The original image format.
Status int // The HTTP status code of the downloaded image.
CacheControl string // The cache headers from the downloaded image.
EdgeControl string // The edge control headers from the downloaded image.
LastModified string // The last modified header from the downloaded image.
Etag string // The etag header from the downloaded image.
}
type ImageProcessor ¶ added in v0.3.0
type Kernel ¶
type Kernel interface {
ValidateSignature() bool
FetchImage() error
ProcessImage() (string, []byte, error)
ProcessCommand(command Command) error
SendHeaders(w http.ResponseWriter)
SendImage(w http.ResponseWriter, status int, imageType string, imageBlob []byte) error
SendError(w http.ResponseWriter, status int, message string)
}
type OriginCacheControl ¶
type OriginCacheControl struct {
UseOrigin bool `env:"DIMS_CACHE_CONTROL_USE_ORIGIN" envDefault:"false"`
Min int `env:"DIMS_CACHE_CONTROL_MIN" envDefault:"0"`
Max int `env:"DIMS_CACHE_CONTROL_MAX" envDefault:"0"`
Default int `env:"DIMS_CACHE_CONTROL_DEFAULT" envDefault:"31536000"`
Error int `env:"DIMS_CACHE_CONTROL_ERROR" envDefault:"60"`
}
type OutputFormat ¶
type Request ¶
type Request struct {
Id string // The hash of the request -> hash(clientId + commands + imageUrl).
Signature string // The signature of the request.
Config Config // The global configuration.
ClientId string // The client ID of this request.
ImageUrl string // The image URL that is being manipulated.
SendContentDisposition bool // The content disposition of the request.
RawCommands string // The commands ('resize/100x100', 'strip/true/format/png', etc).
Error bool // Whether the error image is being served.
SourceImage Image // The source image.
}
func (*Request) FetchImage ¶
FetchImage downloads the image from the given URL.
func (*Request) SendError ¶
func (r *Request) SendError(w http.ResponseWriter, status int, message string)
func (*Request) SendHeaders ¶
func (r *Request) SendHeaders(w http.ResponseWriter)
Click to show internal directories.
Click to hide internal directories.