host

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0, BSD-3-Clause-Clear Imports: 4 Imported by: 0

Documentation

Overview

Package host is a fundamental part of networking system. Each host has:

  • one real network address (IP or any other transport protocol address)
  • multiple abstract network IDs (either host's own or ones belonging to relayed hosts)

Contains structures to describe network entities in code.

Usage:

 	originAddress, err := host.NewAddress(address)
	if err != nil {
		...
	}

	origin, err := host.NewOrigin(nil, originAddress)
	if err != nil {
		...
	}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	net.UDPAddr
}

Address is host's real network address.

func NewAddress

func NewAddress(address string) (*Address, error)

NewAddress is constructor.

func (Address) Equal

func (address Address) Equal(other Address) bool

Equal checks if address is equal to another.

type Host

type Host struct {
	// NodeID is unique identifier of the node
	NodeID core.RecordRef
	// ShortID is shortened unique identifier of the node inside the globe
	ShortID core.ShortNodeID
	// Address is IP and port.
	Address *Address
}

Host is the over-the-wire representation of a host.

func NewHost

func NewHost(address string) (*Host, error)

NewHost creates a new Host with specified physical address.

func NewHostN added in v0.6.3

func NewHostN(address string, nodeID core.RecordRef) (*Host, error)

NewHostN creates a new Host with specified physical address and NodeID.

func NewHostNS added in v0.6.3

func NewHostNS(address string, nodeID core.RecordRef, shortID core.ShortNodeID) (*Host, error)

NewHostNS creates a new Host with specified physical address, NodeID and ShortID.

func (Host) Equal

func (host Host) Equal(other Host) bool

Equal checks if host equals to other host (e.g. hosts' IDs and network addresses match).

func (Host) String

func (host Host) String() string

String representation of Host.

Jump to

Keyboard shortcuts

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