discover

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: May 16, 2014 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package discover implements the node discovery protocol.

Index

Constants

View Source
const (
	AnnouncementMagicV2 = 0x029E4C77
	QueryMagicV2        = 0x23D63A9A
)
View Source
const (
	AnnouncementPort = 21025
)

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) 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 AnnounceV2 added in v0.6.0

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

func (*AnnounceV2) DecodeXDR added in v0.6.0

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

func (AnnounceV2) EncodeXDR added in v0.6.0

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

func (AnnounceV2) MarshalXDR added in v0.6.0

func (o AnnounceV2) MarshalXDR() []byte

func (*AnnounceV2) UnmarshalXDR added in v0.6.0

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

type Discoverer

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

func NewDiscoverer

func NewDiscoverer(id string, addresses []string) (*Discoverer, error)

func (*Discoverer) All added in v0.8.6

func (d *Discoverer) All() map[string][]string

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 string) []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()

type Node added in v0.8.6

type Node struct {
	ID        string    // max:64
	Addresses []Address // max:16
}

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 QueryV2 added in v0.6.0

type QueryV2 struct {
	Magic  uint32
	NodeID string // max:64
}

func (*QueryV2) DecodeXDR added in v0.6.0

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

func (QueryV2) EncodeXDR added in v0.6.0

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

func (QueryV2) MarshalXDR added in v0.6.0

func (o QueryV2) MarshalXDR() []byte

func (*QueryV2) UnmarshalXDR added in v0.6.0

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

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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