discovery

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package discovery contains code for peer/neighbor discovery of other DTN nodes through UDP multicast packages.

Index

Constants

View Source
const (
	// DiscoveryAddress4 is the default multicast IPv4 address used for discovery.
	DiscoveryAddress4 = "224.23.23.23"

	// DiscoveryAddress6 is the default multicast IPv4 add6ess used for discovery.
	DiscoveryAddress6 = "ff02::23"

	// DiscoveryPort is the default multicast port used for discovery.
	DiscoveryPort = 35039
)

Variables

This section is empty.

Functions

func DiscoveryMessagesToCbor

func DiscoveryMessagesToCbor(dms []DiscoveryMessage) (data []byte, err error)

DiscoveryMessagesToCbor returns a CBOR byte string representation of this array of DiscoveryMessages.

Types

type CLAType

type CLAType uint

CLAType is the first field of a DiscoveryMessage, specifying a CLA.

const (
	// TCPCL is the "Delay-Tolerant Networking TCP Convergence Layer Protocol
	// Version 4" as specified in draft-ietf-dtn-tcpclv4-14 or newer.
	TCPCL CLAType = 0

	// MTCP is the "Minimal TCP Convergence-Layer Protocol" as specified in
	// draft-ietf-dtn-mtcpcl-01 or newer documents.
	MTCP CLAType = 1
)

type DiscoveryMessage

type DiscoveryMessage struct {
	Type     CLAType
	Endpoint bundle.EndpointID
	Port     uint
}

DiscoveryMessage is the kind of message used by this peer/neighbor discovery.

func NewDiscoveryMessagesFromCbor

func NewDiscoveryMessagesFromCbor(data []byte) (dms []DiscoveryMessage, err error)

NewDiscoveryMessagesFromCbor creates a new array of DiscoveryMessage based on the given CBOR byte string.

func (*DiscoveryMessage) MarshalCbor added in v0.1.1

func (dm *DiscoveryMessage) MarshalCbor(w io.Writer) error

func (DiscoveryMessage) String

func (dm DiscoveryMessage) String() string

func (*DiscoveryMessage) UnmarshalCbor added in v0.1.1

func (dm *DiscoveryMessage) UnmarshalCbor(r io.Reader) error

type DiscoveryService

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

DiscoveryService is a type to publish the node's CLAs to its network while discovering new peers. Internally UDP mulitcast packets are used.

func NewDiscoveryService

func NewDiscoveryService(dms []DiscoveryMessage, c *core.Core, interval uint, ipv4, ipv6 bool) (*DiscoveryService, error)

NewDiscoveryService starts a new DiscoveryService and promotes the given DiscoveryMessages through IPv4 and/or IPv6, as specified in the parameters. The time between broadcasting two DiscoveryMessages is configured in seconds. Furthermore, received DiscoveryMessages will be processed.

func (*DiscoveryService) Close

func (ds *DiscoveryService) Close()

Close shuts the DiscoveryService down.

Jump to

Keyboard shortcuts

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