redir, dns: IncFailures on non-timeout errors (#133)

This commit is contained in:
wuudjac authored and GitHub committed 2020-04-28 15:18:19 +08:00
1 parent c2d9c67214
commit 22e0576b53
6 files changed
+40 -12

No files matched your search

+8 -1
View File
@@ -10,6 +10,8 @@ import (
"github.com/nadoo/glider/strategy"
)
var _ proxy.Proxy = &Proxy{}
// Proxy struct
type Proxy struct {
proxy *strategy.Proxy
@@ -47,7 +49,7 @@ func NewProxy(rules []*Config, proxy *strategy.Proxy) *Proxy {
}
// Dial dials to targer addr and return a conn
func (p *Proxy) Dial(network, addr string) (net.Conn, string, error) {
func (p *Proxy) Dial(network, addr string) (net.Conn, proxy.Dialer, error) {
return p.nextProxy(addr).Dial(network, addr)
}
@@ -109,6 +111,11 @@ func (p *Proxy) NextDialer(dstAddr string) proxy.Dialer {
return p.nextProxy(dstAddr).NextDialer(dstAddr)
}
// Record records result while using the dialer from proxy.
func (p *Proxy) Record(dialer proxy.Dialer, success bool) {
p.proxy.Record(dialer, success)
}
// AddDomainIP used to update ipMap rules according to domainMap rule
func (p *Proxy) AddDomainIP(domain, ip string) error {
if ip != "" {