diff --git a/dns/client.go b/dns/client.go index 401b28c..0bd49f4 100644 --- a/dns/client.go +++ b/dns/client.go @@ -219,7 +219,7 @@ func (c *Client) SetServers(domain string, servers ...string) { func (c *Client) GetServers(domain string) []string { domainParts := strings.Split(domain, ".") length := len(domainParts) - for i := length - 2; i >= 0; i-- { + for i := length - 1; i >= 0; i-- { domain := strings.Join(domainParts[i:length], ".") if servers, ok := c.upServerMap[domain]; ok { diff --git a/go.mod b/go.mod index 07ed9fa..6584b55 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/ebfe/rc2 v0.0.0-20131011165748-24b9757f5521 // indirect github.com/klauspost/cpuid v1.2.0 // indirect github.com/klauspost/reedsolomon v1.9.0 // indirect - github.com/nadoo/conflag v0.1.0 + github.com/nadoo/conflag v0.2.0 github.com/nadoo/go-shadowsocks2 v0.1.0 github.com/pkg/errors v0.8.1 // indirect github.com/sun8911879/shadowsocksR v0.0.0-20180529042039-da20fda4804f @@ -21,7 +21,7 @@ require ( github.com/xtaci/kcp-go v5.0.7+incompatible golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25 golang.org/x/net v0.0.0-20190301231341-16b79f2e4e95 // indirect - golang.org/x/sys v0.0.0-20190305064518-30e92a19ae4a // indirect + golang.org/x/sys v0.0.0-20190306155319-3e9a981b8ddb // indirect ) // Replace dependency modules with local developing copy diff --git a/go.sum b/go.sum index 2205cf7..5e1d109 100644 --- a/go.sum +++ b/go.sum @@ -16,6 +16,8 @@ github.com/klauspost/reedsolomon v1.9.0 h1:usyTY5K7D2B6WOHn2jmpB7ky8Qom96mShZmmq github.com/klauspost/reedsolomon v1.9.0/go.mod h1:CwCi+NUr9pqSVktrkN+Ondf06rkhYZ/pcNv7fu+8Un4= github.com/nadoo/conflag v0.1.0 h1:m9xSrL0UILGXPCZW66mhW57V2D2IraVpWLNIr2Op8X8= github.com/nadoo/conflag v0.1.0/go.mod h1:C3xchp3tIA3J2haACChSHFrlih7w00f31DXfjVUQa+0= +github.com/nadoo/conflag v0.2.0 h1:xao13tYqfD+5bjQ1A/jT2kBL8tUcVpFhq3seuN5kpeM= +github.com/nadoo/conflag v0.2.0/go.mod h1:Ayl83klaw7fagwYaI6luTmbOi4psAf7FqJNRRv5YMvU= github.com/nadoo/go-shadowsocks2 v0.1.0 h1:NkdUrZrI8uYq8R0YDmHLttLqKt0Z9i7dUKtGvBqZQl8= github.com/nadoo/go-shadowsocks2 v0.1.0/go.mod h1:J0B/QoRZtqUwE9BJqkP3F3M5+N8t+b5fXeNrkUarveM= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= @@ -43,3 +45,7 @@ golang.org/x/sys v0.0.0-20190303192550-c2f5717e611c h1:AXm9RSDBofvoECjrx/I1fceu1 golang.org/x/sys v0.0.0-20190303192550-c2f5717e611c/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190305064518-30e92a19ae4a h1:wsSB0WNK6x5F2PxWYOQpGTzp/IH7X8V603VJwSXZUWc= golang.org/x/sys v0.0.0-20190305064518-30e92a19ae4a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190306071516-a98ae47d97a5 h1:x+Ampnh9f/zE3phqz3m2ExO+t8eBTGuUe8xd4GCLbng= +golang.org/x/sys v0.0.0-20190306071516-a98ae47d97a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190306155319-3e9a981b8ddb h1:xIUJ1YHSR/6NhHkg597Yw0jPKhHGJmQfc8CzOmXgEco= +golang.org/x/sys v0.0.0-20190306155319-3e9a981b8ddb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/ipset/ipset_linux.go b/ipset/ipset_linux.go index e3a1573..eb995e7 100644 --- a/ipset/ipset_linux.go +++ b/ipset/ipset_linux.go @@ -126,7 +126,7 @@ func (m *Manager) AddDomainIP(domain, ip string) error { if ip != "" { domainParts := strings.Split(domain, ".") length := len(domainParts) - for i := length - 2; i >= 0; i-- { + for i := length - 1; i >= 0; i-- { domain := strings.Join(domainParts[i:length], ".") // find in domainMap diff --git a/rule/rule.go b/rule/rule.go index 521c59e..5c9aedd 100644 --- a/rule/rule.go +++ b/rule/rule.go @@ -85,7 +85,7 @@ func (rd *Dialer) NextDialer(dstAddr string) proxy.Dialer { domainParts := strings.Split(host, ".") length := len(domainParts) - for i := length - 2; i >= 0; i-- { + for i := length - 1; i >= 0; i-- { domain := strings.Join(domainParts[i:length], ".") // find in domainMap @@ -112,7 +112,7 @@ func (rd *Dialer) AddDomainIP(domain, ip string) error { if ip != "" { domainParts := strings.Split(domain, ".") length := len(domainParts) - for i := length - 2; i >= 0; i-- { + for i := length - 1; i >= 0; i-- { pDomain := strings.ToLower(strings.Join(domainParts[i:length], ".")) // find in domainMap