diff --git a/conn.go b/conn.go index 5e6657d..d48e1c7 100644 --- a/conn.go +++ b/conn.go @@ -2,7 +2,6 @@ package telebit import ( "bufio" - "fmt" "net" "time" ) @@ -84,14 +83,14 @@ func (c *Conn) LocalAddr() net.Addr { // LocalAddr returns the local network address. func (c *Conn) LocalAddr() net.Addr { - fmt.Println("[warn] LocalAddr() address source/target switch?") - return &c.relaySourceAddr + //fmt.Println("[warn] LocalAddr() address source/target switch?") + return &c.relayTargetAddr } // RemoteAddr returns the remote network address. func (c *Conn) RemoteAddr() net.Addr { - fmt.Println("[warn] RemoteAddr() address source/target switch?") - return &c.relayTargetAddr + //fmt.Println("[warn] RemoteAddr() address source/target switch?") + return &c.relaySourceAddr } // SetDeadline sets the read and write deadlines associated diff --git a/listener.go b/listener.go index bd2863d..253f28a 100644 --- a/listener.go +++ b/listener.go @@ -167,8 +167,8 @@ func (l *Listener) getPipe(src, dst *Addr, count int) net.Conn { rawPipe, pipe := net.Pipe() newconn := &Conn{ //updated: time.Now(), - relaySourceAddr: *dst, - relayTargetAddr: *src, + relaySourceAddr: *src, + relayTargetAddr: *dst, relay: rawPipe, } l.conns[connID] = pipe @@ -184,9 +184,11 @@ func (l *Listener) getPipe(src, dst *Addr, count int) net.Conn { newconn.Close() pipe.Close() if nil != err { - fmt.Fprintf(os.Stderr, "[debug] [ln-pipe] encode stream ended:\n%+v\n%+v\n%q\n", *src, *dst, err) + fmt.Fprintf(os.Stderr, "[ln-pipe] encode stream ended:\n%+v\n%+v\n%q\n", *src, *dst, err) } else { - fmt.Fprintf(os.Stderr, "[debug] [ln-pipe] encode stream ended gracefully:\n%+v\n%+v\n", *src, *dst) + if dbg.Debug { + fmt.Fprintf(os.Stderr, "[debug] [ln-pipe] encode stream ended gracefully:\n%+v\n%+v\n", *src, *dst) + } } }()