Documentation ¶
Index ¶
- Constants
- type GreedyAddr
- type PeerInfo
- type Router
- func (r *Router) Addr() net.Addr
- func (r *Router) Ascending() (*types.PublicKey, *types.VirtualSnakePathID)
- func (r *Router) AuthenticatedConnect(conn net.Conn, zone string, peertype int) (types.SwitchPortID, error)
- func (r *Router) Close() error
- func (r *Router) Connect(conn net.Conn, public types.PublicKey, zone string, peertype int) (types.SwitchPortID, error)
- func (r *Router) Coords() types.SwitchPorts
- func (r *Router) DHTInfo() (asc, desc *virtualSnakeEntry, table map[virtualSnakeIndex]virtualSnakeEntry, ...)
- func (r *Router) Descending() (*types.PublicKey, *types.VirtualSnakePathID)
- func (r *Router) IsConnected(key types.PublicKey, zone string) bool
- func (r *Router) IsRoot() bool
- func (r *Router) LocalAddr() net.Addr
- func (r *Router) ParentPublicKey() types.PublicKey
- func (r *Router) Peers() []PeerInfo
- func (r *Router) PrivateKey() types.PrivateKey
- func (r *Router) PublicKey() types.PublicKey
- func (r *Router) ReadFrom(p []byte) (n int, addr net.Addr, err error)
- func (r *Router) RootPublicKey() types.PublicKey
- func (r *Router) SNEKPing(ctx context.Context, dst types.PublicKey) (time.Duration, error)
- func (r *Router) SetDeadline(t time.Time) error
- func (r *Router) SetReadDeadline(t time.Time) error
- func (r *Router) SetWriteDeadline(t time.Time) error
- func (r *Router) ToggleDebug()
- func (r *Router) TreePing(ctx context.Context, dst types.SwitchPorts) (time.Duration, error)
- func (r *Router) WriteTo(p []byte, addr net.Addr) (n int, err error)
- type Simulator
- type SourceAddr
Constants ¶
const ( PeerTypeMulticast int = iota PeerTypeBluetooth PeerTypeRemote )
const PeerKeepaliveInterval = time.Second * 3
const PeerKeepaliveTimeout = time.Second * 5
const PortCount = math.MaxUint8
const TrafficBuffer = math.MaxUint8
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GreedyAddr ¶
type GreedyAddr struct {
types.SwitchPorts
}
GreedyAddr implements net.Addr, containing a greedy-routed set of destination coordinates to another node.
func (GreedyAddr) Network ¶
func (a GreedyAddr) Network() string
func (GreedyAddr) String ¶
func (a GreedyAddr) String() string
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) Ascending ¶ added in v0.3.0
func (r *Router) Ascending() (*types.PublicKey, *types.VirtualSnakePathID)
func (*Router) AuthenticatedConnect ¶
func (*Router) Coords ¶
func (r *Router) Coords() types.SwitchPorts
func (*Router) Descending ¶ added in v0.3.0
func (r *Router) Descending() (*types.PublicKey, *types.VirtualSnakePathID)
func (*Router) IsConnected ¶
IsConnected returns true if the node is connected within the given zone, or false otherwise.
func (*Router) LocalAddr ¶
LocalAddr returns a net.Addr containing the greedy routing coordinates for this node.
func (*Router) ParentPublicKey ¶ added in v0.2.0
func (*Router) PrivateKey ¶
func (r *Router) PrivateKey() types.PrivateKey
func (*Router) ReadFrom ¶
ReadFrom reads the next packet that was delivered to this node over the Pinecone network. Only traffic packets will be returned here - no protocol messages will be included. The net.Addr returned will contain the appropriate return path based on the mechanism used to deliver the packet. If the packet was delivered using greedy routing, then the net.Addr will contain the source coordinates. If the packet was delivered using source routing, then the net.Addr will contain the source-routed path back to the sender.
func (*Router) RootPublicKey ¶
func (*Router) SetDeadline ¶
SetDeadline is not implemented.
func (*Router) SetReadDeadline ¶
SetReadDeadline is not implemented.
func (*Router) SetWriteDeadline ¶
SetWriteDeadline is not implemented.
func (*Router) ToggleDebug ¶ added in v0.4.0
func (r *Router) ToggleDebug()
type Simulator ¶
type Simulator interface { ReportDistance(a, b string, l int64) LookupCoords(string) (types.SwitchPorts, error) LookupNodeID(types.SwitchPorts) (string, error) LookupPublicKey(types.PublicKey) (string, error) ReportNewLink(net.Conn, types.PublicKey, types.PublicKey) ReportDeadLink(types.PublicKey, types.PublicKey) }
type SourceAddr ¶
type SourceAddr struct {
types.SwitchPorts
}
SourceAddr implements net.Addr, containing a source-routed path to another node.
func (SourceAddr) Network ¶
func (a SourceAddr) Network() string
func (SourceAddr) String ¶
func (a SourceAddr) String() string