Skip to content

Instantly share code, notes, and snippets.

@tehnerd
Created December 14, 2016 16:09
Show Gist options
  • Save tehnerd/039d60523228606ad9d9c975522f0dbe to your computer and use it in GitHub Desktop.
Save tehnerd/039d60523228606ad9d9c975522f0dbe to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"gnl2go/gnl2go"
)
func main() {
fmt.Println("Get pool example")
ipvs := new(gnl2go.IpvsClient)
ipvs.Init()
defer ipvs.Exit()
pool, err := ipvs.GetPools()
if err != nil {
fmt.Printf("error in getPools()\n")
return
}
for _, v := range pool {
fmt.Printf("%#v\n", v)
}
return
}
output:
Get pool example
gnl2go.Pool{Service:gnl2go.Service{Proto:0x6, VIP:"192.168.1.1", Port:0x51, Sched:"wlc", FWMark:0x0, AF:0x2}, Dests:[]gnl2go.Dest{gnl2go.Dest{IP:"10.0.1.6", Weight:1, Port:0x51, AF:0x2}, gnl2go.Dest{IP:"10.0.1.5", Weight:1, Port:0x51, AF:0x2}, gnl2go.Dest{IP:"10.0.1.4", Weight:1, Port:0x51, AF:0x2}, gnl2go.Dest{IP:"10.0.1.3", Weight:1, Port:0x51, AF:0x2}, gnl2go.Dest{IP:"10.0.1.2", Weight:1, Port:0x51, AF:0x2}, gnl2go.Dest{IP:"10.0.1.1", Weight:1, Port:0x51, AF:0x2}}}
gnl2go.Pool{Service:gnl2go.Service{Proto:0x6, VIP:"192.168.1.1", Port:0x50, Sched:"wlc", FWMark:0x0, AF:0x2}, Dests:[]gnl2go.Dest{gnl2go.Dest{IP:"10.0.0.6", Weight:1, Port:0x50, AF:0x2}, gnl2go.Dest{IP:"10.0.0.5", Weight:1, Port:0x50, AF:0x2}, gnl2go.Dest{IP:"10.0.0.4", Weight:1, Port:0x50, AF:0x2}, gnl2go.Dest{IP:"10.0.0.3", Weight:1, Port:0x50, AF:0x2}, gnl2go.Dest{IP:"10.0.0.2", Weight:1, Port:0x50, AF:0x2}, gnl2go.Dest{IP:"10.0.0.1", Weight:1, Port:0x50, AF:0x2}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment