llarp::net::Platform
network platform (all methods virtual so it can be mocked by unit tests)
#include <net.hpp>
Public Functions
| Name | |
|---|---|
| Platform() =default | |
| virtual | ~Platform() =default |
| Platform(const Platform & ) =delete | |
| Platform(Platform && ) =delete | |
| virtual std::optional< SockAddr > | AllInterfaces(SockAddr pubaddr) const =0 |
| SockAddr | Wildcard(int af =AF_INET) const |
| SockAddr | WildcardWithPort(port_t port, int af =AF_INET) const |
| virtual std::string | LoopbackInterfaceName() const =0 |
| virtual bool | HasInterfaceAddress(ipaddr_t ip) const =0 |
| bool | IsLoopbackAddress(ipaddr_t ip) const return true if ip is considered a loopback address |
| bool | IsWildcardAddress(ipaddr_t ip) const return true if ip is considered a wildcard address |
| virtual std::optional< std::string > | GetBestNetIF(int af =AF_INET) const =0 |
| std::optional< SockAddr > | MaybeInferPublicAddr(port_t default_port, int af =AF_INET) const |
| virtual std::optional< IPRange > | FindFreeRange() const =0 |
| virtual std::optional< std::string > | FindFreeTun() const =0 |
| virtual std::optional< SockAddr > | GetInterfaceAddr(std::string_view ifname, int af =AF_INET) const =0 |
| std::optional< net::ipv6addr_t > | GetInterfaceIPv6Address(std::string_view ifname) const |
| bool | IsBogon(const SockAddr & addr) const |
| bool | IsBogonRange(const IPRange & range) const |
| bool | IsBogonIP(const net::ipaddr_t & addr) const |
| bool | IsBogonIP(const net::ipv6addr_t & addr) const |
| virtual std::optional< int > | GetInterfaceIndex(ipaddr_t ip) const =0 |
| virtual std::vector< InterfaceInfo > | AllNetworkInterfaces() const =0 returns a vector holding all of our network interfaces |
| const Platform * | Default_ptr() get a pointer to our signleton instance used by main lokinet unit test mocks will not call this |
Public Functions Documentation
function Platform
Platform() =default
function ~Platform
virtual ~Platform() =default
function Platform
Platform(
const Platform &
) =delete
function Platform
Platform(
Platform &&
) =delete
function AllInterfaces
virtual std::optional< SockAddr > AllInterfaces(
SockAddr pubaddr
) const =0
function Wildcard
inline SockAddr Wildcard(
int af =AF_INET
) const
function WildcardWithPort
inline SockAddr WildcardWithPort(
port_t port,
int af =AF_INET
) const
function LoopbackInterfaceName
virtual std::string LoopbackInterfaceName() const =0
function HasInterfaceAddress
virtual bool HasInterfaceAddress(
ipaddr_t ip
) const =0
function IsLoopbackAddress
inline bool IsLoopbackAddress(
ipaddr_t ip
) const
return true if ip is considered a loopback address
function IsWildcardAddress
inline bool IsWildcardAddress(
ipaddr_t ip
) const
return true if ip is considered a wildcard address
function GetBestNetIF
virtual std::optional< std::string > GetBestNetIF(
int af =AF_INET
) const =0
function MaybeInferPublicAddr
inline std::optional< SockAddr > MaybeInferPublicAddr(
port_t default_port,
int af =AF_INET
) const
function FindFreeRange
virtual std::optional< IPRange > FindFreeRange() const =0
function FindFreeTun
virtual std::optional< std::string > FindFreeTun() const =0
function GetInterfaceAddr
virtual std::optional< SockAddr > GetInterfaceAddr(
std::string_view ifname,
int af =AF_INET
) const =0
function GetInterfaceIPv6Address
inline std::optional< net::ipv6addr_t > GetInterfaceIPv6Address(
std::string_view ifname
) const
function IsBogon
inline bool IsBogon(
const SockAddr & addr
) const
function IsBogonRange
inline bool IsBogonRange(
const IPRange & range
) const
function IsBogonIP
inline bool IsBogonIP(
const net::ipaddr_t & addr
) const
function IsBogonIP
inline bool IsBogonIP(
const net::ipv6addr_t & addr
) const
function GetInterfaceIndex
virtual std::optional< int > GetInterfaceIndex(
ipaddr_t ip
) const =0
function AllNetworkInterfaces
virtual std::vector< InterfaceInfo > AllNetworkInterfaces() const =0
returns a vector holding all of our network interfaces
function Default_ptr
static const Platform * Default_ptr()
get a pointer to our signleton instance used by main lokinet unit test mocks will not call this
Updated on 2026-01-10 at 22:49:45 +0000