Skip to content
This repository has been archived by the owner on Apr 3, 2021. It is now read-only.

Commit

Permalink
enable applog for all handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
eycorsican committed Feb 13, 2019
1 parent 980fac3 commit f154b5f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cmd/tun2socks/main.go
Expand Up @@ -78,6 +78,12 @@ func main() {
lwipWriter = filter.NewICMPFilter(lwipWriter, *delayICMP).(io.Writer)
}

// Wrap a writer to print out processes the creating network connections.
if *applog {
log.Printf("App logging is enabled")
lwipWriter = filter.NewApplogFilter(lwipWriter).(io.Writer)
}

// Register TCP and UDP handlers to handle accepted connections.
switch *proxyType {
case "echo":
Expand All @@ -89,10 +95,6 @@ func main() {
core.RegisterUDPConnectionHandler(redirect.NewUDPHandler(*proxyServer, *udpTimeout))
break
case "socks":
if *applog {
log.Printf("App logging is enabled")
lwipWriter = filter.NewApplogFilter(lwipWriter).(io.Writer)
}
core.RegisterTCPConnectionHandler(socks.NewTCPHandler(proxyHost, proxyPort))
if *disableDNSCache {
core.RegisterUDPConnectionHandler(socks.NewUDPHandler(proxyHost, proxyPort, *udpTimeout, nil))
Expand Down Expand Up @@ -131,11 +133,6 @@ func main() {
log.Fatalf("start V instance failed: %v", err)
}

if *applog {
log.Printf("App logging is enabled")
lwipWriter = filter.NewApplogFilter(lwipWriter).(io.Writer)
}

// Wrap a writer for adding routes according to V2Ray's routing results if dynamic routing is enabled.
if *gateway != "" {
log.Printf("Dynamic routing is enabled")
Expand Down

0 comments on commit f154b5f

Please sign in to comment.