Chore: IpToAddr

This commit is contained in:
yaling888
2022-04-19 17:46:13 +08:00
committed by adlyq
parent 42d853a7e6
commit 6c4791480e
14 changed files with 136 additions and 119 deletions

View File

@ -5,7 +5,6 @@ import (
"crypto/tls"
"fmt"
"net"
"net/netip"
"time"
"github.com/Dreamacro/clash/common/cache"
@ -115,22 +114,6 @@ func msgToIP(msg *D.Msg) []net.IP {
return ips
}
func ipToAddr(ip net.IP) netip.Addr {
if ip == nil {
return netip.Addr{}
}
l := len(ip)
if l == 4 {
return netip.AddrFrom4(*(*[4]byte)(ip))
} else if l == 16 {
return netip.AddrFrom16(*(*[16]byte)(ip))
} else {
return netip.Addr{}
}
}
type wrapPacketConn struct {
net.PacketConn
rAddr net.Addr