minor improvement;

follow a PR in LiamHaworth/go-tproxy (#10)
This commit is contained in:
e1732a364fed
2000-01-01 00:00:00 +00:00
parent 5901819f9a
commit b3e77d7f08
2 changed files with 3 additions and 3 deletions

View File

@@ -94,7 +94,7 @@ func ReadFromUDP(conn *net.UDPConn, b []byte) (n int, srcAddr *net.UDPAddr, dstA
}
if dstAddr == nil {
err = fmt.Errorf("unable to obtain original destination: %s", err)
err = fmt.Errorf("unable to obtain original destination: %v", err)
return
}
@@ -188,7 +188,7 @@ func udpAddrFamily(net string, laddr, raddr *net.UDPAddr) int {
}
if (laddr == nil || laddr.IP.To4() != nil) &&
(raddr == nil || laddr.IP.To4() != nil) {
(raddr == nil || raddr.IP.To4() != nil) { //https://github.com/LiamHaworth/go-tproxy/pull/10/commits/27be77df6d4f2cd145cde56f8b84711600dabbe4
return syscall.AF_INET
}
return syscall.AF_INET6

View File

@@ -478,7 +478,7 @@ func (u *ServerUDPConn) ReadMsgFrom() ([]byte, netLayer.Addr, error) {
atyp := bs[3]
l := 2 //supposed Minimum Remain Data Lenth
l := 2 //supposed Minimum Remain Data Lenth, 包含Port的2字节
off := 4 //offset from which the addr data really starts
var theIP net.IP