Version: v0.3.5 Latest Latest

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

Go to latest
Published: Jun 12, 2015 License: MIT Imports: 1 Imported by: 0



Package addr provides utility functions to handle peer addresses.



This section is empty.


This section is empty.


This section is empty.


type Slice

type Slice []ma.Multiaddr

Slice is a simple slice of addresses that implements the AddrSource interface.

func (Slice) Addrs

func (as Slice) Addrs() []ma.Multiaddr

type Source

type Source interface {
	Addrs() []ma.Multiaddr

AddrSource is a source of addresses. It allows clients to retrieve a set of addresses at a last possible moment in time. It is used to query a set of addresses that may change over time, as a result of the network changing interfaces or mappings.

func CombineSources

func CombineSources(srcs ...Source) Source

CombineSources returns a new AddrSource which is the concatenation of all input AddrSources:

combined := CombinedSources(a, b)
combined.Addrs() // append(a.Addrs(), b.Addrs()...)

func UniqueSource

func UniqueSource(srcs ...Source) Source

UniqueSource returns a new AddrSource which omits duplicate addresses from the inputs:

unique := UniqueSource(a, b)
unique.Addrs() // append(a.Addrs(), b.Addrs()...)
               // but only adds each addr once.

Source Files

Jump to

Keyboard shortcuts

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