ads

package
v0.1.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2023 License: Unlicense Imports: 16 Imported by: 0

Documentation

Overview

Package ads provides a bundle for peer information advertisement types and initial generation of them, and deriving a peer node data structure from the ad set received over the gossip network.

Index

Constants

View Source
const DefaultAdExpiry = time.Hour * 24 * 7 // one week

DefaultAdExpiry is the base expiry duration

todo: 1 week? Should this be shorter?

View Source
const ErrNilNodeAds = "cannot process nil NodeAds"

ErrNilNodeAds indicates that the NodeAds provided was nil.

Variables

This section is empty.

Functions

func GetAddresses added in v0.1.20

func GetAddresses(n *node.Node) (aps []*netip.AddrPort, e error)

func GetMultiaddrs added in v0.1.19

func GetMultiaddrs(n *node.Node) (ma []multiaddr.Multiaddr, e error)

GetMultiaddrs returns a node's listener addresses.

func GetServices added in v0.1.20

func GetServices(n *node.Node) (svcs []services2.Service)

func NodeFromAds

func NodeFromAds(a *NodeAds) (n *node.Node, e error)

NodeFromAds generates a node.Node from a NodeAds. Used by clients to create models for peers they have sessions with.

Types

type NodeAds

type NodeAds struct {
	Peer     *peer.Ad
	Address  *addresses.Ad
	Services *services2.Ad
	Load     *load.Ad
}

NodeAds are all the ads associated with a peer.

Some are longer lived than others, mostly Peer and Address ads will last a long time but services might change more often and load will be updated whenever it dramatically changes or every few minutes.

func GenerateAds

func GenerateAds(n *node.Node, ld byte) (na *NodeAds, e error)

GenerateAds takes a node.Node and creates the NodeAds matching it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL