opts

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Defaults = func(o *Options) error {
	o.Datastore = dssync.MutexWrap(ds.NewMapDatastore())
	o.Relay = false
	o.Addr, _ = multiaddr.NewMultiaddr("/ip4/0.0.0.0/tcp/0")
	o.BucketSize = 20
	o.BootstrapPeers = dht.DefaultBootstrapPeers
	return nil
}

Defaults are the default Hydra options. This option will be automatically prepended to any options you pass to the Hydra constructor.

Functions

This section is empty.

Types

type Option

type Option func(*Options) error

Option is the Hydra option type.

func Addr

func Addr(addr multiaddr.Multiaddr) Option

Addr configures the swarm address for this Hydra node. The default value is /ip4/0.0.0.0/tcp/0.

func BootstrapPeers

func BootstrapPeers(addrs []multiaddr.Multiaddr) Option

BootstrapPeers configures the set of bootstrap peers that should be randomly selected from. The default value is `dht.DefaultBootstrapPeers`.

func BucketSize

func BucketSize(bucketSize int) Option

BucketSize configures the bucket size of the routing table. The default value is 20.

func Datastore

func Datastore(ds ds.Batching) Option

Datastore configures the Hydra Node to use the specified datastore. Defaults to an in-memory (temporary) map.

func Limiter

func Limiter(l chan struct{}) Option

Limiter configures ???. The default value is nil.

func Relay

func Relay(relay bool) Option

Relay configures whether this node acts as a relay node. The default value is false.

func RoutingTable

func RoutingTable(rt *kbucket.RoutingTable) Option

RoutingTable configures the Hydra Node to use the specified routing table. Defaults to the routing table provided by IpfsDHT.

type Options

type Options struct {
	Datastore      ds.Batching
	RoutingTable   *kbucket.RoutingTable
	Relay          bool
	Addr           multiaddr.Multiaddr
	BucketSize     int
	Limiter        chan struct{}
	BootstrapPeers []multiaddr.Multiaddr
}

Options are Hydra Node options

func (*Options) Apply

func (o *Options) Apply(opts ...Option) error

Apply applies the given options to this Option.

Jump to

Keyboard shortcuts

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