Documentation ¶
Index ¶
- Variables
- type AtmosCamoBackend
- type Error
- type ImageProxy
- func (proxy *ImageProxy) Close()
- func (proxy *ImageProxy) GetImage(w http.ResponseWriter, r *http.Request, imageURL string)
- func (proxy *ImageProxy) GetImageDirect(imageURL string) (io.ReadCloser, string, error)
- func (proxy *ImageProxy) GetProxiedImageURL(imageURL string) string
- func (proxy *ImageProxy) GetUnproxiedImageURL(proxiedURL string) string
- func (proxy *ImageProxy) OnConfigChange(oldConfig, newConfig *model.Config)
- type ImageProxyBackend
- type LocalBackend
- type URLError
Constants ¶
This section is empty.
Variables ¶
var ErrLocalRequestFailed = Error{errors.New("imageproxy.LocalBackend: failed to request proxied image")}
var ErrNotEnabled = Error{errors.New("imageproxy.ImageProxy: image proxy not enabled")}
Functions ¶
This section is empty.
Types ¶
type AtmosCamoBackend ¶
type AtmosCamoBackend struct {
// contains filtered or unexported fields
}
func (*AtmosCamoBackend) GetImage ¶
func (backend *AtmosCamoBackend) GetImage(w http.ResponseWriter, r *http.Request, imageURL string)
func (*AtmosCamoBackend) GetImageDirect ¶
func (backend *AtmosCamoBackend) GetImageDirect(imageURL string) (io.ReadCloser, string, error)
type ImageProxy ¶
type ImageProxy struct { ConfigService configservice.ConfigService HTTPService httpservice.HTTPService Logger *mlog.Logger // contains filtered or unexported fields }
An ImageProxy is the public interface for Mattermost's image proxy. An instance of ImageProxy should be created using MakeImageProxy which requires a configService and an HTTPService provided by the server.
func MakeImageProxy ¶
func MakeImageProxy(configService configservice.ConfigService, httpService httpservice.HTTPService, logger *mlog.Logger) *ImageProxy
func (*ImageProxy) Close ¶
func (proxy *ImageProxy) Close()
func (*ImageProxy) GetImage ¶
func (proxy *ImageProxy) GetImage(w http.ResponseWriter, r *http.Request, imageURL string)
GetImage takes an HTTP request for an image and requests that image using the image proxy.
func (*ImageProxy) GetImageDirect ¶
func (proxy *ImageProxy) GetImageDirect(imageURL string) (io.ReadCloser, string, error)
GetImageDirect takes the URL of an image and returns the image along with its content type.
func (*ImageProxy) GetProxiedImageURL ¶
func (proxy *ImageProxy) GetProxiedImageURL(imageURL string) string
GetProxiedImageURL takes the URL of an image and returns a URL that can be used to view that image through the image proxy.
func (*ImageProxy) GetUnproxiedImageURL ¶
func (proxy *ImageProxy) GetUnproxiedImageURL(proxiedURL string) string
GetUnproxiedImageURL takes the URL of an image on the image proxy and returns the original URL of the image.
func (*ImageProxy) OnConfigChange ¶
func (proxy *ImageProxy) OnConfigChange(oldConfig, newConfig *model.Config)
type ImageProxyBackend ¶
type ImageProxyBackend interface { // GetImage provides a proxied image in response to an HTTP request. GetImage(w http.ResponseWriter, r *http.Request, imageURL string) // GetImageDirect returns a proxied image along with its content type. GetImageDirect(imageURL string) (io.ReadCloser, string, error) }
An ImageProxyBackend provides the functionality for different types of image proxies. An ImageProxy will construct the required backend depending on the ImageProxySettings provided by the ConfigService.
type LocalBackend ¶
type LocalBackend struct {
// contains filtered or unexported fields
}
func (*LocalBackend) GetImage ¶
func (backend *LocalBackend) GetImage(w http.ResponseWriter, r *http.Request, imageURL string)
func (*LocalBackend) GetImageDirect ¶
func (backend *LocalBackend) GetImageDirect(imageURL string) (io.ReadCloser, string, error)
func (*LocalBackend) ServeImage ¶ added in v6.2.5
func (backend *LocalBackend) ServeImage(w http.ResponseWriter, req *http.Request)