Documentation
¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func Copy(dst io.Writer, src io.Reader) (written int64, err error)
- func CopyBuffer(dst io.Writer, src io.Reader, buf []byte) (written int64, err error)
- func LoadGFWList() *adblock.RuleMatcher
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type IPList
- type KVCache
- type KeyLock
- type ProxyServer
- type ProxyServerMetrics
- type ProxyServerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetNames ¶
func AssetNames() []string
AssetNames returns the names of the assets. nolint: deadcode
func Copy ¶ added in v0.1.0
Copy copies from src to dst until either EOF is reached on src or an error occurs. It returns the number of bytes copied and the first error encountered while copying, if any.
A successful Copy returns err == nil, not err == EOF. Because Copy is defined to read from src until EOF, it does not treat an EOF from Read as an error to be reported.
If src implements the WriterTo interface, the copy is implemented by calling src.WriteTo(dst). Otherwise, if dst implements the ReaderFrom interface, the copy is implemented by calling dst.ReadFrom(src).
func CopyBuffer ¶ added in v0.1.0
CopyBuffer is identical to Copy except that it stages through the provided buffer (if one is required) rather than allocating a temporary one. If buf is nil, one is allocated; otherwise if it has zero length, CopyBuffer panics.
If either src implements WriterTo or dst implements ReaderFrom, buf will not be used to perform the copy.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables. nolint: deadcode
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type IPList ¶
type IPList struct {
// contains filtered or unexported fields
}
IPList type
func (*IPList) MultiContains ¶
MultiContains any on any in IPList
type KVCache ¶ added in v0.0.3
type KVCache struct { Set func(string, string) Get func(string) (string, bool) MustGet func(string) string // contains filtered or unexported fields }
KVCache type
func NewKVCache ¶ added in v0.0.3
NewKVCache instance
type KeyLock ¶ added in v0.0.5
type KeyLock struct {
// contains filtered or unexported fields
}
KeyLock type
type ProxyServer ¶
type ProxyServer struct {
// contains filtered or unexported fields
}
ProxyServer class
func NewProxyServer ¶
func NewProxyServer(option *ProxyServerOption) (*ProxyServer, error)
NewProxyServer object
func (*ProxyServer) ServeHTTP ¶
func (s *ProxyServer) ServeHTTP(res http.ResponseWriter, req *http.Request)
type ProxyServerMetrics ¶
type ProxyServerMetrics struct {
// contains filtered or unexported fields
}
ProxyServerMetrics class
func NewProxyServerMetrics ¶
func NewProxyServerMetrics() (rt *ProxyServerMetrics)
NewProxyServerMetrics constructor
func (*ProxyServerMetrics) AddErrorMetric ¶ added in v0.0.6
func (m *ProxyServerMetrics) AddErrorMetric(category, context string)
AddErrorMetric count