mesh

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package mesh is used to manage the Manager network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Name   string `json:"name"`
	IPv4   string `json:"ipv4"`
	Status State  `json:"status"`
}

type Manager

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

Manager is used to manage all tunnels connected to the current node.

func NewManager

func NewManager(dialer *net.Dialer, localPeer types.LocalPeer, callback tunnel.FragmentCallback, rm *relay.Manager, router device.Router) *Manager

func (*Manager) Peer

func (m *Manager) Peer(peerID protocol.PeerID) *peer.Peer

Peer returns the communication Tunnel corresponding to the destination.

func (*Manager) PeerCatchup

func (m *Manager) PeerCatchup(syncPeer *message.PacketSyncPeer) error

func (*Manager) PeerCatchupAck

func (m *Manager) PeerCatchupAck(syncPeer *message.PacketSyncPeer)

func (*Manager) PeerEndpoints

func (m *Manager) PeerEndpoints(syncPeer *message.PacketSyncPeer)

func (*Manager) ProbeResult

func (m *Manager) ProbeResult(probe *message.PacketProbeResponse)

ProbeResult handles the probe response from relay server.

func (*Manager) Summarize

func (m *Manager) Summarize() *Summary

Summarize returns the mesh network summary.

func (*Manager) SyncEndpoints

func (m *Manager) SyncEndpoints(endpoints []string)

SyncEndpoints synchronize the latest endpoints to the remote peers which had established P2P connection with the local peer.

func (*Manager) Tick

func (m *Manager) Tick()

func (*Manager) Tunnel

func (m *Manager) Tunnel(dest string) *tunnel.Tunnel

func (*Manager) Update

func (m *Manager) Update(latestNetworks []protocol.Network, latestPeers []protocol.Peer) error

Update updates the latest networks and peers information.

type Network

type Network struct {
	ID      uint64   `json:"id"`
	Name    string   `json:"name"`
	Devices []Device `json:"devices"`
}

type State

type State byte
const (
	StatePending State = 0
	StateRelay   State = 1
	StateP2P     State = 2
)

func (State) String

func (s State) String() string

String implements the fmt.Stringer interface

type Summary

type Summary struct {
	LastChangedAt time.Time `json:"-"`
	MyDevices     []Device  `json:"my_devices"`
	Networks      []Network `json:"networks"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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