Documentation ¶
Index ¶
- Variables
- func CopyRequestHeaders(dest *http.Request, src *http.Request)
- func CopyResponseHeaders(w http.ResponseWriter, resp *http.Response)
- func DecodeToken(_ context.Context, store Store, tokenString string) (string, error)
- func EncodeToken(ctx context.Context, store Store, token *Token, kid string) (string, error)
- func IsAcceptableContentType(ctype string) bool
- func JWTEpoch(unix int64) *jwt.NumericDate
- func New(cfg *Config) http.Handlerdeprecated
- type Chame
- type Client
- type Configdeprecated
- type HTTPProxy
- type Proxy
- type ProxyRequest
- type RawHeader
- type SignOption
- type Store
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultContentType = []string{
"image/bmp",
"image/cgm",
"image/g3fax",
"image/gif",
"image/ief",
"image/jp2",
"image/jpeg",
"image/jpg",
"image/pict",
"image/png",
"image/prs.btif",
"image/svg+xml",
"image/tiff",
"image/vnd.adobe.photoshop",
"image/vnd.djvu",
"image/vnd.dwg",
"image/vnd.dxf",
"image/vnd.fastbidsheet",
"image/vnd.fpx",
"image/vnd.fst",
"image/vnd.fujixerox.edmics-mmr",
"image/vnd.fujixerox.edmics-rlc",
"image/vnd.microsoft.icon",
"image/vnd.ms-modi",
"image/vnd.net-fpx",
"image/vnd.wap.wbmp",
"image/vnd.xiff",
"image/webp",
"image/x-cmu-raster",
"image/x-cmx",
"image/x-icon",
"image/x-macpaint",
"image/x-pcx",
"image/x-pict",
"image/x-portable-anymap",
"image/x-portable-bitmap",
"image/x-portable-graymap",
"image/x-portable-pixmap",
"image/x-quicktime",
"image/x-rgb",
"image/x-xbitmap",
"image/x-xpixmap",
"image/x-xwindowdump",
}
DefaultContentType is the default value of Chame.ContentType. These values are taken from https://github.com/atmos/camo/blob/bd731cff64fd61a7ee4ea7dd6e96b8e0b69c3da0/mime-types.json DefaultContentType is provided for only documentation purpose and modifying it has no effect.
View Source
var DefaultHTTPClient = &http.Client{ Transport: http.DefaultTransport, Timeout: 30 * time.Second, }
Functions ¶
func CopyRequestHeaders ¶
Deprecated. This method is mainly for internal use and is no longer used internally.
func CopyResponseHeaders ¶
func CopyResponseHeaders(w http.ResponseWriter, resp *http.Response)
Deprecated. This method is mainly for internal use and is no longer used internally.
func DecodeToken ¶
func EncodeToken ¶
func IsAcceptableContentType ¶
Deprecated. This method is mainly for internal use and is no longer used internally.
Types ¶
type Chame ¶
type Chame struct { Proxy Proxy Store Store // ContentType is a list of Content-Type values allowed to be proxied. If // ContentType is nil, DefaultContentType will be used. ContentType []string // ExtraContentType is a list of Content-Type values allowed to be proxied // alongside ContentType. In contrast to ContentType, ExtraContentType // does not override the default list. ExtraContentType []string // contains filtered or unexported fields }
func (*Chame) ServeHTTP ¶ added in v1.4.0
func (chame *Chame) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*Chame) ServeProxy ¶
func (chame *Chame) ServeProxy(w http.ResponseWriter, userReq *http.Request)
type Client ¶ added in v1.2.0
type Client struct {
// contains filtered or unexported fields
}
type Config
deprecated
type Config struct { Store Store Proxy Proxy // List of Content-Type to be proxied. If nil, DefaultProxyContent will be // used. ProxyContentType []string // Deprecated. Use HTTPProxy with HTTPClient set on Proxy field above. NewHTTPClient func(context.Context) *http.Client // contains filtered or unexported fields }
Deprecated: Initialize Chame directly.
type HTTPProxy ¶ added in v1.1.0
func (*HTTPProxy) Do ¶ added in v1.1.0
func (f *HTTPProxy) Do(w http.ResponseWriter, userReq *ProxyRequest)
type Proxy ¶ added in v1.1.0
type Proxy interface {
Do(http.ResponseWriter, *ProxyRequest)
}
type ProxyRequest ¶ added in v1.1.0
type SignOption ¶ added in v1.2.0
type Store ¶
type Store interface { // GetVerifyingKey retrieves a key would be used to verify signed URLs by // a combination of Issuer (the "iss" claim) and Key ID (the "kid" header // value). // If an appropriate key is found, GetVerifyingKey returns a non-nil key // (the its type must be []byte for HMAC, *rsa.Publickey for RSA, or // *ecdsa.PublicKey for ECDSA) as the first return value, and nil err as // the second return value. // Otherwise GetVerifyingKey returns non-nil err as the second. GetVerifyingKey(iss string, kid string) (key interface{}, err error) GetSigningKey(iss string, kid string) (key interface{}, err error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.