TUN-6308: Add debug logs to see if packets are sent/received from edge

This commit is contained in:
cthuang
2022-05-30 13:38:15 +01:00
parent 08a8101308
commit baed5f4eea
4 changed files with 26 additions and 15 deletions

View File

@@ -6,11 +6,16 @@ import (
"net"
)
type UDPProxy struct {
type UDPProxy interface {
io.ReadWriteCloser
LocalAddr() net.Addr
}
func DialUDP(dstIP net.IP, dstPort uint16) (*UDPProxy, error) {
type udpProxy struct {
*net.UDPConn
}
func DialUDP(dstIP net.IP, dstPort uint16) (UDPProxy, error) {
dstAddr := &net.UDPAddr{
IP: dstIP,
Port: int(dstPort),
@@ -23,5 +28,5 @@ func DialUDP(dstIP net.IP, dstPort uint16) (*UDPProxy, error) {
return nil, fmt.Errorf("unable to create UDP proxy to origin (%v:%v): %w", dstIP, dstPort, err)
}
return &UDPProxy{udpConn}, nil
return &udpProxy{udpConn}, nil
}