1
0
mirror of https://github.com/golang/go synced 2024-11-19 00:44:40 -07:00

net: remove unused ipv4AddrToInterface

It's unused since CL 6497044.

Change-Id: Iee07e7af7b80fc3f00146b64cebead844daee087
Reviewed-on: https://go-review.googlesource.com/c/go/+/522196
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Tobias Klauser 2023-08-24 12:03:08 +02:00 committed by Gopher Robot
parent ddad9b618c
commit 21481a3c52

View File

@ -20,35 +20,6 @@ func boolint(b bool) int {
return 0
}
func ipv4AddrToInterface(ip IP) (*Interface, error) {
ift, err := Interfaces()
if err != nil {
return nil, err
}
for _, ifi := range ift {
ifat, err := ifi.Addrs()
if err != nil {
return nil, err
}
for _, ifa := range ifat {
switch v := ifa.(type) {
case *IPAddr:
if ip.Equal(v.IP) {
return &ifi, nil
}
case *IPNet:
if ip.Equal(v.IP) {
return &ifi, nil
}
}
}
}
if ip.Equal(IPv4zero) {
return nil, nil
}
return nil, errNoSuchInterface
}
func interfaceToIPv4Addr(ifi *Interface) (IP, error) {
if ifi == nil {
return IPv4zero, nil