discover

package
v0.10.0-beta1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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

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

func (Address) AppendXDR

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

func (*Address) DecodeXDR

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

func (Address) EncodeXDR

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

func (Address) MarshalXDR

func (o Address) MarshalXDR() []byte

func (*Address) UnmarshalXDR

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

type Announce

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

func (Announce) AppendXDR

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

func (*Announce) DecodeXDR

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

func (Announce) EncodeXDR

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

func (Announce) MarshalXDR

func (o Announce) MarshalXDR() []byte

func (*Announce) UnmarshalXDR

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

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

func (*Discoverer) ExtAnnounceOK

func (d *Discoverer) ExtAnnounceOK() bool

func (*Discoverer) Hint

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

func (*Discoverer) Lookup

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

func (*Discoverer) StartGlobal

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

func (*Discoverer) StartLocal

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

func (*Discoverer) StopGlobal

func (d *Discoverer) StopGlobal()

type Node

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

func (Node) AppendXDR

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

func (*Node) DecodeXDR

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

func (Node) EncodeXDR

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

func (Node) MarshalXDR

func (o Node) MarshalXDR() []byte

func (*Node) UnmarshalXDR

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

type Query

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

func (Query) AppendXDR

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

func (*Query) DecodeXDR

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

func (Query) EncodeXDR

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

func (Query) MarshalXDR

func (o Query) MarshalXDR() []byte

func (*Query) UnmarshalXDR

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