本文整理匯總了Golang中github.com/google/seesaw/ncc/client.NCC.NewLBInterface方法的典型用法代碼示例。如果您正苦於以下問題:Golang NCC.NewLBInterface方法的具體用法?Golang NCC.NewLBInterface怎麽用?Golang NCC.NewLBInterface使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/seesaw/ncc/client.NCC
的用法示例。
在下文中一共展示了NCC.NewLBInterface方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: lbInterface
func lbInterface(ncc client.NCC) client.LBInterface {
iface := *testIface
nodeIP := net.ParseIP(*nodeIPStr)
nodeIPv6 := net.ParseIP(*nodeIPv6Str)
if nodeIP == nil && nodeIPv6 == nil {
log.Fatalf("Invalid node IP/IPv6 - %q/%q", *nodeIPStr, *nodeIPv6Str)
}
unicastVIP := net.ParseIP(*unicastVIPStr)
if unicastVIP == nil {
log.Fatalf("Invalid unicast VIP - %q", *unicastVIPStr)
}
vip := net.ParseIP(*clusterVIPStr)
if vip == nil {
log.Fatalf("Invalid cluster VIP - %q", *clusterVIPStr)
}
if *vrID < 1 || *vrID > 255 {
log.Fatalf("Invalid VRID - %q", *vrID)
}
rtID := uint8(*routingTableID)
// TODO(jsing): Change this to allow both IPv4 and IPv6 addresses.
lbCfg := &types.LBConfig{
ClusterVIP: seesaw.Host{IPv4Addr: vip},
Node: seesaw.Host{IPv4Addr: nodeIP, IPv6Addr: nodeIPv6},
DummyInterface: "dummy0",
NodeInterface: "eth0",
RoutingTableID: rtID,
VRID: uint8(*vrID),
}
lb := ncc.NewLBInterface(iface, lbCfg)
if err := lb.Init(); err != nil {
log.Fatalf("Failed to initialise the LB interface: %v", err)
}
return lb
}