(addr string)
| 10 | ) |
| 11 | |
| 12 | func IsLoopback(addr string) bool { |
| 13 | host, _, err := net.SplitHostPort(addr) |
| 14 | if err != nil { |
| 15 | // If SplitHostPort fails, it might be just a host without a port. |
| 16 | host = strings.Trim(addr, "[]") |
| 17 | } |
| 18 | if host == "localhost" { |
| 19 | return true |
| 20 | } |
| 21 | ip, err := netip.ParseAddr(host) |
| 22 | if err != nil { |
| 23 | return false |
| 24 | } |
| 25 | return ip.IsLoopback() |
| 26 | } |
no outgoing calls
searching dependent graphs…