mirror of
https://github.com/golang/go
synced 2024-11-19 03:04:42 -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:
parent
ddad9b618c
commit
21481a3c52
@ -20,35 +20,6 @@ func boolint(b bool) int {
|
|||||||
return 0
|
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) {
|
func interfaceToIPv4Addr(ifi *Interface) (IP, error) {
|
||||||
if ifi == nil {
|
if ifi == nil {
|
||||||
return IPv4zero, nil
|
return IPv4zero, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user