Ejemplo n.º 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(),
	})
}
Ejemplo n.º 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())
}
Ejemplo n.º 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(),
	})
}
Ejemplo n.º 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}
}
Ejemplo n.º 5
0
func newProxy(id int) (proxy.Proxy, error) {
	return proxy.New(id, stapler.New(), proxy.Options{})
}