Example #1
0
// 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())
}
Example #2
0
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)
	}
}