golang-lvs
golang-lvs copied to clipboard
Add requirements or a check
Hi, Have been playing with this package to see if i can build a layer 4 load balancer with this.
This package assumes that ipvsadm is installed on the machine + there are enough privileges to get values returned. I could be wrong, but errors from lvs.Ipvs.Services
are not returned when ipvsadm is missing on the host, this makes debugging a bit harder.
Example code:
package main
import (
"fmt"
lvs "github.com/nanobox-io/golang-lvs"
)
var listIpvs lvs.Ipvs
func main() {
listIpvs.Save()
output := listIpvs.Services
fmt.Println(output)
}
Returns []
when either privileges are not there or ipvsadm is not installed.
Perhaps it is an idea to add requirements in the README or perhaps check in the code if ipvsadm / privileges are there.