discover

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2014 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package discover implements the node discovery protocol.

Index

Constants

View Source
const (
	AnnouncementMagic = 0x9D79BC39
	QueryMagic        = 0x2CA856F5
)

Variables

View Source
var (
	ErrIncorrectMagic = errors.New("incorrect magic number")
)

Functions

This section is empty.

Types

type Address added in v0.6.0

type Address struct {
	IP   []byte // max:16
	Port uint16
}

func (Address) AppendXDR added in v0.9.0

func (o Address) AppendXDR(bs []byte) []byte

func (*Address) DecodeXDR added in v0.6.0

func (o *Address) DecodeXDR(r io.Reader) error

func (Address) EncodeXDR added in v0.6.0

func (o Address) EncodeXDR(w io.Writer) (int, error)

func (Address) MarshalXDR added in v0.6.0

func (o Address) MarshalXDR() []byte

func (*Address) UnmarshalXDR added in v0.6.0

func (o *Address) UnmarshalXDR(bs []byte) error

type Announce added in v0.9.0

type Announce struct {
	Magic uint32
	This  Node
	Extra []Node // max:16
}

func (Announce) AppendXDR added in v0.9.0

func (o Announce) AppendXDR(bs []byte) []byte

func (*Announce) DecodeXDR added in v0.9.0

func (o *Announce) DecodeXDR(r io.Reader) error

func (Announce) EncodeXDR added in v0.9.0

func (o Announce) EncodeXDR(w io.Writer) (int, error)

func (Announce) MarshalXDR added in v0.9.0

func (o Announce) MarshalXDR() []byte

func (*Announce) UnmarshalXDR added in v0.9.0

func (o *Announce) UnmarshalXDR(bs []byte) error

type Discoverer

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

func NewDiscoverer

func NewDiscoverer(id protocol.NodeID, addresses []string) *Discoverer

func (*Discoverer) All added in v0.8.6

func (d *Discoverer) All() map[protocol.NodeID][]cacheEntry

func (*Discoverer) ExtAnnounceOK added in v0.8.1

func (d *Discoverer) ExtAnnounceOK() bool

func (*Discoverer) Hint added in v0.8.6

func (d *Discoverer) Hint(node string, addrs []string)

func (*Discoverer) Lookup

func (d *Discoverer) Lookup(node protocol.NodeID) []string

func (*Discoverer) StartGlobal added in v0.8.1

func (d *Discoverer) StartGlobal(server string, extPort uint16)

func (*Discoverer) StartLocal added in v0.8.1

func (d *Discoverer) StartLocal(localPort int, localMCAddr string)

func (*Discoverer) StopGlobal added in v0.9.5

func (d *Discoverer) StopGlobal()

type Node added in v0.8.6

type Node struct {
	ID        []byte    // max:32
	Addresses []Address // max:16
}

func (Node) AppendXDR added in v0.9.0

func (o Node) AppendXDR(bs []byte) []byte

func (*Node) DecodeXDR added in v0.8.6

func (o *Node) DecodeXDR(r io.Reader) error

func (Node) EncodeXDR added in v0.8.6

func (o Node) EncodeXDR(w io.Writer) (int, error)

func (Node) MarshalXDR added in v0.8.6

func (o Node) MarshalXDR() []byte

func (*Node) UnmarshalXDR added in v0.8.6

func (o *Node) UnmarshalXDR(bs []byte) error

type Query added in v0.9.0

type Query struct {
	Magic  uint32
	NodeID []byte // max:32
}

func (Query) AppendXDR added in v0.9.0

func (o Query) AppendXDR(bs []byte) []byte

func (*Query) DecodeXDR added in v0.9.0

func (o *Query) DecodeXDR(r io.Reader) error

func (Query) EncodeXDR added in v0.9.0

func (o Query) EncodeXDR(w io.Writer) (int, error)

func (Query) MarshalXDR added in v0.9.0

func (o Query) MarshalXDR() []byte

func (*Query) UnmarshalXDR added in v0.9.0

func (o *Query) UnmarshalXDR(bs []byte) error

Jump to

Keyboard shortcuts

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