proxy

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentTypeFilter

func ContentTypeFilter(in *Response) (*Response, *FilterError)

func HeaderFilter

func HeaderFilter(in *Response) (*Response, *FilterError)

func Proxy

func Proxy(config *Configuration, w http.ResponseWriter, r *Request)

Types

type Configuration

type Configuration struct {
	AllowedHosts []string
}

func (*Configuration) AllowsHost

func (c *Configuration) AllowsHost(host string) bool

func (*Configuration) LoadEnvironmentVariables

func (c *Configuration) LoadEnvironmentVariables()

type CropType

type CropType string
const (
	CropTypeCenter      CropType = "center"
	CropTypeLeft        CropType = "left"
	CropTypeRight       CropType = "right"
	CropTypeTopLeft     CropType = "top_left"
	CropTypeTop         CropType = "top"
	CropTypeTopRight    CropType = "top_right"
	CropTypeBottomLeft  CropType = "bottom_left"
	CropTypeBottom      CropType = "bottom"
	CropTypeBottomRight CropType = "bottom_right"
)

func (*CropType) Anchor

func (c *CropType) Anchor() *imaging.Anchor

func (*CropType) CamelCase

func (c *CropType) CamelCase() string

type Dimensions

type Dimensions struct {
	Width  int
	Height int
}

type Filter

type Filter func(*Response) (*Response, *FilterError)

func JPEGFilter

func JPEGFilter(quality int) Filter

func RasterizeFilter

func RasterizeFilter(scalingFunction ScalingFunction) Filter

func ScalingFilter

func ScalingFilter(opts *ScalingOptions) Filter

type FilterError

type FilterError struct {
	Error      error
	StatusCode int
}

type Request

type Request struct {
	OriginURL *url.URL
	Filters   []Filter
}

func NewRequestFromURL

func NewRequestFromURL(url *url.URL) (*Request, error)

NewProxyRequestFromURL parses a URL for the origin url and additional options.

type Response

type Response struct {
	Header http.Header
	Body   io.Reader
}

type ScalingFunction

type ScalingFunction func(width, height int, allowUpscaling bool) (int, int)

func ScaleToFill

func ScaleToFill(fillWidth, fillHeight int) ScalingFunction

func ScaleToFit

func ScaleToFit(fitWidth, fitHeight int) ScalingFunction

type ScalingOptions

type ScalingOptions struct {
	Crop *CropType
	Fill *Dimensions
	Fit  *Dimensions
}

func (*ScalingOptions) IsValid

func (o *ScalingOptions) IsValid() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL