Open seanenck opened 6 years ago
@enckse any code example would help to understand what you are talking about.
This:
package main
import (
"fmt"
"net"
proxy "github.com/LiamHaworth/go-tproxy"
)
func main() {
raddr := net.UDPAddr{IP: net.IP{127, 0, 0, 1}}
//laddr := net.UDPAddr{IP: net.IP{127, 0, 0, 1}}
p, err := proxy.DialUDP("TEST", nil, &raddr)
if err != nil {
panic(fmt.Sprintf("%v", err))
}
defer p.Close()
}
will result in:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb8bf0]
goroutine 1 [running]:
github.com/LiamHaworth/go-tproxy.udpAddrToSocketAddr(0x0, 0x10c2f8, 0x400001e020, 0x0, 0x0)
...
Where as the DialUDP
doc currently says
If laddr is not nil, it is used as the local address for the connection.
I was trying to integrate (didn't actually need to at then end of the day) and found that if I passed an laddr as nil, though the method doc string says that should work, I would get panics because it looksl ike the laddr can be referenced in some of the private methods without checking for being nil.
Sorry I don't have the dumps from it but I was definitely on latest and hitting panics (mostly this is an FYI)