addr

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2015 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package addr provides utility functions to handle peer addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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.

Jump to

Keyboard shortcuts

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