Documentation ¶
Index ¶
- Variables
- type CacheMetrics
- type CacheSize
- type CacheType
- type Option
- func SetAllowList(allowList []string) Option
- func SetAllowPorts(ports []string) Option
- func SetAllowedMimeTypes(allowedMimeTypes []string) Option
- func SetCacheDir(path string) Option
- func SetDefaultImagePath(path string) Option
- func SetEnableResize(enabled bool) Option
- func SetLogger(logger *zerolog.Logger) Option
- func SetLruCacheSize(size int) Option
- func SetMaxSizeCacheDir(size int) Option
- func SetProxyPrefix(prefix string) Option
- func SetProxyReferrer(referrer []string) Option
- func SetRefuseList(refuseList []string) Option
- func SetTimeout(duration int) Option
- type ProxyOption
- type Request
- type RequestMetrics
- func (m *RequestMetrics) IncBytesServed(size int64)
- func (m *RequestMetrics) IncCache()
- func (m *RequestMetrics) IncDeepZoom()
- func (m *RequestMetrics) IncError()
- func (m *RequestMetrics) IncLruCache()
- func (m *RequestMetrics) IncRejectDomain()
- func (m *RequestMetrics) IncRejectReferrer()
- func (m *RequestMetrics) IncRejectURI()
- func (m *RequestMetrics) IncRemoteRequestError()
- func (m *RequestMetrics) IncRemoved()
- func (m *RequestMetrics) IncResize()
- func (m *RequestMetrics) IncSource()
- type RequestOption
- type Service
- func (s *Service) CacheMetrics() CacheMetrics
- func (s *Service) Do(ctx context.Context, req *Request, w io.Writer) error
- func (s *Service) RequestMetrics() RequestMetrics
- func (s *Service) Routes(pattern string, router chi.Router)
- func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Service) SetServiceBuilder(b *domain.ServiceBuilder)
- func (s *Service) Shutdown(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidCacheKey = errors.New("invalid cache key; can't be decoded to URL") ErrCacheKeyNotFound = errors.New("cache key is not found") )
View Source
var ErrRemoteResourceNotFound = errors.New("remote resource not found")
Functions ¶
This section is empty.
Types ¶
type CacheMetrics ¶ added in v0.2.1
type CacheMetrics struct { SourceFiles CacheSize `json:"sourceFiles"` Thumbnails CacheSize `json:"thumbnails"` DeepZoom struct { Descriptions CacheSize `json:"descriptions"` Tiles CacheSize `json:"tiles"` } `json:"deepZoom"` Total CacheSize `json:"total,omitempty"` }
func (CacheMetrics) TotalFiles ¶ added in v0.2.1
func (cm CacheMetrics) TotalFiles() uint64
func (CacheMetrics) TotalSizeInBytes ¶ added in v0.2.1
func (cm CacheMetrics) TotalSizeInBytes() uint64
type Option ¶
func SetAllowList ¶ added in v0.2.1
func SetAllowPorts ¶ added in v0.3.0
func SetAllowedMimeTypes ¶ added in v0.2.1
func SetCacheDir ¶
func SetDefaultImagePath ¶ added in v0.3.0
func SetEnableResize ¶ added in v0.2.1
func SetLruCacheSize ¶ added in v0.2.1
func SetMaxSizeCacheDir ¶ added in v0.2.1
func SetProxyPrefix ¶
func SetProxyReferrer ¶ added in v0.2.0
func SetRefuseList ¶ added in v0.2.1
func SetTimeout ¶
type ProxyOption ¶ added in v0.2.1
type ProxyOption string
const ( Raw ProxyOption = "raw" DeepZoom ProxyOption = "deepzoom" Explain ProxyOption = "explain" ProxyRequest ProxyOption = "request" Thumbnail ProxyOption = "thumbnail" )
type Request ¶
type Request struct { SourceURL string // the request remote URL CacheKey string // the normalised cache key for both storage and retrieval TransformOptions string // options to transform images or trigger actions RawQueryString string // not sure why this is needed CacheType CacheType // CacheType is how the data is returned SubPath string // subPath is appended to raw cacheKey to get derivatives EnableTransform bool // contains filtered or unexported fields }
func NewRequest ¶
func NewRequest(input string, options ...RequestOption) (*Request, error)
type RequestMetrics ¶ added in v0.2.1
type RequestMetrics struct { Source uint64 Cache uint64 LruCache uint64 RemoteRequestError uint64 RejectDomain uint64 RejectReferrer uint64 RejectURI uint64 Resize uint64 DeepZoom uint64 Error uint64 Removed uint64 BytesServed uint64 }
func (*RequestMetrics) IncBytesServed ¶ added in v0.2.1
func (m *RequestMetrics) IncBytesServed(size int64)
func (*RequestMetrics) IncCache ¶ added in v0.2.1
func (m *RequestMetrics) IncCache()
func (*RequestMetrics) IncDeepZoom ¶ added in v0.2.1
func (m *RequestMetrics) IncDeepZoom()
func (*RequestMetrics) IncError ¶ added in v0.2.1
func (m *RequestMetrics) IncError()
func (*RequestMetrics) IncLruCache ¶ added in v0.2.1
func (m *RequestMetrics) IncLruCache()
func (*RequestMetrics) IncRejectDomain ¶ added in v0.2.1
func (m *RequestMetrics) IncRejectDomain()
func (*RequestMetrics) IncRejectReferrer ¶ added in v0.2.1
func (m *RequestMetrics) IncRejectReferrer()
func (*RequestMetrics) IncRejectURI ¶ added in v0.2.1
func (m *RequestMetrics) IncRejectURI()
func (*RequestMetrics) IncRemoteRequestError ¶ added in v0.2.1
func (m *RequestMetrics) IncRemoteRequestError()
func (*RequestMetrics) IncRemoved ¶ added in v0.2.1
func (m *RequestMetrics) IncRemoved()
func (*RequestMetrics) IncResize ¶ added in v0.2.1
func (m *RequestMetrics) IncResize()
func (*RequestMetrics) IncSource ¶ added in v0.2.1
func (m *RequestMetrics) IncSource()
type RequestOption ¶
func SetEnableTransform ¶ added in v0.2.1
func SetEnableTransform(enabled bool) RequestOption
func SetRawQueryString ¶
func SetRawQueryString(queryString string) RequestOption
func SetService ¶
func SetService(s *Service) RequestOption
func SetTransform ¶
func SetTransform(options string) RequestOption
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CacheMetrics ¶ added in v0.2.1
func (s *Service) CacheMetrics() CacheMetrics
func (*Service) RequestMetrics ¶ added in v0.2.1
func (s *Service) RequestMetrics() RequestMetrics
func (*Service) SetServiceBuilder ¶ added in v0.3.0
func (s *Service) SetServiceBuilder(b *domain.ServiceBuilder)
Click to show internal directories.
Click to hide internal directories.