{"id":21250808,"url":"https://github.com/mqliang/libipvs","last_synced_at":"2026-04-09T14:04:03.230Z","repository":{"id":57484516,"uuid":"76613058","full_name":"mqliang/libipvs","owner":"mqliang","description":"Pure Go lib to work with IPVS using generic netlink socket","archived":false,"fork":false,"pushed_at":"2023-01-09T03:52:26.000Z","size":43,"stargazers_count":46,"open_issues_count":1,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-05T19:04:26.962Z","etag":null,"topics":["golang","ipvs","netlink"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mqliang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-16T02:12:56.000Z","updated_at":"2024-10-10T13:59:56.000Z","dependencies_parsed_at":"2023-02-08T08:46:28.050Z","dependency_job_id":null,"html_url":"https://github.com/mqliang/libipvs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mqliang/libipvs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mqliang%2Flibipvs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mqliang%2Flibipvs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mqliang%2Flibipvs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mqliang%2Flibipvs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mqliang","download_url":"https://codeload.github.com/mqliang/libipvs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mqliang%2Flibipvs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264705084,"owners_count":23652153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","ipvs","netlink"],"created_at":"2024-11-21T03:39:03.043Z","updated_at":"2026-04-09T14:04:03.177Z","avatar_url":"https://github.com/mqliang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libipvs: Pure Go lib to work with IPVS\n\nThis project provides a pure Go client to communicate with IPVS kernel module using generic netlink socket. Netlink socket are used to communicate with various kernel subsystems as an RPC system.\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/mqliang/libipvs)](https://goreportcard.com/report/github.com/mqliang/libipvs)\n[![Documentation](https://godoc.org/github.com/mqliang/libipvs?status.svg)](https://godoc.org/github.com/mqliang/libipvs)\n\n## Requirements\n* Linux platform\n\n## API\n```Golang\ntype IPVSHandle interface {\n\tFlush() error\n\tGetInfo() (info Info, err error)\n\tListServices() (services []*Service, err error)\n\tNewService(s *Service) error\n\tUpdateService(s *Service) error\n\tDelService(s *Service) error\n\tListDestinations(s *Service) (dsts []*Destination, err error)\n\tNewDestination(s *Service, d *Destination) error\n\tUpdateDestination(s *Service, d *Destination) error\n\tDelDestination(s *Service, d *Destination) error\n}\n```\n\n## TODO\n* IPVS state synchronization: support configuring the in-kernel IPVS sync daemon for supporting failover\n  between IPVS routers, as done with keepalived `lvs_sync_daemon_interface`\n\n## Acknowledgments\n* The code is first “borrowed” from https://github.com/qmsk/clusterf, so all kudos goes @SpComb. I moved the code out into this dedicated project, with a better API, proper tests and concurrency safety, so everyone would benefit from having a good and well-tested package.\n\n## Alternatives\nOther pure go implementation of IPVS that maybe useful:\n* https://github.com/tehnerd/gnl2go\n* https://github.com/moby/ipvs\n\n## Example code\n\n```Golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net\"\n\t\"syscall\"\n\n\t\"github.com/mqliang/libipvs\"\n)\n\nfunc main() {\n\th, err := libipvs.New()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif err := h.Flush(); err != nil {\n\t\tpanic(err)\n\t}\n\n\tinfo, err := h.GetInfo()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"%#v\\n\", info)\n\n\tsvcs, err := h.ListServices()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"%#v\\n\", svcs)\n\n\tsvc := libipvs.Service{\n\t\tAddress:       net.ParseIP(\"172.192.168.1\"),\n\t\tAddressFamily: syscall.AF_INET,\n\t\tProtocol:      libipvs.Protocol(syscall.IPPROTO_TCP),\n\t\tPort:          80,\n\t\tSchedName:     libipvs.RoundRobin,\n\t}\n\n\tif err := h.NewService(\u0026svc); err != nil {\n\t\tpanic(err)\n\t}\n\n\tsvcs, err = h.ListServices()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"%#v\\n\", svcs)\n\n\tdst := libipvs.Destination{\n\t\tAddress:       net.ParseIP(\"172.192.100.1\"),\n\t\tAddressFamily: syscall.AF_INET,\n\t\tPort:          80,\n\t}\n\n\tif err := h.NewDestination(\u0026svc, \u0026dst); err != nil {\n\t\tpanic(err)\n\t}\n\n\tdsts, err := h.ListDestinations(\u0026svc)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"%#v\\n\", dsts)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmqliang%2Flibipvs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmqliang%2Flibipvs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmqliang%2Flibipvs/lists"}