golang-lvs icon indicating copy to clipboard operation
golang-lvs copied to clipboard

Add requirements or a check

Open a-nldisr opened this issue 4 years ago • 0 comments

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.

a-nldisr avatar Jan 22 '21 20:01 a-nldisr