Skip to content

benjaminbear/go-qnetd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-QNetd

A Go port of corosync-qnetd, optimized for embedded devices with minimal dependencies.

Overview

Go-QNetd is a quorum device network daemon that provides votes to Corosync clusters. It's designed to:

  • Run outside the cluster as a vote provider
  • Support multiple clusters dynamically (no configuration file)
  • Use a TLV-based protocol over TCP/TLS
  • Implement quorum decision algorithms (FFSplit, LMS, 2NodeLMS, Test)
  • Operate with minimal resource usage for embedded deployments

Features

  • ✅ 100% binary protocol compatibility with C corosync-qdevice
  • ✅ Pure Go implementation (no C dependencies)
  • ✅ All 18 message types supported
  • ✅ All 4 decision algorithms implemented (FFSplit, LMS, 2NodeLMS, Test)
  • ✅ TLS support via Go's crypto/tls (Phase 5: TLS upgrade pending)
  • ✅ Minimal binary size and memory footprint
  • ✅ Event-driven architecture for efficiency
  • ✅ Comprehensive CLI flags matching C implementation
  • ✅ Daemonization support (Unix systems)
  • ✅ Fuzzing tests for protocol robustness
  • ✅ Runtime-configurable log levels

Status

Phases 1-4 Complete: Foundation, Network Layer, Protocol Implementation, and Algorithms

Phase 6 In Progress: Integration & Polish (CLI flags, fuzzing, documentation)

Phase 5 Pending: TLS & Certificates (TLS upgrade, certutil tool)

See PROJECT_PLAN.md for detailed implementation status.

Building

Prerequisites

  • Go 1.25 or later
  • Make (optional, for convenience targets)

Build Commands

# Build both binaries
make build

# Run tests
make test

# Run fuzzing tests (Go 1.18+)
make fuzz

# Format code
make fmt

# Run linter
make vet

# Clean build artifacts
make clean

Manual Build

# Build daemon
CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -o bin/qnetd ./cmd/qnetd

# Build certutil
CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -o bin/qnetd-certutil ./cmd/qnetd-certutil

Project Structure

go-qnetd/
├── cmd/                   # Application entry points
│   ├── qnetd/            # Main daemon
│   └── qnetd-certutil/   # Certificate management tool
├── internal/             # Internal packages
│   ├── protocol/        # Protocol implementation (TLV, messages)
│   ├── server/          # Server core, event loop, connections, clusters
│   │   ├── algorithm/   # Decision algorithms (FFSplit, LMS, 2NodeLMS, Test)
│   │   ├── connection.go # Client connection management
│   │   ├── cluster.go   # Cluster management
│   │   ├── handlers.go  # Message handlers
│   │   └── ...          # Server implementation files
│   └── logger/          # Custom logger
├── docs/                 # Documentation
└── Makefile             # Build automation

Documentation

License

BSD-3-Clause (same as original corosync-qdevice)

References

About

Lightweight Go reimplementation of Corosync qnetd—portable, dependency-light, and runs on x86 & ARM for modern HA clusters.

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors