dnstun: remove last dot in getDomain func

This commit is contained in:
nadoo 2017-08-07 15:06:26 +08:00
parent 8cb0672df0
commit 7a919ed124
4 changed files with 8 additions and 6 deletions

View File

@ -118,5 +118,7 @@ func getDomain(p []byte) []byte {
i = i + l + 1 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]
} }

View File

@ -12,7 +12,7 @@ import (
) )
// VERSION . // VERSION .
const VERSION = "0.3.1" const VERSION = "0.4.0"
var conf struct { var conf struct {
Verbose bool Verbose bool

View File

@ -24,7 +24,7 @@ type Proxy interface {
// Get current proxy // Get current proxy
CurrentProxy() Proxy CurrentProxy() Proxy
// Get a proxy according to the strategy // Get a proxy based on the destAddr and strategy
GetProxy(dstAddr string) Proxy GetProxy(dstAddr string) Proxy
// Switch to the next proxy // Switch to the next proxy

View File

@ -4,14 +4,14 @@ package main
import "log" import "log"
type redir struct{ Proxy } type redir struct{ *proxy }
// RedirProxy returns a redirect proxy. // RedirProxy returns a redirect proxy.
func RedirProxy(addr string, upProxy Proxy) (Proxy, error) { 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. // ListenAndServe redirected requests as a server.
func (s *redir) ListenAndServe() { func (s *redir) ListenAndServe() {
log.Fatal("redir not supported on windows") log.Fatal("redir not supported on this os")
} }