本文整理汇总了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
}