5 #ifndef BITCOIN_NETBASE_H
6 #define BITCOIN_NETBASE_H
8 #if defined(HAVE_CONFIG_H)
9 #include <config/bitcoin-config.h>
35 bool _randomize_credentials =
false)
57 std::vector<std::string>
GetNetworkNames(
bool append_unroutable =
false);
83 std::function<std::vector<CNetAddr>(
const std::string &,
bool)>;
101 bool LookupHost(
const std::string &
name, std::vector<CNetAddr> &vIP,
102 unsigned int nMaxSolutions,
bool fAllowLookup,
134 bool Lookup(
const std::string &
name, std::vector<CService> &vAddr,
135 uint16_t portDefault,
bool fAllowLookup,
unsigned int nMaxSolutions,
202 int nTimeout,
bool manual_connection);
220 uint16_t port,
const Sock &sock,
int nTimeout,
221 bool &outProxyConnectionFailed);
A combination of a network address (CNetAddr) and a (TCP) port.
RAII helper class that manages a socket.
bool randomize_credentials
proxyType(const CService &_proxy, bool _randomize_credentials=false)
bool GetNameProxy(proxyType &nameProxyOut)
std::unique_ptr< Sock > CreateSockTCP(const CService &address_family)
Create a TCP socket in the given address family.
static const int DEFAULT_NAME_LOOKUP
-dns default
std::string GetNetworkName(enum Network net)
bool LookupHost(const std::string &name, std::vector< CNetAddr > &vIP, unsigned int nMaxSolutions, bool fAllowLookup, DNSLookupFn dns_lookup_function=g_dns_lookup)
Resolve a host string to its corresponding network addresses.
bool GetProxy(enum Network net, proxyType &proxyInfoOut)
bool SetSocketNoDelay(const SOCKET &hSocket)
Set the TCP_NODELAY flag on a socket.
bool ConnectThroughProxy(const proxyType &proxy, const std::string &strDest, uint16_t port, const Sock &sock, int nTimeout, bool &outProxyConnectionFailed)
Connect to a specified destination service through a SOCKS5 proxy by first connecting to the SOCKS5 p...
std::vector< CNetAddr > WrappedGetAddrInfo(const std::string &name, bool allow_lookup)
Wrapper for getaddrinfo(3).
void InterruptSocks5(bool interrupt)
std::vector< std::string > GetNetworkNames(bool append_unroutable=false)
Return a vector of publicly routable Network names; optionally append NET_UNROUTABLE.
bool ConnectSocketDirectly(const CService &addrConnect, const Sock &sock, int nTimeout, bool manual_connection)
Try to connect to the specified service on the specified socket.
CService LookupNumeric(const std::string &name, uint16_t portDefault=0, DNSLookupFn dns_lookup_function=g_dns_lookup)
Resolve a service string with a numeric IP to its first corresponding service.
std::function< std::unique_ptr< Sock >const CService &)> CreateSock
Socket factory.
bool LookupSubNet(const std::string &strSubnet, CSubNet &subnet, DNSLookupFn dns_lookup_function=g_dns_lookup)
Parse and resolve a specified subnet string into the appropriate internal representation.
bool SetNameProxy(const proxyType &addrProxy)
Set the name proxy to use for all connections to nodes specified by a hostname.
enum Network ParseNetwork(const std::string &net)
bool SetSocketNonBlocking(const SOCKET &hSocket, bool fNonBlocking)
Disable or enable blocking-mode for a socket.
bool IsProxy(const CNetAddr &addr)
bool Lookup(const std::string &name, std::vector< CService > &vAddr, uint16_t portDefault, bool fAllowLookup, unsigned int nMaxSolutions, DNSLookupFn dns_lookup_function=g_dns_lookup)
Resolve a service string to its corresponding service.
bool IsBadPort(uint16_t port)
Determine if a port is "bad" from the perspective of attempting to connect to a node on that port.
std::function< std::vector< CNetAddr >(const std::string &, bool)> DNSLookupFn
static const int DEFAULT_CONNECT_TIMEOUT
-timeout default
bool SetProxy(enum Network net, const proxyType &addrProxy)