diff --git a/dnstun.go b/dnstun.go index 08239fa..4cfc1c8 100644 --- a/dnstun.go +++ b/dnstun.go @@ -118,5 +118,7 @@ func getDomain(p []byte) []byte { i = i + l + 1 } - return ret + // TODO: check here + // domain name could not be null, so the length of ret always >= 1? + return ret[:len(ret)-1] } diff --git a/main.go b/main.go index 8e17b77..5213c82 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,7 @@ import ( ) // VERSION . -const VERSION = "0.3.1" +const VERSION = "0.4.0" var conf struct { Verbose bool diff --git a/proxy.go b/proxy.go index 1111831..86e7dd2 100644 --- a/proxy.go +++ b/proxy.go @@ -24,7 +24,7 @@ type Proxy interface { // Get current proxy CurrentProxy() Proxy - // Get a proxy according to the strategy + // Get a proxy based on the destAddr and strategy GetProxy(dstAddr string) Proxy // Switch to the next proxy diff --git a/redir_other.go b/redir_other.go index 7b68eea..ce591c4 100644 --- a/redir_other.go +++ b/redir_other.go @@ -4,14 +4,14 @@ package main import "log" -type redir struct{ Proxy } +type redir struct{ *proxy } // RedirProxy returns a redirect proxy. func RedirProxy(addr string, upProxy Proxy) (Proxy, error) { - return &redir{Proxy: upProxy}, nil + return &redir{proxy: newProxy(addr, upProxy)}, nil } // ListenAndServe redirected requests as a server. func (s *redir) ListenAndServe() { - log.Fatal("redir not supported on windows") + log.Fatal("redir not supported on this os") }