mdns

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConnThreshold    = 3
	TruncateDuration = 5 * time.Minute
)

ConnThreshold represents the minimum number of bootstrap peers we need a connection to.

Functions

This section is empty.

Types

type Advertiser

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

func NewAdvertiser

func NewAdvertiser(h host.Host) *Advertiser

func (*Advertiser) Advertise

func (a *Advertiser) Advertise(chanID int) error

Advertise broadcasts that we're providing data for the given code.

TODO: NewMdnsService also polls for peers. This is quite chatty, so we could extract the server-only logic.

func (Advertiser) DiscoveryID added in v0.3.1

func (p Advertiser) DiscoveryID(chanID int) string

DiscoveryID returns the string, that we use to advertise via mDNS and the DHT. See chanID above for more information. Using UnixNano for testing.

func (*Advertiser) Shutdown

func (a *Advertiser) Shutdown()

func (Advertiser) TimeSlotStart added in v0.3.1

func (p Advertiser) TimeSlotStart() time.Time

TimeSlotStart returns the time when the current time slot started.f

type Discoverer

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

func NewDiscoverer

func NewDiscoverer(h host.Host) *Discoverer

func (*Discoverer) Discover

func (d *Discoverer) Discover(chanID int, handler func(info peer.AddrInfo)) error

func (Discoverer) DiscoveryID added in v0.3.1

func (p Discoverer) DiscoveryID(chanID int) string

DiscoveryID returns the string, that we use to advertise via mDNS and the DHT. See chanID above for more information. Using UnixNano for testing.

func (*Discoverer) SetOffset added in v0.3.1

func (d *Discoverer) SetOffset(offset time.Duration) *Discoverer

func (*Discoverer) Shutdown

func (d *Discoverer) Shutdown()

func (Discoverer) TimeSlotStart added in v0.3.1

func (p Discoverer) TimeSlotStart() time.Time

TimeSlotStart returns the time when the current time slot started.f

Jump to

Keyboard shortcuts

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