本文整理汇总了Golang中github.com/juju/juju/network.GetPreferIPv6函数的典型用法代码示例。如果您正苦于以下问题:Golang GetPreferIPv6函数的具体用法?Golang GetPreferIPv6怎么用?Golang GetPreferIPv6使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPreferIPv6函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestInitializeFromConfig
func (*NetworkSuite) TestInitializeFromConfig(c *gc.C) {
c.Check(network.GetPreferIPv6(), jc.IsFalse)
envConfig := testing.CustomEnvironConfig(c, testing.Attrs{
"prefer-ipv6": true,
})
network.InitializeFromConfig(envConfig)
c.Check(network.GetPreferIPv6(), jc.IsTrue)
envConfig = testing.CustomEnvironConfig(c, testing.Attrs{
"prefer-ipv6": false,
})
network.InitializeFromConfig(envConfig)
c.Check(network.GetPreferIPv6(), jc.IsFalse)
}
开发者ID:kakamessi99,项目名称:juju,代码行数:15,代码来源:network_test.go
示例2: TestSelectInternalMachineAddress
func (s *AddressSuite) TestSelectInternalMachineAddress(c *gc.C) {
oldValue := network.GetPreferIPv6()
defer func() {
network.SetPreferIPv6(oldValue)
}()
for i, t := range selectInternalMachineTests {
c.Logf("test %d: %s", i, t.about)
network.SetPreferIPv6(t.preferIPv6)
c.Check(network.SelectInternalAddress(t.addresses, true), gc.Equals, t.expected())
}
}
开发者ID:kapilt,项目名称:juju,代码行数:11,代码来源:address_test.go
示例3: TestSelectInternalHostPorts
func (s *AddressSuite) TestSelectInternalHostPorts(c *gc.C) {
oldValue := network.GetPreferIPv6()
defer func() {
network.SetPreferIPv6(oldValue)
}()
for i, t := range selectInternalHostPortsTests {
c.Logf("test %d: %s", i, t.about)
network.SetPreferIPv6(t.preferIPv6)
c.Check(network.SelectInternalHostPorts(t.addresses, false), gc.DeepEquals, t.expected)
}
}
开发者ID:snailwalker,项目名称:juju,代码行数:11,代码来源:address_test.go
示例4: TestSelectInternalMachineHostPort
func (s *PortSuite) TestSelectInternalMachineHostPort(c *gc.C) {
oldValue := network.GetPreferIPv6()
defer func() {
network.SetPreferIPv6(oldValue)
}()
for i, t0 := range selectInternalMachineTests {
t := t0.hostPortTest()
c.Logf("test %d: %s", i, t.about)
network.SetPreferIPv6(t.preferIPv6)
c.Check(network.SelectInternalHostPort(t.hostPorts, true), gc.DeepEquals, t.expected())
}
}
开发者ID:kapilt,项目名称:juju,代码行数:12,代码来源:port_test.go
示例5: TestSelectPublicHostPort
func (*HostPortSuite) TestSelectPublicHostPort(c *gc.C) {
oldValue := network.GetPreferIPv6()
defer func() {
network.SetPreferIPv6(oldValue)
}()
for i, t0 := range selectPublicTests {
t := t0.hostPortTest()
c.Logf("test %d: %s", i, t.about)
network.SetPreferIPv6(t.preferIPv6)
c.Check(network.SelectPublicHostPort(t.hostPorts), jc.DeepEquals, t.expected())
}
}
开发者ID:Pankov404,项目名称:juju,代码行数:12,代码来源:hostport_test.go
示例6: TestSelectInternalAddress
func (s *AddressSuite) TestSelectInternalAddress(c *gc.C) {
oldValue := network.GetPreferIPv6()
defer func() {
network.SetPreferIPv6(oldValue)
}()
for i, t := range selectInternalTests {
c.Logf("test %d: %s", i, t.about)
network.SetPreferIPv6(t.preferIPv6)
expectAddr, expectOK := t.expected()
actualAddr, actualOK := network.SelectInternalAddress(t.addresses, false)
c.Check(actualOK, gc.Equals, expectOK)
c.Check(actualAddr, gc.Equals, expectAddr)
}
}
开发者ID:kakamessi99,项目名称:juju,代码行数:14,代码来源:address_test.go
注:本文中的github.com/juju/juju/network.GetPreferIPv6函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论