How cloudflare/ipvs works
Project type and purpose
• This is an open-source Go library (package “ipvs”) that provides programmatic access to Linux’s IPVS subsystem via netlink and genetlink.
• Its goal is to allow Go programs to manage IPVS services and destinations without requiring the ipvsadm CLI or CGO.
File structure
• Top-level files:
• client.go, client_linux.go, client_others.go, client_linux_test.go – the public client API and OS-specific implementations
• netmask/ – standalone subpackage for IP network mask operations
• internal/cipvs/ – core logic for interacting with IPVS over netlink/genetlink
• go.mod, go.sum – Go module definitions
• .github/workflows/ – CI pipelines (Go build, tests, semgrep linting)
• tools.go, zz_generated.stringer.go – code-generation and helper files
• testdata/ – rapid test fixtures
• Patterns:
• Layered modular design (public API, internal implementation, utility subpackage)
• OS abstraction (generic vs. Linux vs. others in separate source files)
• Encapsulation (core protocol code hidden under internal/cipvs)
README for additional insights
• Confirms use of mdlayher/netlink and mdlayher/genetlink to talk to the kernel
• Emphasizes library usage, e.g., “programmatic access to Linux’s IPVS,” no mention of GUI or CLI subcommands beyond tests and examples