diff --git a/Makefile b/Makefile index 9a7f2f5..9c6fd37 100644 --- a/Makefile +++ b/Makefile @@ -17,14 +17,14 @@ kill: sudo pkill -9 sower || true client: build kill - sudo $(PWD)/sower -f conf/sower.toml + sudo $(PWD)/sower server: build kill $(PWD)/sower -n TCP -v 1 run: build kill $(PWD)/sower -n TCP -v 1 & - sudo $(PWD)/sower -f conf/sower.toml & + sudo $(PWD)/sower & @sleep 1 curl 127.0.0.1 @sleep 1 diff --git a/conf/sower.toml b/conf/sower.toml index b07c346..665f9fb 100644 --- a/conf/sower.toml +++ b/conf/sower.toml @@ -12,6 +12,7 @@ blocklist=[ "**.goo.gl", "**.googleusercontent.com", "**.googleapis.com", + "*.googlesource.com", "**.youtube.com", # youtube "**.ytimg.com", "**.ggpht.com", @@ -21,6 +22,7 @@ blocklist=[ "**.twitter.com", # twitter "**.twimg.com", "**.blogspot.com", # blogspot + "**.appspot.com", "**.wikipedia.org", # wikipeida "*.cloudfront.net", ] diff --git a/dns/dns.go b/dns/dns.go index 41d4728..1baa518 100644 --- a/dns/dns.go +++ b/dns/dns.go @@ -107,29 +107,29 @@ func (i *intelliSuggest) GetOne(domain interface{}) (iface interface{}, e error) for _, port := range i.ports { // give local dial a hand, make it not so easy to be added into suggestions - <-util.HTTPPing(addr+port, addr, i.timeout/10) - localCh := util.HTTPPing(addr+port, addr, i.timeout) - remoteCh := util.HTTPPing(i.listenIP+port, addr, i.timeout) + <-util.HTTPPing(net.JoinHostPort(addr, port), addr, i.timeout/50) + localCh := util.HTTPPing(net.JoinHostPort(addr, port), addr, i.timeout) + remoteCh := util.HTTPPing(net.JoinHostPort(i.listenIP, port), addr, i.timeout) select { case err := <-localCh: if err == nil { - glog.V(2).Infoln(addr, "local first, succ") + glog.V(2).Infoln("PING", addr, "local first, succ") continue } - if err = <-remoteCh; err != nil { - glog.V(2).Infoln(addr, "local first, all fail") + if e := <-remoteCh; e != nil { + glog.V(2).Infoln("PING", addr, "local first, all fail:", err) continue } - glog.V(2).Infoln(addr, "local first, remote succ") + glog.V(2).Infoln("PING", addr, "local first, remote succ") conf.AddSuggest(addr) case err := <-remoteCh: if err != nil { - glog.V(2).Infoln(addr, "remote first, fail") + glog.V(2).Infoln("PING", addr, "remote first, fail:", err) continue } - glog.V(2).Infoln(addr, "remote first, succ") + glog.V(2).Infoln("PING", addr, "remote first, succ") conf.AddSuggest(addr) }