Skip to content

dantte-lp/gobfd

GoBFD
Production-grade BFD protocol daemon for Go

CI Go Report Card Go 1.26 RFC 5880 RFC 5881 License
Security Codecov Quality Gate OpenSSF Scorecard


GoBFD is a production-grade Bidirectional Forwarding Detection (BFD) protocol daemon written in Go 1.26. It detects forwarding path failures between adjacent systems in milliseconds, enabling fast convergence for BGP, OSPF, and other routing protocols.

Four binaries: gobfd (daemon), gobfdctl (CLI), gobfd-haproxy-agent (HAProxy bridge), gobfd-exabgp-bridge (ExaBGP bridge).

Quick Start

# Build
git clone https://github.com/dantte-lp/gobfd.git && cd gobfd
make build

# Run tests
make test

# Start production stack (gobfd + Prometheus + Grafana)
podman-compose -f deployments/compose/compose.yml up -d

Requires Linux with CAP_NET_RAW and CAP_NET_ADMIN capabilities. See Deployment.

Architecture

graph TB
    subgraph "gobfd daemon"
        SRV["ConnectRPC<br/>:50051"]
        BFD["BFD Core<br/>FSM + Sessions"]
        NET["Raw Sockets<br/>UDP 3784/4784"]
        BGP["GoBGP Client"]
        MET["Prometheus<br/>:9100"]
    end

    CLI["gobfdctl<br/>CLI"] --> SRV
    HAP["gobfd-haproxy-agent"] --> SRV
    EXA["gobfd-exabgp-bridge"] --> SRV
    SRV --> BFD
    NET --> BFD
    BGP --> GOBGP["GoBGP :50052"]
    NET --> PEER["BFD Peers"]

    style BFD fill:#1a73e8,color:#fff
Loading

Documentation

Full documentation is available in docs/:

# Document Description
01 Architecture System architecture, package diagram, packet flow
02 BFD Protocol FSM, timers, jitter, packet format, authentication
03 Configuration YAML config, env vars, GoBGP integration, hot reload
04 CLI Reference gobfdctl commands, interactive shell
05 Interop Testing 4-peer testing: FRR, BIRD3, aiobfd, Thoro
06 Deployment systemd, Podman Compose, packages, production
07 Monitoring Prometheus metrics, Grafana dashboard, alerting
08 RFC Compliance RFC compliance matrix, implementation notes
09 Development Dev workflow, make targets, testing, linting
10 Changelog Guide How to maintain CHANGELOG.md, semantic versioning
11 Integrations BGP failover, HAProxy, observability, ExaBGP, Kubernetes

Documentation is also available in Russian at docs/ru/.

RFC Source Files

Full RFC texts are available in docs/rfc/: RFC 5880 | RFC 5881 | RFC 5882 | RFC 5883 | RFC 5884 | RFC 5885 | RFC 7130

RFC Compliance

RFC Title Status
RFC 5880 BFD Base Protocol Implemented
RFC 5881 BFD for IPv4/IPv6 Single-Hop Implemented
RFC 5882 Generic Application of BFD Implemented
RFC 5883 BFD for Multihop Paths Implemented
RFC 5884 BFD for MPLS LSPs Stub
RFC 5885 BFD for PW VCCV Stub
RFC 7130 Micro-BFD for LAG Stub

Details: RFC Compliance

Key Features

  • Table-driven FSM matching RFC 5880 Section 6.8.6 (no if-else chains)
  • Five authentication modes (Simple Password, Keyed MD5/SHA1, Meticulous MD5/SHA1)
  • BFD flap dampening for BGP integration (RFC 5882 Section 3.2)
  • Zero-allocation packet codec with pre-built cached packets
  • ConnectRPC/gRPC API + CLI with interactive shell
  • Prometheus metrics + Grafana dashboard
  • systemd integration (Type=notify, watchdog, SIGHUP hot reload)
  • 4-peer interop testing (FRR, BIRD3, aiobfd, Thoro/bfd) + 5 integration examples
  • Go 1.26 flight recorder for post-mortem debugging

Contributing

See Development for the full workflow.

make up && make all    # Build + test + lint
make interop           # Interoperability tests

License

Apache License 2.0

About

Production-grade BFD (Bidirectional Forwarding Detection) protocol daemon. RFC 5880/5881/5882/5883 compliant. Go 1.26.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors