yggdrasil

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

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

	YggIface = "ygg0"
)

List of port used by yggdrasil

View Source
const (
	// YggNSInf inside the namespace
	YggNSInf = "nygg6"
)

Variables

View Source
var PeerListFallback = Peers{
	{
		Endpoint: "tls://45.147.198.155:6010",
		Up:       true,
	},
	{
		Endpoint: "tcp://51.15.204.214:12345",
		Up:       true,
	},
	{
		Endpoint: "tls://51.255.223.60:54232",
		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

View Source
var (
	YggRange = net.IPNet{
		IP:   net.ParseIP("200::"),
		Mask: net.CIDRMask(7, 128),
	}
)

Functions

func IPV4Only added in v0.5.5

func IPV4Only(ip net.IP) bool

IPV4Only is an IPFilter function that filters out non IPv4 address

Types

type Filter added in v0.5.5

type Filter func(ip net.IP) bool

func Exclude added in v0.5.5

func Exclude(ranges Ranges) Filter

Exclude ranges, return IPs that are NOT in the given ranges

func Include added in v0.5.5

func Include(ranges Ranges) Filter

Include ranges, return IPs that are IN one of the given ranges

type NodeConfig added in v0.5.5

type NodeConfig config.NodeConfig

NodeConfig wrapper around yggdrasil node config

func GenerateConfig

func GenerateConfig(privateKey ed25519.PrivateKey) (cfg 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

func (*NodeConfig) Address added in v0.5.5

func (n *NodeConfig) Address() (net.IP, error)

Address gets the address from the config

func (*NodeConfig) FindPeers added in v0.5.5

func (n *NodeConfig) FindPeers(ctx context.Context, filter ...Filter) error

type NodeInfo

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

NodeInfo is the know information about an yggdrasil public node

type Peers added in v0.5.5

type Peers []NodeInfo

Peers is a peers list

func FetchPubYggPeerList added in v0.5.5

func FetchPubYggPeerList() (Peers, error)

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

func (Peers) Ups added in v0.5.5

func (p Peers) Ups(filter ...Filter) (Peers, error)

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

type Ranges added in v0.5.5

type Ranges []net.IPNet

Ranges is a list of net.IPNet

type YggServer added in v0.5.5

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

YggServer represent a yggdrasil server

func EnsureYggdrasil added in v0.5.5

func EnsureYggdrasil(ctx context.Context, privateKey ed25519.PrivateKey, ns YggdrasilNamespace) (*YggServer, error)

func NewYggServer added in v0.5.5

func NewYggServer(cfg *NodeConfig) *YggServer

NewYggServer create a new yggdrasil Server

func (*YggServer) Address added in v0.5.5

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

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

func (*YggServer) Ensure added in v0.5.5

func (s *YggServer) Ensure(z *zinit.Client, ns string) error

Start creates an yggdrasil zinit service and starts it

func (*YggServer) Gateway added in v0.5.5

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

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

func (*YggServer) NodeID added in v0.5.5

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

NodeID returns the yggdrasil node ID of s

func (*YggServer) Reload added in v0.5.5

func (s *YggServer) Reload(z *zinit.Client) error

func (*YggServer) Restart added in v0.5.5

func (s *YggServer) Restart(z *zinit.Client) error

func (*YggServer) Subnet added in v0.5.5

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

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

func (*YggServer) SubnetFor added in v0.5.5

func (s *YggServer) SubnetFor(b []byte) (net.IPNet, 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 (*YggServer) Tun added in v0.5.5

func (s *YggServer) Tun() string

Tun return the name of the TUN interface created by yggdrasil

type YggdrasilNamespace added in v0.5.5

type YggdrasilNamespace interface {
	Name() string
	// IsIPv4Only checks if namespace has NO public ipv6 on any of its interfaces
	IsIPv4Only() (bool, error)
	// GetIPs return a list of all IPv6 inside this namespace.
	GetIPs() ([]net.IPNet, error)
	// SetYggIP sets the ygg ipv6 on the nygg6 iterface.
	SetYggIP(ip net.IPNet, gw net.IP) error
}

func NewYggdrasilNamespace added in v0.5.5

func NewYggdrasilNamespace(ns string) (YggdrasilNamespace, error)

Jump to

Keyboard shortcuts

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