Пример #1
0
func main() {
	flag.Parse()
	if helpFlag {
		flag.Usage()
		os.Exit(0)
	}
	if len(upstreamUrl) == 0 {
		fmt.Println("Missing argument -upstream")
		flag.Usage()
		os.Exit(1)
	}
	if len(dataplaneUrl) == 0 {
		fmt.Println("Missing argument -dataplane")
		flag.Usage()
		os.Exit(1)
	}
	notifier := gbp.NewNotifier(upstreamUrl, listenSocket)
	if err := notifier.NotifyEndpointUp(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	g, err := gbp.NewServer(upstreamUrl, dataplaneUrl)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	gbp.Info.Printf("GBP Server listening on %s\n", listenSocket)
	http.ListenAndServe(listenSocket, g.Handler())
}
Пример #2
0
func main() {
	flag.Parse()
	if helpFlag {
		flag.Usage()
		os.Exit(0)
	}
	if len(upstreamUrl) == 0 {
		fmt.Println("Missing argument -upstream")
		flag.Usage()
		os.Exit(1)
	}
	notifier := gbp.NewNotifier(upstreamUrl, listenSocket)
	if err := notifier.NotifyEndpointUp(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	srv := gbp.NewServer(upstreamUrl)
	http.ListenAndServe(listenSocket, srv)
}