debug cleanup and src/dst unswap
This commit is contained in:
parent
2b5ddb0407
commit
da34e64e07
9
conn.go
9
conn.go
|
@ -2,7 +2,6 @@ package telebit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"fmt"
|
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
@ -84,14 +83,14 @@ func (c *Conn) LocalAddr() net.Addr {
|
||||||
|
|
||||||
// LocalAddr returns the local network address.
|
// LocalAddr returns the local network address.
|
||||||
func (c *Conn) LocalAddr() net.Addr {
|
func (c *Conn) LocalAddr() net.Addr {
|
||||||
fmt.Println("[warn] LocalAddr() address source/target switch?")
|
//fmt.Println("[warn] LocalAddr() address source/target switch?")
|
||||||
return &c.relaySourceAddr
|
return &c.relayTargetAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoteAddr returns the remote network address.
|
// RemoteAddr returns the remote network address.
|
||||||
func (c *Conn) RemoteAddr() net.Addr {
|
func (c *Conn) RemoteAddr() net.Addr {
|
||||||
fmt.Println("[warn] RemoteAddr() address source/target switch?")
|
//fmt.Println("[warn] RemoteAddr() address source/target switch?")
|
||||||
return &c.relayTargetAddr
|
return &c.relaySourceAddr
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDeadline sets the read and write deadlines associated
|
// SetDeadline sets the read and write deadlines associated
|
||||||
|
|
10
listener.go
10
listener.go
|
@ -167,8 +167,8 @@ func (l *Listener) getPipe(src, dst *Addr, count int) net.Conn {
|
||||||
rawPipe, pipe := net.Pipe()
|
rawPipe, pipe := net.Pipe()
|
||||||
newconn := &Conn{
|
newconn := &Conn{
|
||||||
//updated: time.Now(),
|
//updated: time.Now(),
|
||||||
relaySourceAddr: *dst,
|
relaySourceAddr: *src,
|
||||||
relayTargetAddr: *src,
|
relayTargetAddr: *dst,
|
||||||
relay: rawPipe,
|
relay: rawPipe,
|
||||||
}
|
}
|
||||||
l.conns[connID] = pipe
|
l.conns[connID] = pipe
|
||||||
|
@ -184,9 +184,11 @@ func (l *Listener) getPipe(src, dst *Addr, count int) net.Conn {
|
||||||
newconn.Close()
|
newconn.Close()
|
||||||
pipe.Close()
|
pipe.Close()
|
||||||
if nil != err {
|
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 {
|
} 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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue