Crate bitcoin_network

Source

Modules§

net_addr
torv3

Structs§

NetAddr
| Network address. |

Enums§

Network
| A network type. | | ———– | @note | | An address may belong to more than one | network, for example 10.0.0.1 belongs | to both NET_UNROUTABLE and NET_IPV4. | | Keep these sequential starting from | 0 and NET_MAX as the last entry. | | We have loops like for (int i = 0; i < NET_MAX; | ++i) that expect to iterate over all | enum values and also GetExtNetwork() | “extends” this enum by introducing | standalone constants starting from | NET_MAX. |

Constants§

ADDRV2_FORMAT
| A flag that is ORed into the protocol | version to designate that addresses | should be serialized in (unserialized | from) v2 format (BIP155). | | Make sure that this does not collide | with any of the values in version.h | or with SERIALIZE_TRANSACTION_NO_WITNESS. |
ADDR_CJDNS_SIZE
| Size of CJDNS address (in bytes). |
ADDR_I2P_SIZE
| Size of I2P address (in bytes). |
ADDR_INTERNAL_SIZE
| Size of “internal” (NET_INTERNAL) | address (in bytes). |
ADDR_IPV4_SIZE
| Size of IPv4 address (in bytes). |
ADDR_IPV6_SIZE
| Size of IPv6 address (in bytes). |
ADDR_TORV3_SIZE
| Size of TORv3 address (in bytes). This | is the length of just the address as used | in BIP155, without the checksum and | the version byte. |
I2P_SAM31_PORT
| SAM 3.1 and earlier do not support specifying | ports and force the port to 0. |
INTERNAL_IN_IPV6_PREFIX
| Prefix of an IPv6 address when it contains an | embedded “internal” address. | | Used when (un)serializing addresses in ADDRv1 | format (pre-BIP155). | | The prefix comes from 0xFD | + SHA256(“bitcoin”)[0:5]. | | Such dummy IPv6 addresses are guaranteed to | not be publicly routable as they fall under | RFC4193’s fc00::/7 subnet allocated to | unique-local addresses.
IPV4_IN_IPV6_PREFIX
| Prefix of an IPv6 address when it contains an | embedded IPv4 address. | | Used when (un)serializing addresses in ADDRv1 | format (pre-BIP155).
NET_TEREDO
NET_UNKNOWN
| private extensions to enum Network, | only returned by GetExtNetwork, and | only used in GetReachabilityFrom |
TORV2_IN_IPV6_PREFIX
| Prefix of an IPv6 address when it contains an | embedded TORv2 address. | | Used when (un)serializing addresses in ADDRv1 | format (pre-BIP155). | | Such dummy IPv6 addresses are guaranteed to | not be publicly routable as they fall under | RFC4193’s fc00::/7 subnet allocated to | unique-local addresses.

Traits§

CheckIsReachable

Functions§

get_ext_network
netmask_bits
| @return | | The number of 1-bits in the prefix of | the specified subnet mask. If the specified | subnet mask is not a valid one, -1. |
onion_to_string
pv_4to_string
pv_6to_string
| Return an IPv6 address text representation with | zero compression as described in RFC 5952 (“A | Recommendation for IPv6 Address Text | Representation”).