Commit 2a65e3cd authored by wei.xuan's avatar wei.xuan

release:v0.0.1

parent 41ea9713
......@@ -22,7 +22,7 @@ var (
natServer string
account string
dnsServer string
disableDns bool
disableDNS bool
)
var (
......@@ -31,15 +31,13 @@ var (
)
func init() {
rand.Seed(time.Now().UnixNano())
flag.IntVar(&logLevel, "log", 1, "log logLevel")
flag.BoolVar(&pprof, "pprof", false, "enable pprof")
flag.StringVar(&natServer, "natServer", common.DefNatAddr, "natServer")
flag.StringVar(&account, "account", "unknown", "account")
flag.StringVar(&dnsServer, "dnsServer", common.DNSServer, "custom dns server")
flag.BoolVar(&disableDns, "disableDns", false, "disable default dns server")
flag.BoolVar(&disableDNS, "disableDns", false, "disable default dns server")
flag.Parse()
}
......@@ -54,13 +52,14 @@ func initPprof() {
}()
// for android
if !disableDns {
if !disableDNS {
net.DefaultResolver = &net.Resolver{
PreferGo: true,
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
return net.Dial("udp", dnsServer)
},
}
logger.Info().Msgf("use custom dns server %s", dnsServer)
}
}
......
......@@ -48,7 +48,6 @@ func (client *Client) StartUp() {
}
client.connect()
client.register()
client.Debug()
client.handleNatEvent()
}
......@@ -136,11 +135,3 @@ func (client *Client) connect() {
logger.Info().Msgf("connect to nathost %s success ...", hostPort)
client.natTunnel.Store(conn)
}
func (client *Client) Debug() {
//go func() {
// for range time.Tick(time.Second) {
// logger.Warn().Msgf("removeConnection target connStore %+v", client.connStore)
// }
//}()
}
......@@ -14,7 +14,7 @@ var (
func init() {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
output := zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339, NoColor: true}
logger = zerolog.New(output).With().Caller().Timestamp().Logger()
logger = zerolog.New(output).With().Timestamp().Logger()
}
var (
......@@ -24,7 +24,6 @@ var (
Debug = logger.Debug
)
func SetLogLevel(level int) {
zerolog.SetGlobalLevel(zerolog.Level(level))
}
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment