discover

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2014 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package discover implements the node discovery protocol.

Index

Constants

View Source
const (
	AnnouncementMagicV1 = 0x20121025
	QueryMagicV1        = 0x19760309
)
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 AnnounceV1 added in v0.6.0

type AnnounceV1 struct {
	Magic  uint32
	Port   uint16
	NodeID string // max:64
	IP     []byte // max:16
}

func (*AnnounceV1) DecodeXDR added in v0.6.0

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

func (AnnounceV1) EncodeXDR added in v0.6.0

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

func (AnnounceV1) MarshalXDR added in v0.6.0

func (o AnnounceV1) MarshalXDR() []byte

func (*AnnounceV1) UnmarshalXDR added in v0.6.0

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

type AnnounceV2 added in v0.6.0

type AnnounceV2 struct {
	Magic     uint32
	NodeID    string    // max:64
	Addresses []Address // 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 {
	MyID             string
	ListenAddresses  []string
	BroadcastIntv    time.Duration
	ExtBroadcastIntv time.Duration
	// contains filtered or unexported fields
}

func NewDiscoverer

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

func (*Discoverer) Lookup

func (d *Discoverer) Lookup(node string) []string

type QueryV1 added in v0.6.0

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

func (*QueryV1) DecodeXDR added in v0.6.0

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

func (QueryV1) EncodeXDR added in v0.6.0

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

func (QueryV1) MarshalXDR added in v0.6.0

func (o QueryV1) MarshalXDR() []byte

func (*QueryV1) UnmarshalXDR added in v0.6.0

func (o *QueryV1) 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