本文整理汇总了Golang中doppler/config.Config.EnableTLSTransport方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.EnableTLSTransport方法的具体用法?Golang Config.EnableTLSTransport怎么用?Golang Config.EnableTLSTransport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类doppler/config.Config
的用法示例。
在下文中一共展示了Config.EnableTLSTransport方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
})
It("Panics if MaintainNode returns error", func() {
err := errors.New("some etcd time out error")
fakeadapter := &fakes.FakeStoreAdapter{}
fakeadapter.MaintainNodeReturns(nil, nil, err)
Expect(func() {
dopplerservice.Announce(localIP, time.Second, &conf, fakeadapter, loggertesthelper.Logger())
}).To(Panic())
})
Context("when tls transport is enabled", func() {
It("announces udp, tcp, and tls values", func() {
dopplerMeta := fmt.Sprintf(`{"version": 1, "endpoints":["udp://%[1]s:1234", "tcp://%[1]s:5678", "ws://%[1]s:8888", "tls://%[1]s:9012"]}`, localIP)
conf.EnableTLSTransport = true
conf.TLSListenerConfig = config.TLSListenerConfig{
Port: 9012,
}
stopChan = dopplerservice.Announce(localIP, time.Second, &conf, etcdAdapter, loggertesthelper.Logger())
Eventually(func() []byte {
node, err := etcdAdapter.Get(dopplerKey)
if err != nil {
return nil
}
return node.Value
}).Should(MatchJSON(dopplerMeta))
})
})
示例2:
metronRunner.Protocols = protocols
metronRunner.Start()
})
AfterEach(func() {
close(stopTheWorld)
close(stopAnnounce)
metronRunner.Stop()
})
Describe("Metron panics", func() {
Context("with Metron configured to requires TLS, and TLS disabled on Doppler", func() {
BeforeEach(func() {
protocols = []config.Protocol{"tls"}
dopplerConfig.EnableTLSTransport = false
})
Context("with Doppler advertising only on legacy endpoint", func() {
It("panics", func() {
stopAnnounce = dopplerservice.AnnounceLegacy("127.0.0.1", time.Minute, dopplerConfig, etcdAdapter, logger)
Eventually(metronRunner.Process.Wait()).Should(Receive())
})
})
Context("with Doppler advertising UDP on meta endpoint", func() {
It("panics", func() {
stopAnnounce = dopplerservice.Announce("127.0.0.1", time.Minute, dopplerConfig, etcdAdapter, logger)
Eventually(metronRunner.Process.Wait()).Should(Receive())
})
})