Crate bitcoin_network

source ·

Modules

Structs

Enums

  • | 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

  • | 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. |
  • | Size of CJDNS address (in bytes). |
  • | Size of I2P address (in bytes). |
  • | Size of “internal” (NET_INTERNAL) | address (in bytes). |
  • | Size of IPv4 address (in bytes). |
  • | Size of IPv6 address (in bytes). |
  • | 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. |
  • | SAM 3.1 and earlier do not support specifying | ports and force the port to 0. |
  • | 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.
  • | Prefix of an IPv6 address when it contains an | embedded IPv4 address. | | Used when (un)serializing addresses in ADDRv1 | format (pre-BIP155).
  • | private extensions to enum Network, | only returned by GetExtNetwork, and | only used in GetReachabilityFrom |
  • | 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

Functions

  • | @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. |
  • | Return an IPv6 address text representation with | zero compression as described in RFC 5952 (“A | Recommendation for IPv6 Address Text | Representation”).