yggdrasil

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YggListenTCP       = 9943
	YggListenTLS       = 9944
	YggListenLinkLocal = 9945

	YggIface = "ygg0"
)

List of port used by yggdrasil

Variables

View Source
var PeerListFallback = PeerList{
	{
		Endpoint: "tls://45.147.198.155:6010",
		Up:       true,
	},
	{
		Endpoint: "tcp://51.15.204.214:12345",
		Up:       true,
	},
	{
		Endpoint: "tcp://45.138.172.192:5001",
		Up:       true,
	},
}

PeerListFallback is an hardcoded list of public yggdrasil node it is used to have some available peer to connect to when we failed to read the online public peer info

Functions

func GenerateConfig

func GenerateConfig(privateKey ed25519.PrivateKey) (cfg config.NodeConfig)

GenerateConfig creates a new yggdrasil configuration and generate the box and signing key from the ed25519 Private key of the node this creates a mapping between a yggdrasil identity and the TFGrid identity

Types

type NodeInfo

type NodeInfo struct {
	Endpoint   string `json:"-"`
	Up         bool   `json:"up"`
	BoxPubKey  string `json:"key"`
	LastSeen   int    `json:"last_seen"`
	ProtoMinor int    `json:"proto_minor"`
}

NodeInfo is the know information about an yggdrasil public node

type PeerList

type PeerList []NodeInfo

PeerList is yggdrasil peers list

func FetchPeerList

func FetchPeerList() (PeerList, error)

FetchPeerList download the list of public yggdrasil peer from https://publicpeers.neilalexander.dev/publicnodes.json

func (PeerList) Ups

func (p PeerList) Ups() PeerList

Ups return all the peers that are marked up from the PeerList p

type Server

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

Server represent a yggdrasil server

func NewServer

func NewServer(zinit *zinit.Client, cfg *config.NodeConfig) *Server

NewServer create a new yggdrasil Server

func (*Server) Address

func (s *Server) Address() (net.IP, error)

Address return the address in the 200::/7 subnet allocated by yggdrasil

func (*Server) Gateway

func (s *Server) Gateway() (net.IPNet, error)

Gateway return the first IP of the 300::/64 subnet allocated by yggdrasil

func (*Server) NodeID

func (s *Server) NodeID() (ed25519.PublicKey, error)

NodeID returns the yggdrasil node ID of s

func (*Server) Start

func (s *Server) Start() error

Start creates an yggdrasil zinit service and starts it

func (*Server) Stop

func (s *Server) Stop() error

Stop stop the yggdrasil zinit service

func (*Server) Subnet

func (s *Server) Subnet() (net.IPNet, error)

Subnet return the 300::/64 subnet allocated by yggdrasil

func (*Server) SubnetFor

func (s *Server) SubnetFor(b []byte) (net.IP, error)

SubnetFor return an IP address out of the node allocated subnet by hasing b and using it to generate the last 64 bits of the IPV6 address

func (*Server) Tun

func (s *Server) Tun() string

Tun return the name of the TUN interface created by yggdrasil

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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