netif.h raw

   1  // Copyright (c) 2024-present The Bitcoin Core developers
   2  // Distributed under the MIT software license, see the accompanying
   3  // file COPYING or https://www.opensource.org/licenses/mit-license.php.
   4  
   5  #ifndef BITCOIN_COMMON_NETIF_H
   6  #define BITCOIN_COMMON_NETIF_H
   7  
   8  #include <netaddress.h>
   9  
  10  #include <optional>
  11  
  12  //! Query the OS for the default gateway for `network`. This only makes sense for NET_IPV4 and NET_IPV6.
  13  //! Returns std::nullopt if it cannot be found, or there is no support for this OS.
  14  std::optional<CNetAddr> QueryDefaultGateway(Network network);
  15  
  16  //! Return all local non-loopback IPv4 and IPv6 network addresses.
  17  std::vector<CNetAddr> GetLocalAddresses();
  18  
  19  #endif // BITCOIN_COMMON_NETIF_H
  20