util

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 21 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanDial

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

CanDial returns whether or not the address is dialable.

func DefaultBoostrapPeers

func DefaultBoostrapPeers() []peer.AddrInfo

func FreeLocalAddr added in v0.1.13

func FreeLocalAddr() ma.Multiaddr

func GenerateRandomBytes added in v0.1.22

func GenerateRandomBytes(n int) []byte

func InstanceFromJSON added in v0.1.13

func InstanceFromJSON(b []byte, i interface{})

func JSONFromInstance added in v0.1.13

func JSONFromInstance(i interface{}) []byte

func LoadKey

func LoadKey(pth string) crypto.PrivKey

func MustParseAddr added in v0.1.6

func MustParseAddr(str string) ma.Multiaddr

func NewContextCloser added in v1.0.1

func NewContextCloser(cancel context.CancelFunc) io.Closer

Transform context cancellation function to be used with finalizer.

func ParseBootstrapPeers

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

func SchemaFromInstance added in v0.1.13

func SchemaFromInstance(i interface{}, expandedStruct bool) *jsonschema.Schema

func SchemaFromSchemaString added in v0.1.13

func SchemaFromSchemaString(s string) *jsonschema.Schema

func SetJSONID added in v0.1.13

func SetJSONID(id core.InstanceID, json []byte) []byte

func SetJSONProperty added in v0.1.13

func SetJSONProperty(name string, value interface{}, json []byte) []byte

func SetLogLevels

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

SetLogLevels sets levels for the given systems.

func SetupDefaultLoggingConfig

func SetupDefaultLoggingConfig(repoPath string) error

SetupDefaultLoggingConfig sets up a standard logging configuration.

func TCPAddrFromMultiAddr

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

Types

type ContextCloser added in v1.0.1

type ContextCloser struct {
	// contains filtered or unexported fields
}

func (ContextCloser) Close added in v1.0.1

func (cc ContextCloser) Close() error

type Finalizer added in v1.0.1

type Finalizer struct {
	// contains filtered or unexported fields
}

func NewFinalizer added in v1.0.1

func NewFinalizer() *Finalizer

Finalizer collects resources for convenient cleanup.

func (*Finalizer) Add added in v1.0.1

func (r *Finalizer) Add(cs ...io.Closer)

func (*Finalizer) Cleanup added in v1.0.1

func (r *Finalizer) Cleanup(err error) error

Jump to

Keyboard shortcuts

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