mirror of
https://github.com/whyvl/wireproxy.git
synced 2025-04-29 19:01:42 +02:00
use system nameserver if DNS field is empty #26
This commit is contained in:
parent
787fb595a1
commit
c6cc97c90d
4 changed files with 105 additions and 21 deletions
24
net.go
Normal file
24
net.go
Normal 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()),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue