improve debugging

This commit is contained in:
AJ ONeal 2020-07-19 06:52:31 +00:00
parent f2351aeeb1
commit 52c636d8d6
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import (
"net" "net"
"time" "time"
"git.coolaj86.com/coolaj86/go-telebitd/dbg"
"git.coolaj86.com/coolaj86/go-telebitd/sni" "git.coolaj86.com/coolaj86/go-telebitd/sni"
) )
@ -137,7 +138,9 @@ func (c *ConnWrap) isEncrypted() bool {
c.SetDeadline(time.Now().Add(5 * time.Second)) c.SetDeadline(time.Now().Add(5 * time.Second))
n := 6 n := 6
b, err := c.Peek(n) 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 { if nil != err {
// TODO return error on error? // TODO return error on error?
return encrypted return encrypted

View File

@ -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() return client.Close()
// TODO Chi-style route handling // TODO Chi-style route handling