Documentation ¶
Index ¶
- Variables
- func ContainsHost(hosts []string, host string) bool
- func HasAnyFold(all []string, s string) bool
- func HasAnyHeaderValuePart(from []string, value string) bool
- func HasHeaderValuePart(x string, value string) bool
- func LoadHosts(f io.Reader) ([]string, error)
- func LoadHostsFile(path string) ([]string, error)
- type CompressResponder
- type CounterEncryptorRand
- type ImageShrinkResponder
- type LimitBytesResponder
- type Mutable
- type NoscriptResponder
- type Options
- type Proxy
- func (proxy *Proxy) AddRequester(req Requester)
- func (proxy *Proxy) AddResponder(resp Responder)
- func (proxy *Proxy) Close() error
- func (proxy *Proxy) GetOptions() Options
- func (proxy *Proxy) IsHostBlocked(host string) bool
- func (proxy *Proxy) ListenAndServe() error
- func (proxy *Proxy) ListenAndServeContext(ctx context.Context) error
- func (proxy *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (proxy *Proxy) SetOptions(opts Options)
- func (proxy *Proxy) Shutdown(ctx context.Context) error
- type Requester
- type Responder
- type TypeFilterResponder
Constants ¶
This section is empty.
Variables ¶
View Source
var TypeFilterFonts = []string{
"application/x-font-ttf",
"application/x-font-truetype",
"application/x-font-opentype",
"application/font-woff",
"application/font-woff2",
"application/vnd.ms-fontobject",
"application/font-sfnt",
"font/woff2",
"font/opentype",
"fon",
"woff",
"woff2",
"otf",
"ttf",
"eot",
}
Functions ¶
func ContainsHost ¶
ContainsHost returns true if host is found in hosts.
func HasAnyFold ¶
func HasAnyHeaderValuePart ¶
func HasHeaderValuePart ¶
func LoadHostsFile ¶
LoadHostsFile loads hosts from the file, see LoadHosts
Types ¶
type CompressResponder ¶
type CompressResponder struct {
// contains filtered or unexported fields
}
func (*CompressResponder) SetEnabled ¶
func (t *CompressResponder) SetEnabled(enabled bool)
type CounterEncryptorRand ¶
type CounterEncryptorRand struct {
// contains filtered or unexported fields
}
func NewCounterEncryptorRandFromKey ¶
func NewCounterEncryptorRandFromKey(key interface{}, seed []byte) (r CounterEncryptorRand, err error)
func (*CounterEncryptorRand) Read ¶
func (c *CounterEncryptorRand) Read(b []byte) (n int, err error)
func (*CounterEncryptorRand) Seed ¶
func (c *CounterEncryptorRand) Seed(b []byte)
type ImageShrinkResponder ¶
type ImageShrinkResponder struct {
// contains filtered or unexported fields
}
func (*ImageShrinkResponder) SetEnabled ¶
func (t *ImageShrinkResponder) SetEnabled(enabled bool)
type LimitBytesResponder ¶
type LimitBytesResponder struct {
// contains filtered or unexported fields
}
func (*LimitBytesResponder) Limit ¶
func (er *LimitBytesResponder) Limit() int64
func (*LimitBytesResponder) SetLimit ¶
func (er *LimitBytesResponder) SetLimit(limitBytes int64)
type NoscriptResponder ¶
type NoscriptResponder struct {
// contains filtered or unexported fields
}
func (*NoscriptResponder) SetEnabled ¶
func (t *NoscriptResponder) SetEnabled(enabled bool)
type Options ¶
type Options struct { Verbose bool Addresses []string InsecureSkipVerify bool BlockHosts []string // list of hosts ConnectMITM bool HTTPSMITM bool CA tls.Certificate // Do not modify the pointers/arrays! Auth string }
Options includes the proxy options.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is the proxy.
func (*Proxy) AddRequester ¶
func (*Proxy) AddResponder ¶
func (*Proxy) GetOptions ¶
GetOptions gets the current options,
func (*Proxy) IsHostBlocked ¶
func (*Proxy) ListenAndServe ¶
func (*Proxy) ListenAndServeContext ¶
func (*Proxy) SetOptions ¶
type Requester ¶
Requester allows handling a request. Return a non-nil response to finish the request early. Use req.Context()
type TypeFilterResponder ¶ added in v1.1.0
type TypeFilterResponder struct {
// contains filtered or unexported fields
}
func (*TypeFilterResponder) Block ¶ added in v1.1.0
func (er *TypeFilterResponder) Block(blocks ...string)
Block a file; a block is either a file extension (without preceeding dot), or a MIME type (with a slash).
func (*TypeFilterResponder) SetEnabled ¶ added in v1.1.0
func (t *TypeFilterResponder) SetEnabled(enabled bool)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.