Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2024-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or https://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_COMMON_NETIF_H6#define BITCOIN_COMMON_NETIF_H8#include <netaddress.h>10#include <optional>11#include <vector>13//! Query the OS for the default gateway for `network`. This only makes sense for NET_IPV4 and NET_IPV6.14//! Returns std::nullopt if it cannot be found, or there is no support for this OS.15std::optional<CNetAddr> QueryDefaultGateway(Network network);17//! Return all local non-loopback IPv4 and IPv6 network addresses.18std::vector<CNetAddr> GetLocalAddresses();20#endif // BITCOIN_COMMON_NETIF_H