// initIPVS initialises the IPVS sub-component. func initIPVS() { ipvsMutex.Lock() defer ipvsMutex.Unlock() log.Infof("Initialising IPVS...") if err := ipvs.Init(); err != nil { // TODO(jsing): modprobe ip_vs and try again. log.Fatalf("IPVS initialisation failed: %v", err) } log.Infof("IPVS version %s", ipvs.Version()) }
func main() { if err := ipvs.Init(); err != nil { log.Fatalf("IPVS initialisation failed: %v\n", err) } log.Printf("IPVS version %s\n", ipvs.Version()) testIPVS() testIPVSModification() // Clean up after ourselves... if err := ipvs.Flush(); err != nil { log.Fatalf("Failed to flush IPVS table: %v\n", err) } }