本文整理匯總了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)
}
示例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())
}
}
示例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)
}
}
示例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())
}
}
示例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())
}
}
示例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)
}
}