Пример #1
0
func (s *Service) newProxy(id int) (proxy.Proxy, error) {
	return proxy.New(id, s.stapler, proxy.Options{
		MetricsClient:      s.metricsClient,
		DialTimeout:        s.options.EndpointDialTimeout,
		ReadTimeout:        s.options.ServerReadTimeout,
		WriteTimeout:       s.options.ServerWriteTimeout,
		MaxHeaderBytes:     s.options.ServerMaxHeaderBytes,
		DefaultListener:    constructDefaultListener(s.options),
		NotFoundMiddleware: s.registry.GetNotFoundMiddleware(),
	})
}
Пример #2
0
func (s *ApiSuite) SetUpTest(c *C) {
	newProxy := func(id int) (proxy.Proxy, error) {
		return proxy.New(id, stapler.New(), proxy.Options{})
	}

	s.ng = memng.New(registry.GetRegistry())

	sv := supervisor.New(newProxy, s.ng, make(chan error), supervisor.Options{})

	app := scroll.NewApp()
	InitProxyController(s.ng, sv, app)
	s.testServer = httptest.NewServer(app.GetHandler())
	s.client = NewClient(s.testServer.URL, registry.GetRegistry())
}
Пример #3
0
func (s *Service) newProxy(id int) (proxy.Proxy, error) {
	return proxy.New(id, s.stapler, proxy.Options{
		MetricsClient:  s.metricsClient,
		DialTimeout:    s.options.EndpointDialTimeout,
		ReadTimeout:    s.options.ServerReadTimeout,
		WriteTimeout:   s.options.ServerWriteTimeout,
		MaxHeaderBytes: s.options.ServerMaxHeaderBytes,
		DefaultListener: &engine.Listener{
			Id:       "DefaultListener",
			Protocol: "http",
			Address: engine.Address{
				Network: "tcp",
				Address: fmt.Sprintf("%s:%d", s.options.Interface, s.options.Port),
			},
		},
		NotFoundMiddleware: s.registry.GetNotFoundMiddleware(),
	})
}
Пример #4
0
func (s *CmdSuite) SetUpTest(c *C) {
	s.ng = memng.New(registry.GetRegistry())

	newProxy := func(id int) (proxy.Proxy, error) {
		return proxy.New(id, stapler.New(), proxy.Options{})
	}

	sv := supervisor.New(newProxy, s.ng, make(chan error), supervisor.Options{})
	sv.Start()
	s.sv = sv

	app := scroll.NewApp()
	api.InitProxyController(s.ng, sv, app)
	s.testServer = httptest.NewServer(app.GetHandler())

	s.out = &bytes.Buffer{}
	s.cmd = &Command{registry: registry.GetRegistry(), out: s.out, vulcanUrl: s.testServer.URL}
}
Пример #5
0
func newProxy(id int) (proxy.Proxy, error) {
	return proxy.New(id, stapler.New(), proxy.Options{})
}