author | Alberto Bertogli
<albertito@blitiri.com.ar> 2017-08-07 21:19:49 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2017-08-07 21:22:34 UTC |
parent | cb5dcb87b093e275a7095e645ed52038539e1a73 |
proxy/raw.go | +7 | -5 |
diff --git a/proxy/raw.go b/proxy/raw.go index d57902b..32f7f67 100644 --- a/proxy/raw.go +++ b/proxy/raw.go @@ -3,6 +3,7 @@ package proxy import ( "crypto/tls" "net" + "time" "blitiri.com.ar/go/gofer/config" "blitiri.com.ar/go/gofer/util" @@ -43,6 +44,7 @@ func Raw(conf config.Raw) { func forward(src net.Conn, dstAddr string, dstTLS bool) { defer src.Close() + start := time.Now() var dst net.Conn var err error if dstTLS { @@ -57,11 +59,11 @@ func forward(src net.Conn, dstAddr string, dstTLS bool) { } defer dst.Close() - util.Log.Printf("%s raw %s -> %s: open", - src.RemoteAddr(), src.LocalAddr(), dst.RemoteAddr()) - + startCopy := time.Now() util.BidirCopy(src, dst) + end := time.Now() - util.Log.Printf("%s raw %s -> %s: close", - src.RemoteAddr(), src.LocalAddr(), dst.RemoteAddr()) + util.Log.Printf("%s raw %s -> %s (%s+%s=%s)", + src.RemoteAddr(), src.LocalAddr(), dst.RemoteAddr(), + startCopy.Sub(start), end.Sub(startCopy), end.Sub(start)) }