(ip net.IP)
| 162 | } |
| 163 | |
| 164 | func scope(ip net.IP) string { |
| 165 | if ip.IsLoopback() || ip.IsLinkLocalUnicast() || ip.IsLinkLocalMulticast() { |
| 166 | return "link-local" |
| 167 | } |
| 168 | |
| 169 | if ip.IsInterfaceLocalMulticast() { |
| 170 | return "interface-local" |
| 171 | } |
| 172 | |
| 173 | if ip.IsGlobalUnicast() { |
| 174 | return "global" |
| 175 | } |
| 176 | |
| 177 | return "" |
| 178 | } |
| 179 | |
| 180 | // getAddrsInfo returns interface name, address, scope and netmask for all interfaces. |
| 181 | func getAddrsInfo(interfaces []net.Interface, filter *deviceFilter, logger *slog.Logger) []addrInfo { |