middleware

package
v0.0.0-...-367f6b9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache() photon.MiddlewareFunc

func CacheWithConfig

func CacheWithConfig(config CacheConfig) photon.MiddlewareFunc

func Client

func Client(client *http.Client) photon.MiddlewareFunc

func Decoding

func Decoding() photon.MiddlewareFunc

func DecodingWithConfig

func DecodingWithConfig(config DecodingConfig) photon.MiddlewareFunc

func Filter

func Filter() photon.MiddlewareFunc

func FilterWithConfig

func FilterWithConfig(config FilterConfig) photon.MiddlewareFunc

func FilterWithFunc

func FilterWithFunc(filterFunc FilterFunc) photon.MiddlewareFunc

func FromCache

func FromCache() photon.MiddlewareFunc

func FromCacheWithConfig

func FromCacheWithConfig(config FromCacheConfig) photon.MiddlewareFunc

func FromContext

func FromContext(lastCtx photon.Context) photon.MiddlewareFunc
func Header(headerMap map[string]string) photon.MiddlewareFunc

func Limit

func Limit(duration time.Duration) photon.MiddlewareFunc

func LimitWithConfig

func LimitWithConfig(config LimitConfig) photon.MiddlewareFunc

func LimitWithFunc

func LimitWithFunc(limitFunc LimitFunc) photon.MiddlewareFunc

func Proxy

func Proxy(u *url.URL) photon.MiddlewareFunc

func Timeout

func Transport

func Transport(transport http.RoundTripper) photon.MiddlewareFunc

func UserAgent

func UserAgent(useragents ...string) photon.MiddlewareFunc

func UserAgentWithConfig

func UserAgentWithConfig(config UserAgentConfig) photon.MiddlewareFunc

Types

type CacheConfig

type CacheConfig struct {
	Driver      CacheDrive
	AllowStatus []int
}

type CacheDrive

type CacheDrive interface {
	Put(*http.Request, *http.Response) error
}

type DecodingConfig

type DecodingConfig struct {
}

type FileDriver

type FileDriver struct {
	// contains filtered or unexported fields
}

func NewFileDriver

func NewFileDriver(cacheDir string) *FileDriver

func (*FileDriver) Get

func (d *FileDriver) Get(req *http.Request) (resp *http.Response, has bool)

func (*FileDriver) Put

func (d *FileDriver) Put(req *http.Request, resp *http.Response) (err error)

type FilterConfig

type FilterConfig struct {
	FilterFunc FilterFunc
}

type FilterFunc

type FilterFunc func(photon.Context) bool

type FromCacheConfig

type FromCacheConfig struct {
	Driver FromCacheDrive
}

type FromCacheDrive

type FromCacheDrive interface {
	Get(*http.Request) (*http.Response, bool)
}

type LimitConfig

type LimitConfig struct {
	LimitFunc LimitFunc
}

type LimitFunc

type LimitFunc func() <-chan interface{}

type UserAgentConfig

type UserAgentConfig struct {
	UserAgent []string
}

Jump to

Keyboard shortcuts

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