当前位置: 首页>>代码示例>>Golang>>正文


Golang Config.EnableTLSTransport方法代码示例

本文整理汇总了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))
				})
			})
开发者ID:kei-yamazaki,项目名称:loggregator,代码行数:30,代码来源:announcer_test.go

示例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())
				})
			})
开发者ID:yingkitw,项目名称:loggregator,代码行数:31,代码来源:protocol_test.go


注:本文中的doppler/config.Config.EnableTLSTransport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。