From 52c636d8d69cf410b82c9ee9ab3d51b969d8ca29 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Sun, 19 Jul 2020 06:52:31 +0000 Subject: [PATCH] improve debugging --- mplexer/connwrap.go | 5 ++++- mplexer/routemux.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mplexer/connwrap.go b/mplexer/connwrap.go index e338165..12c29a6 100644 --- a/mplexer/connwrap.go +++ b/mplexer/connwrap.go @@ -6,6 +6,7 @@ import ( "net" "time" + "git.coolaj86.com/coolaj86/go-telebitd/dbg" "git.coolaj86.com/coolaj86/go-telebitd/sni" ) @@ -137,7 +138,9 @@ func (c *ConnWrap) isEncrypted() bool { c.SetDeadline(time.Now().Add(5 * time.Second)) n := 6 b, err := c.Peek(n) - fmt.Printf("[debug] [wrap] Peek(%d): %s %s %s\n", n, b, string(b), err) + if dbg.Debug { + fmt.Printf("[debug] [wrap] Peek(%d): %s %v\n", n, string(b), err) + } if nil != err { // TODO return error on error? return encrypted diff --git a/mplexer/routemux.go b/mplexer/routemux.go index 240db6c..1bfe270 100644 --- a/mplexer/routemux.go +++ b/mplexer/routemux.go @@ -93,7 +93,7 @@ func (m *RouteMux) Serve(client net.Conn) error { } } - fmt.Println("No match found for", wconn.Scheme(), wconn.Servername()) + fmt.Printf("No match found for %q %q\n", wconn.Scheme(), wconn.Servername()) return client.Close() // TODO Chi-style route handling