announce

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: ISC Imports: 21 Imported by: 0

Documentation

Overview

network announcements

Index

Constants

View Source
const (
	TypeRPC  = iota
	TypePeer = iota
)

type of listener

Variables

This section is empty.

Functions

func AddPeer

func AddPeer(publicKey []byte, listeners []byte, timestamp uint64) bool

add a peer announcement to the in-memory tree returns:

true  if this was a new/updated entry
false if the update was within the limits (to prevent continuous relaying)

func AddRPC added in v0.2.0

func AddRPC(fingerprint []byte, rpcs []byte, timestamp uint64) bool

add an remote RPC listener returns:

true  if this was a new/updated entry
false if the update was within the limits (to prevent continuous relaying)

func Finalise

func Finalise() error

finialise - stop all background tasks

func GetNext added in v0.2.0

func GetNext(publicKey []byte) ([]byte, []byte, time.Time, error)

fetch the data for the next node in the ring for a given public key

func GetRandom added in v0.8.1

func GetRandom(publicKey []byte) ([]byte, []byte, time.Time, error)

fetch the data for the random node in the ring not matching a given public key

func Initialise

func Initialise(nodesDomain, peerFile string) error

initialise the announcement system pass a fully qualified domain for root node list or empty string for no root nodes

func SendRegistration added in v0.2.0

func SendRegistration(client *zmqutil.Client, fn string) error

send a peer registration request to a client channel

func SetPeer added in v0.2.0

func SetPeer(publicKey []byte, listeners []byte) error

called by the peering initialisation to set up this node's announcement data

func SetRPC added in v0.2.0

func SetRPC(fingerprint fingerprintType, rpcs []byte) error

set this node's rpc announcement data

Types

type PeerItem added in v0.5.7

type PeerItem struct {
	PublicKey []byte
	Listeners []byte
	Timestamp uint64
}

PeerItem is the basic structure for backup and restore peers

func NewPeerItem added in v0.5.7

func NewPeerItem(peer *peerEntry) *PeerItem

NewPeerItem is to create a PeerItem from peerEntry

func (PeerItem) MarshalText added in v0.5.7

func (item PeerItem) MarshalText() ([]byte, error)

MarshalText is the json marshal function for PeerItem

func (*PeerItem) UnmarshalText added in v0.5.7

func (item *PeerItem) UnmarshalText(data []byte) error

UnmarshalText is the json unmarshal function for PeerItem

type PeerList added in v0.5.7

type PeerList []PeerItem

PeerList is a list of PeerItem

type RPCEntry added in v0.2.0

type RPCEntry struct {
	Fingerprint fingerprintType    `json:"fingerprint"`
	Connections []*util.Connection `json:"connections"`
}

type of returned data

func FetchRPCs added in v0.2.0

func FetchRPCs(start uint64, count int) ([]RPCEntry, uint64, error)

fetch some records

Jump to

Keyboard shortcuts

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