| 294 | } |
| 295 | |
| 296 | std::optional<CNetAddr> QueryDefaultGateway(Network network) |
| 297 | { |
| 298 | Assume(network == NET_IPV4 || network == NET_IPV6); |
| 299 | |
| 300 | sa_family_t family; |
| 301 | if (network == NET_IPV4) { |
| 302 | family = AF_INET; |
| 303 | } else if(network == NET_IPV6) { |
| 304 | family = AF_INET6; |
| 305 | } else { |
| 306 | return std::nullopt; |
| 307 | } |
| 308 | |
| 309 | std::optional<CNetAddr> ret = QueryDefaultGatewayImpl(family); |
| 310 | |
| 311 | // It's possible for the default gateway to be 0.0.0.0 or ::0 on at least Windows |
| 312 | // for some routing strategies. If so, return as if no default gateway was found. |
| 313 | if (ret && !ret->IsBindAny()) { |
| 314 | return ret; |
| 315 | } else { |
| 316 | return std::nullopt; |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | std::vector<CNetAddr> GetLocalAddresses() |
| 321 | { |
no test coverage detected