Example #1
0
// creates a skipper.SettingsSource instance.
// expects an instance of the etcd client, a filter registry and a settings dispatcher.
func MakeSource(
	dc skipper.DataClient,
	mwr skipper.FilterRegistry,
	sd skipper.SettingsDispatcher) skipper.SettingsSource {

	// create initial empty settings:
	sd.Push() <- &settings{route.New()}

	s := &source{sd}
	go func() {
		for {
			data := <-dc.Receive()

			ss, err := processRaw(data, mwr)
			if err != nil {
				log.Println(err)
				continue
			}

			s.dispatcher.Push() <- ss
		}
	}()

	return s
}
Example #2
0
func MakeSettings(u string, filters []skipper.Filter, shunt bool) *Settings {
	up, _ := url.Parse(u)
	rt := route.New()
	b := &Backend{up.Scheme, up.Host, shunt}
	r := &Route{b, filters}
	rt.AddRoute("Path(\"/hello/<v>\")", r)
	return &Settings{rt}
}
Example #3
0
func NewExpRouter() *ExpRouter {
	return &ExpRouter{
		r: route.New(),
	}
}