Documentation
¶
Overview ¶
Package bzz exposes the data structure and operations necessary on the bzz.Address type which used in the handshake protocol, address-book and hive protocol.
Index ¶
- Variables
- func AreUnderlaysEqual(a, b []ma.Multiaddr) bool
- func ContainsAddress(addrs []Address, a *Address) bool
- func DeserializeUnderlays(data []byte) ([]multiaddr.Multiaddr, error)
- func SelectBestAdvertisedAddress(addrs []ma.Multiaddr, fallback ma.Multiaddr) ma.Multiaddr
- func SerializeUnderlays(addrs []multiaddr.Multiaddr) []byte
- type Address
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAddress = errors.New("invalid address")
Functions ¶
func AreUnderlaysEqual ¶
func ContainsAddress ¶
ContainsAddress reports whether a is present in addrs.
func DeserializeUnderlays ¶
DeserializeUnderlays deserializes a byte slice into a slice of multiaddrs. The data format is automatically detected as either a single legacy multiaddr or a list of multiaddrs (identified by underlayListPrefix), and is parsed accordingly.
func SerializeUnderlays ¶
SerializeUnderlays serializes a slice of multiaddrs into a single byte slice. If the slice contains exactly one address, the standard, backward-compatible multiaddr format is used. For zero or more than one address, a custom list format prefixed with a magic byte is utilized.
Types ¶
type Address ¶
type Address struct {
Underlays []ma.Multiaddr
Overlay swarm.Address
Signature []byte
Nonce []byte
EthereumAddress []byte
}
Address represents the bzz address in swarm. It consists of a peers underlay (physical) address, overlay (topology) address and signature. Signature is used to verify the `Overlay/Underlay` pair, as it is based on `underlay|networkID`, signed with the public key of Overlay address
func NewAddress ¶
func ParseAddress ¶
func (*Address) MarshalJSON ¶
func (*Address) ShortString ¶
ShortString returns shortened versions of bzz address in a format: [Overlay, Underlay] It can be used for logging