debug cleanup and src/dst unswap

This commit is contained in:
AJ ONeal 2020-07-21 00:36:03 -06:00
parent 2b5ddb0407
commit da34e64e07
2 changed files with 10 additions and 9 deletions

View File

@ -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

View File

@ -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)
}
}
}()