util

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: MIT Imports: 17 Imported by: 36

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPeerFromAddress

func AddPeerFromAddress(addrStr string, pstore peerstore.Peerstore) (pid peer.ID, err error)

AddPeerFromAddress parses the given address and adds the dialable component to the peerstore. If a dht is provided and the address does not contain a dialable component, it will be queried for peer info.

func CanDial

func CanDial(addr ma.Multiaddr, s *swarm.Swarm) bool

CanDial returns whether or not the address is dialable.

func CreateLog

func CreateLog(host peer.ID) (info thread.LogInfo, err error)

CreateLog creates a new log with the given peer as host.

func CreateThread

func CreateThread(s service.Service, id thread.ID) (info thread.Info, err error)

CreateThread creates a new set of keys.

func DecodeKey

func DecodeKey(k string) (*sym.Key, error)

DecodeKey from a string into a symmetric key.

func DefaultBoostrapPeers

func DefaultBoostrapPeers() []peer.AddrInfo

func GetDialable

func GetDialable(addr ma.Multiaddr) (ma.Multiaddr, error)

GetDialable returns the portion of an address suitable for storage in a peerstore.

func GetLog

func GetLog(s service.Service, id thread.ID, lid peer.ID) (info thread.LogInfo, err error)

GetLog returns the log with the given thread and log id.

func GetOrCreateOwnLog

func GetOrCreateOwnLog(s service.Service, id thread.ID) (info thread.LogInfo, err error)

GetOrCreateOwnLoad returns the log owned by the host under the given thread. If no log exists, a new one is created under the given thread.

func GetOwnLog

func GetOwnLog(s service.Service, id thread.ID) (info thread.LogInfo, err error)

GetOwnLoad returns the log owned by the host under the given thread.

func LoadKey

func LoadKey(pth string) crypto.PrivKey

func ParseBootstrapPeers

func ParseBootstrapPeers(addrs []string) ([]peer.AddrInfo, error)

func SetLogLevels

func SetLogLevels(systems map[string]logging.LogLevel) error

SetLogLevels sets levels for the given systems.

func SetupDefaultLoggingConfig

func SetupDefaultLoggingConfig(repoPath string)

SetupDefaultLoggingConfig sets up a standard logging configuration.

func TCPAddrFromMultiAddr

func TCPAddrFromMultiAddr(maddr ma.Multiaddr) (addr string, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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