use system nameserver if DNS field is empty #26

This commit is contained in:
octeep 2022-03-31 09:32:43 +01:00
parent 787fb595a1
commit c6cc97c90d
4 changed files with 105 additions and 21 deletions

24
net.go Normal file
View file

@ -0,0 +1,24 @@
// will delete when upgrading to go 1.18
package wireproxy
import (
"golang.zx2c4.com/go118/netip"
"net"
)
func TCPAddrFromAddrPort(addr netip.AddrPort) *net.TCPAddr {
return &net.TCPAddr{
IP: addr.Addr().AsSlice(),
Zone: addr.Addr().Zone(),
Port: int(addr.Port()),
}
}
func UDPAddrFromAddrPort(addr netip.AddrPort) *net.UDPAddr {
return &net.UDPAddr{
IP: addr.Addr().AsSlice(),
Zone: addr.Addr().Zone(),
Port: int(addr.Port()),
}
}