本文整理汇总了Golang中github.com/wallyworld/core/juju/osenv.ProxySettings类的典型用法代码示例。如果您正苦于以下问题:Golang ProxySettings类的具体用法?Golang ProxySettings怎么用?Golang ProxySettings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProxySettings类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestSetEnvironmentValues
func (s *proxySuite) TestSetEnvironmentValues(c *gc.C) {
s.PatchEnvironment("http_proxy", "initial")
s.PatchEnvironment("HTTP_PROXY", "initial")
s.PatchEnvironment("https_proxy", "initial")
s.PatchEnvironment("HTTPS_PROXY", "initial")
s.PatchEnvironment("ftp_proxy", "initial")
s.PatchEnvironment("FTP_PROXY", "initial")
s.PatchEnvironment("no_proxy", "initial")
s.PatchEnvironment("NO_PROXY", "initial")
proxy := osenv.ProxySettings{
Http: "http proxy",
Https: "https proxy",
// Ftp left blank to show clearing env.
NoProxy: "10.0.3.1,localhost",
}
proxy.SetEnvironmentValues()
obtained := osenv.DetectProxies()
c.Assert(obtained, gc.DeepEquals, proxy)
c.Assert(os.Getenv("http_proxy"), gc.Equals, "http proxy")
c.Assert(os.Getenv("HTTP_PROXY"), gc.Equals, "http proxy")
c.Assert(os.Getenv("https_proxy"), gc.Equals, "https proxy")
c.Assert(os.Getenv("HTTPS_PROXY"), gc.Equals, "https proxy")
c.Assert(os.Getenv("ftp_proxy"), gc.Equals, "")
c.Assert(os.Getenv("FTP_PROXY"), gc.Equals, "")
c.Assert(os.Getenv("no_proxy"), gc.Equals, "10.0.3.1,localhost")
c.Assert(os.Getenv("NO_PROXY"), gc.Equals, "10.0.3.1,localhost")
}
开发者ID:jameinel,项目名称:core,代码行数:31,代码来源:proxy_test.go
示例2: TestAsScriptEnvironmentOneValue
func (s *proxySuite) TestAsScriptEnvironmentOneValue(c *gc.C) {
proxies := osenv.ProxySettings{
Http: "some-value",
}
expected := `
export http_proxy=some-value
export HTTP_PROXY=some-value`[1:]
c.Assert(proxies.AsScriptEnvironment(), gc.Equals, expected)
}
开发者ID:jameinel,项目名称:core,代码行数:9,代码来源:proxy_test.go
示例3: TestAsEnvironmentValuesOneValue
func (s *proxySuite) TestAsEnvironmentValuesOneValue(c *gc.C) {
proxies := osenv.ProxySettings{
Http: "some-value",
}
expected := []string{
"http_proxy=some-value",
"HTTP_PROXY=some-value",
}
c.Assert(proxies.AsEnvironmentValues(), gc.DeepEquals, expected)
}
开发者ID:jameinel,项目名称:core,代码行数:10,代码来源:proxy_test.go
示例4: TestProxyConfigMap
func (*ConfigSuite) TestProxyConfigMap(c *gc.C) {
defer makeFakeHome(c).Restore()
cfg := newTestConfig(c, testing.Attrs{})
proxy := osenv.ProxySettings{
Http: "http proxy",
Https: "https proxy",
Ftp: "ftp proxy",
NoProxy: "no proxy",
}
cfg, err := cfg.Apply(config.ProxyConfigMap(proxy))
c.Assert(err, gc.IsNil)
c.Assert(cfg.ProxySettings(), gc.DeepEquals, proxy)
// Apt proxy and proxy differ by the content of the no-proxy values.
proxy.NoProxy = ""
c.Assert(cfg.AptProxySettings(), gc.DeepEquals, proxy)
}
开发者ID:jameinel,项目名称:core,代码行数:17,代码来源:config_test.go
示例5: TestAsScriptEnvironmentAllValue
func (s *proxySuite) TestAsScriptEnvironmentAllValue(c *gc.C) {
proxies := osenv.ProxySettings{
Http: "some-value",
Https: "special",
Ftp: "who uses this?",
NoProxy: "10.0.3.1,localhost",
}
expected := `
export http_proxy=some-value
export HTTP_PROXY=some-value
export https_proxy=special
export HTTPS_PROXY=special
export ftp_proxy=who uses this?
export FTP_PROXY=who uses this?
export no_proxy=10.0.3.1,localhost
export NO_PROXY=10.0.3.1,localhost`[1:]
c.Assert(proxies.AsScriptEnvironment(), gc.Equals, expected)
}
开发者ID:jameinel,项目名称:core,代码行数:18,代码来源:proxy_test.go
示例6: TestAsEnvironmentValuesAllValue
func (s *proxySuite) TestAsEnvironmentValuesAllValue(c *gc.C) {
proxies := osenv.ProxySettings{
Http: "some-value",
Https: "special",
Ftp: "who uses this?",
NoProxy: "10.0.3.1,localhost",
}
expected := []string{
"http_proxy=some-value",
"HTTP_PROXY=some-value",
"https_proxy=special",
"HTTPS_PROXY=special",
"ftp_proxy=who uses this?",
"FTP_PROXY=who uses this?",
"no_proxy=10.0.3.1,localhost",
"NO_PROXY=10.0.3.1,localhost",
}
c.Assert(proxies.AsEnvironmentValues(), gc.DeepEquals, expected)
}
开发者ID:jameinel,项目名称:core,代码行数:19,代码来源:proxy_test.go
示例7: TestAsEnvironmentValuesEmpty
func (s *proxySuite) TestAsEnvironmentValuesEmpty(c *gc.C) {
proxies := osenv.ProxySettings{}
c.Assert(proxies.AsEnvironmentValues(), gc.HasLen, 0)
}
开发者ID:jameinel,项目名称:core,代码行数:4,代码来源:proxy_test.go
示例8: TestAsScriptEnvironmentEmpty
func (s *proxySuite) TestAsScriptEnvironmentEmpty(c *gc.C) {
proxies := osenv.ProxySettings{}
c.Assert(proxies.AsScriptEnvironment(), gc.Equals, "")
}
开发者ID:jameinel,项目名称:core,代码行数:4,代码来源:proxy_test.go
注:本文中的github.com/wallyworld/core/juju/osenv.ProxySettings类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论