Documentation
¶
Index ¶
- func GetPageContent(url string) (content string, err error)
- func ListDir(dirPth string, suffix string) (files []string, err error)
- type Checker
- type Config
- type Forwarder
- func (f *Forwarder) AddHandler(h StatusHandler)
- func (f *Forwarder) Addr() string
- func (f *Forwarder) Dial(network, addr string) (c net.Conn, err error)
- func (f *Forwarder) Disable()
- func (f *Forwarder) Enable()
- func (f *Forwarder) Enabled() bool
- func (f *Forwarder) Failures() uint32
- func (f *Forwarder) IncFailures()
- func (f *Forwarder) Latency() int64
- func (f *Forwarder) MaxFailures() uint32
- func (f *Forwarder) Priority() uint32
- func (f *Forwarder) SetLatency(l int64)
- func (f *Forwarder) SetMaxFailures(l uint32)
- func (f *Forwarder) SetPriority(l uint32)
- func (f *Forwarder) URL() string
- type FwdrGroup
- func (p *FwdrGroup) Check()
- func (p *FwdrGroup) Dial(network, addr string) (net.Conn, proxy.Dialer, error)
- func (p *FwdrGroup) DialUDP(network, addr string) (pc net.PacketConn, dialer proxy.UDPDialer, err error)
- func (p *FwdrGroup) NextDialer(dstAddr string) proxy.Dialer
- func (p *FwdrGroup) OnStatusChanged(fwdr *Forwarder)
- func (p *FwdrGroup) Priority() uint32
- func (p *FwdrGroup) SetPriority(pri uint32)
- type ProviderGroup
- type Proxy
- func (p *Proxy) AddDomainIP(domain string, ip netip.Addr) error
- func (p *Proxy) Check()
- func (p *Proxy) Dial(network, addr string) (net.Conn, proxy.Dialer, error)
- func (p *Proxy) DialUDP(network, addr string) (pc net.PacketConn, dialer proxy.UDPDialer, err error)
- func (p *Proxy) Fetch()
- func (p *Proxy) NextDialer(dstAddr string) proxy.Dialer
- func (p *Proxy) Record(dialer proxy.Dialer, success bool)
- type StatusHandler
- type Strategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPageContent ¶
Types ¶
type Config ¶
type Config struct { RulePath string Forward []string Strategy Strategy DNSServers []string IPSet string Domain []string IP []string CIDR []string }
Config is config of rule.
func NewConfFromFile ¶
NewConfFromFile returns a new config from file.
type Forwarder ¶
Forwarder associates with a `-forward` command, usually a dialer or a chain of dialers.
func DirectForwarder ¶
DirectForwarder returns a direct forwarder.
func ForwarderFromURL ¶
func ForwarderFromURL(s, intface string, dialTimeout, relayTimeout time.Duration) (f *Forwarder, err error)
ForwarderFromURL parses `forward=` command value and returns a new forwarder.
func (*Forwarder) AddHandler ¶
func (f *Forwarder) AddHandler(h StatusHandler)
AddHandler adds a custom handler to handle the status change event.
func (*Forwarder) Addr ¶
Addr returns the forwarder's addr. NOTE: addr returns for chained dialers: dialer1Addr,dialer2Addr,...
func (*Forwarder) IncFailures ¶
func (f *Forwarder) IncFailures()
IncFailures increase the failuer count by 1.
func (*Forwarder) MaxFailures ¶
MaxFailures returns the maxFailures of forwarder.
func (*Forwarder) SetLatency ¶
SetLatency sets the latency of forwarder.
func (*Forwarder) SetMaxFailures ¶
SetMaxFailures sets the maxFailures of forwarder.
func (*Forwarder) SetPriority ¶
SetPriority sets the priority of forwarder.
type FwdrGroup ¶
type FwdrGroup struct {
// contains filtered or unexported fields
}
FwdrGroup is a forwarder group.
func NewFwdrGroup ¶
NewFwdrGroup returns a new forward group.
func (*FwdrGroup) DialUDP ¶
func (p *FwdrGroup) DialUDP(network, addr string) (pc net.PacketConn, dialer proxy.UDPDialer, err error)
DialUDP connects to the given address.
func (*FwdrGroup) NextDialer ¶
NextDialer returns the next dialer.
func (*FwdrGroup) OnStatusChanged ¶
onStatusChanged will be called when fwdr's status changed.
func (*FwdrGroup) SetPriority ¶
SetPriority sets the active priority of daler.
type ProviderGroup ¶
type ProviderGroup struct {
// contains filtered or unexported fields
}
func NewProviderGroup ¶
func NewProviderGroup(providers []string, excludes []string, includes []string) *ProviderGroup
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy implements the proxy.Proxy interface with rule support.
func NewProxy ¶
func NewProxy(mainForwarders []string, mainStrategy *Strategy, rules []*Config, ForwardsProvider []string, ForwardsExclude []string, ForwardsInclude []string) *Proxy
NewProxy returns a new rule proxy.
func (*Proxy) AddDomainIP ¶
AddDomainIP used to update ipMap rules according to domainMap rule.
func (*Proxy) DialUDP ¶
func (p *Proxy) DialUDP(network, addr string) (pc net.PacketConn, dialer proxy.UDPDialer, err error)
DialUDP connects to the given address via the proxy.
func (*Proxy) NextDialer ¶
NextDialer returns next dialer according to rule.
type StatusHandler ¶
type StatusHandler func(*Forwarder)
StatusHandler function will be called when the forwarder's status changed.