コード例 #1
0
ファイル: main.go プロジェクト: uabassguy/loggregator
func makeOutgoingProxy(ipAddress string, config *Config, logger *gosteno.Logger) *trafficcontroller.Proxy {
	authorizer := authorization.NewLogAccessAuthorizer(config.ApiHost, config.SkipCertVerify)

	logger.Debugf("Output Proxy Startup: Number of zones: %v", len(config.Loggregators))
	hashers := makeHashers(config.Loggregators, config.OutgoingPort, logger)

	logger.Debugf("Output Proxy Startup: Number of hashers for the proxy: %v", len(hashers))
	proxy := trafficcontroller.NewProxy(net.JoinHostPort(ipAddress, strconv.FormatUint(uint64(config.OutgoingPort), 10)), hashers, authorizer, logger)
	return proxy
}
コード例 #2
0
func makeOutgoingProxy(config *Config, logger *gosteno.Logger) *trafficcontroller.Proxy {
	authorizer := authorization.NewLogAccessAuthorizer(config.ApiHost, config.SkipCertVerify)

	logger.Debugf("Output Proxy Startup: Number of zones: %v", len(config.Loggregators))
	hashers := makeHashers(config.Loggregators, config.LoggregatorOutgoingPort, logger)

	logger.Debugf("Output Proxy Startup: Number of hashers for the proxy: %v", len(hashers))
	proxy := trafficcontroller.NewProxy(hashers, authorizer, logger)
	return proxy
}
コード例 #3
0
		fwsh = &fakeWebsocketHandler{}
		fl = &fakeListener{messageChan: make(chan []byte)}

		trafficcontroller.NewWebsocketHandlerProvider = func(messageChan <-chan []byte) http.Handler {
			outputMessages = messageChan
			return fwsh
		}

		trafficcontroller.NewWebsocketListener = func() listener.Listener {
			return fl
		}

		hashers = []hasher.Hasher{hasher.NewHasher([]string{"localhost:62038"})}
		proxy := trafficcontroller.NewProxy(
			hashers,
			testhelpers.SuccessfulAuthorizer,
			loggertesthelper.Logger(),
		)

		ts = httptest.NewServer(proxy)
		Eventually(serverUp(ts)).Should(BeTrue())
	})

	AfterEach(func() {
		ts.Close()
		trafficcontroller.NewWebsocketHandlerProvider = existingWsProvider
	})

	Context("Auth Params", func() {
		It("Should Authenticate with Auth Query Params", func() {
			websocketClientWithQueryParamAuth(ts, "/?app=myApp", testhelpers.VALID_AUTHENTICATION_TOKEN)