Convert Figma logo to code with AI

yggdrasil-network logoyggdrasil-go

An experiment in scalable routing as an encrypted IPv6 overlay network

3,505
242
3,505
113

Top Related Projects

Dendrite is a second-generation Matrix homeserver written in Go!

libp2p implementation in Go

64,580

Open Source Continuous File Synchronization

5,185

An encrypted IPv6 network using public-key cryptography for address allocation and a distributed hash table for routing.

16,006

An IPFS implementation in Go

æternity blockchain - scalable blockchain for the people - smart contracts, state channels, names, tokens

Quick Overview

Yggdrasil-go is an implementation of the Yggdrasil Network, an experimental end-to-end encrypted IPv6 network. It aims to create a scalable and self-arranging network with minimal configuration requirements. Yggdrasil uses a globally-agreed spanning tree to route packets and implements cryptographic routing techniques for improved privacy and security.

Pros

  • Provides end-to-end encryption for all network traffic
  • Self-configuring and self-healing network architecture
  • Supports IPv6 connectivity, even over IPv4-only networks
  • Offers improved privacy and censorship resistance

Cons

  • Experimental technology, not yet suitable for production use
  • Limited adoption and smaller network size compared to traditional internet
  • May have performance overhead due to encryption and routing techniques
  • Requires some technical knowledge to set up and use effectively

Getting Started

To get started with Yggdrasil-go:

  1. Install Yggdrasil:

    go get -u github.com/yggdrasil-network/yggdrasil-go
    
  2. Generate a configuration file:

    sudo yggdrasil -genconf > /etc/yggdrasil.conf
    
  3. Edit the configuration file as needed.

  4. Start Yggdrasil:

    sudo yggdrasil -useconffile /etc/yggdrasil.conf
    
  5. Connect to the Yggdrasil network and start exploring IPv6 addresses.

For more detailed instructions and advanced configuration options, refer to the project's documentation on GitHub.

Competitor Comparisons

Dendrite is a second-generation Matrix homeserver written in Go!

Pros of Dendrite

  • Designed specifically for Matrix protocol, offering native support for Matrix features
  • Scalable architecture with separate components for different functions
  • Written in Go, providing good performance and concurrency handling

Cons of Dendrite

  • More complex setup and configuration compared to Yggdrasil
  • Requires additional infrastructure (e.g., database) for full functionality
  • Still in active development, may have stability issues compared to mature projects

Code Comparison

Dendrite (Matrix server implementation):

func (r *InternalAPIServer) QueryDevices(
    ctx context.Context,
    req *api.QueryDevicesRequest,
    res *api.QueryDevicesResponse,
) error {
    devices, err := r.DB.DeviceDatabase.GetDevicesByLocalpart(ctx, req.UserID.LocalPart())
    if err != nil {
        return err
    }
    res.Devices = devices
    return nil
}

Yggdrasil (Network routing implementation):

func (t *core) handlePacket(p *wire.Packet) {
    if p.IsRoutingWork() {
        t.handleRoutingWork(p)
    } else {
        t.handleTraffic(p)
    }
}

The code snippets demonstrate the different focus areas of the projects: Dendrite handles Matrix-specific operations, while Yggdrasil focuses on network routing and packet handling.

libp2p implementation in Go

Pros of go-libp2p

  • More extensive and modular networking stack with support for various protocols
  • Larger community and ecosystem, with wider adoption in decentralized projects
  • Better documentation and examples for developers

Cons of go-libp2p

  • Higher complexity and steeper learning curve for beginners
  • Less focused on specific use cases, requiring more configuration

Code Comparison

go-libp2p

host, err := libp2p.New(
    libp2p.ListenAddrStrings("/ip4/0.0.0.0/tcp/0"),
    libp2p.Identity(priv),
)

yggdrasil-go

n := core.New(core.NodeConfig{
    AdminSocket: cfg.AdminListen,
    MulticastInterfaces: cfg.MulticastInterfaces,
})

go-libp2p provides a more flexible and customizable approach to creating a network host, while yggdrasil-go offers a simpler, more opinionated configuration for its specific use case.

go-libp2p is better suited for developers building complex decentralized applications with custom networking requirements, while yggdrasil-go is more appropriate for those seeking a ready-to-use mesh networking solution with minimal configuration.

Both projects are written in Go and focus on peer-to-peer networking, but they serve different purposes and target different user bases. The choice between them depends on the specific requirements of your project and your familiarity with networking concepts.

64,580

Open Source Continuous File Synchronization

Pros of Syncthing

  • Mature and widely adopted file synchronization solution
  • User-friendly interface with desktop and mobile applications
  • Extensive documentation and community support

Cons of Syncthing

  • Limited to file synchronization, not a general-purpose networking tool
  • May have higher resource usage for large numbers of files or frequent changes

Code Comparison

Syncthing (Go):

func (m *Model) Index(folder string, fs fs.Filesystem, sub string) error {
    m.fmut.RLock()
    folderCfg := m.folderCfgs[folder]
    m.fmut.RUnlock()

    if folderCfg.Type == config.FolderTypeReceiveOnly {
        return errors.New("folder is receive-only")
    }
    // ...
}

Yggdrasil (Go):

func (t *tcp) listen() {
    defer t.listener.Close()
    for {
        conn, err := t.listener.Accept()
        if err != nil {
            t.link.core.log.Errorln("TCP accept error:", err)
            return
        }
        // ...
    }
}

While both projects are written in Go, they serve different purposes. Syncthing focuses on file synchronization, with code handling folder configurations and file system operations. Yggdrasil, being a networking tool, deals with lower-level network operations like TCP connections.

5,185

An encrypted IPv6 network using public-key cryptography for address allocation and a distributed hash table for routing.

Pros of cjdns

  • More mature project with longer development history
  • Supports a wider range of platforms, including older systems
  • Has a larger and more established community

Cons of cjdns

  • More complex configuration and setup process
  • Less active development in recent years
  • Potentially slower performance due to older codebase

Code Comparison

cjdns (C):

struct Headers_IP6_Header* header = (struct Headers_IP6_Header*) message->bytes;
Assert_true(message->length >= Headers_IP6_Header_SIZE);
uint16_t payloadLength = Endian_bigEndianToHost16(header->payloadLength_be);

Yggdrasil (Go):

ipv6 := packet.GetIPv6Header()
if ipv6 == nil {
    return
}
payloadLength := ipv6.PayloadLength

Both projects aim to create decentralized mesh networks, but Yggdrasil is newer and written in Go, while cjdns is older and primarily in C. Yggdrasil focuses on simplicity and performance, whereas cjdns offers more features and platform support. The code comparison shows cjdns using C structs and manual endianness handling, while Yggdrasil leverages Go's built-in IPv6 packet parsing.

16,006

An IPFS implementation in Go

Pros of Kubo

  • More mature and widely adopted project with a larger community
  • Supports content-addressed data storage and retrieval
  • Offers a robust set of features for distributed file systems

Cons of Kubo

  • Higher resource consumption and complexity
  • Steeper learning curve for new users
  • May be overkill for simple networking tasks

Code Comparison

Yggdrasil-go (configuration example):

{
  "Listen": ["tcp://[::]:0"],
  "AdminListen": "unix:///var/run/yggdrasil.sock",
  "MulticastInterfaces": [".*"],
  "IfName": "auto",
  "NodeInfo": {}
}

Kubo (configuration example):

{
  "Addresses": {
    "Swarm": ["/ip4/0.0.0.0/tcp/4001", "/ip6/::/tcp/4001"],
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Gateway": "/ip4/127.0.0.1/tcp/8080"
  },
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN"
  ]
}

The code examples show that Yggdrasil-go focuses on network configuration, while Kubo's configuration is more complex, reflecting its broader feature set for distributed file systems.

æternity blockchain - scalable blockchain for the people - smart contracts, state channels, names, tokens

Pros of Aeternity

  • More comprehensive blockchain platform with smart contract capabilities
  • Larger community and ecosystem with active development
  • Built-in state channels for scalability and off-chain transactions

Cons of Aeternity

  • More complex codebase and architecture
  • Higher resource requirements for running a full node
  • Steeper learning curve for developers and users

Code Comparison

Yggdrasil-go (network configuration):

type NodeConfig struct {
    Listen        []string
    AdminListen   string
    Peers         []string
    AllowedPublicKeys []string
    PublicKey     string
    PrivateKey    string
}

Aeternity (smart contract example):

contract SimpleStorage =
  record state = { data : int }
  entrypoint init(value : int) = { data = value }
  entrypoint get() = state.data
  stateful entrypoint set(value : int) = put(state{ data = value })

Yggdrasil-go focuses on networking and routing, with a simpler configuration structure. Aeternity, being a blockchain platform, includes smart contract functionality and more complex data structures.

Both projects are open-source and actively maintained, but Aeternity has a larger scope and more diverse features, while Yggdrasil-go is more specialized in mesh networking.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Yggdrasil

Build status

Introduction

Yggdrasil is an early-stage implementation of a fully end-to-end encrypted IPv6 network. It is lightweight, self-arranging, supported on multiple platforms and allows pretty much any IPv6-capable application to communicate securely with other Yggdrasil nodes. Yggdrasil does not require you to have IPv6 Internet connectivity - it also works over IPv4.

Supported Platforms

Yggdrasil works on a number of platforms, including Linux, macOS, Ubiquiti EdgeRouter, VyOS, Windows, FreeBSD, OpenBSD and OpenWrt.

Please see our Installation page for more information. You may also find other platform-specific wrappers, scripts or tools in the contrib folder.

Building

If you want to build from source, as opposed to installing one of the pre-built packages:

  1. Install Go (requires Go 1.21 or later)
  2. Clone this repository
  3. Run ./build

Note that you can cross-compile for other platforms and architectures by specifying the GOOS and GOARCH environment variables, e.g. GOOS=windows ./build or GOOS=linux GOARCH=mipsle ./build.

Running

Generate configuration

To generate static configuration, either generate a HJSON file (human-friendly, complete with comments):

./yggdrasil -genconf > /path/to/yggdrasil.conf

... or generate a plain JSON file (which is easy to manipulate programmatically):

./yggdrasil -genconf -json > /path/to/yggdrasil.conf

You will need to edit the yggdrasil.conf file to add or remove peers, modify other configuration such as listen addresses or multicast addresses, etc.

Run Yggdrasil

To run with the generated static configuration:

./yggdrasil -useconffile /path/to/yggdrasil.conf

To run in auto-configuration mode (which will use sane defaults and random keys at each startup, instead of using a static configuration file):

./yggdrasil -autoconf

You will likely need to run Yggdrasil as a privileged user or under sudo, unless you have permission to create TUN/TAP adapters. On Linux this can be done by giving the Yggdrasil binary the CAP_NET_ADMIN capability.

Documentation

Documentation is available on our website.

Community

Feel free to join us on our Matrix channel at #yggdrasil:matrix.org or in the #yggdrasil IRC channel on libera.chat.

License

This code is released under the terms of the LGPLv3, but with an added exception that was shamelessly taken from godeb. Under certain circumstances, this exception permits distribution of binaries that are (statically or dynamically) linked with this code, without requiring the distribution of Minimal Corresponding Source or Minimal Application Code. For more details, see: LICENSE.