func main() {

	conf, err := utilities.Parsetoconf()
	if err != nil {
		panic(err.Error())
	}

	landscapeupdater := dcprotection.CreateLandscapeupdater(conf)
	detector = dcprotection.CreateODPdetector(landscapeupdater, conf)
	go detector.Run()
	wsContainer := restful.NewContainer()
	log.Printf("Registering")
	ws := new(restful.WebService)
	ws.Path("/odp").Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)
	ws.Route(ws.GET("/opinion").To(dcprotector_opinion).Consumes(restful.MIME_JSON)).Produces(restful.MIME_JSON)
	wsContainer.Add(ws)

	// Add container filter to enable CORS
	/*
		cors := restful.CrossOriginResourceSharing{
			ExposeHeaders:  []string{"X-My-Header"},
			AllowedHeaders: []string{"Content-Type"},
			CookiesAllowed: false,
			Container:      wsContainer}
		wsContainer.Filter(cors.Filter)

		// Add container filter to respond to OPTIONS
		wsContainer.Filter(wsContainer.OPTIONSFilter)
	*/

	log.Printf("start listening on localhost:%d\n", conf.Opconfig.Voteport)
	server := &http.Server{Addr: conf.Opconfig.Ovip + ":" + strconv.Itoa(conf.Opconfig.Voteport), Handler: wsContainer}
	log.Fatal(server.ListenAndServe())
}
func main() {

	conf, err := utilities.Parsetoconf()
	if err != nil {
		panic(err.Error())
	}
	wa = vmprotection.CreateWatchAgent(conf)
	wsContainer := restful.NewContainer()
	log.Printf("Registering")
	ws := new(restful.WebService)
	ws.Path("/ovp").Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)
	ws.Route(ws.GET("").To(orbit_describe))
	ws.Route(ws.POST("/join").To(orbit_join)).Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)
	ws.Route(ws.POST("/start").To(orbit_start)).Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)
	ws.Route(ws.POST("/stop").To(orbit_stop)).Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)
	ws.Route(ws.POST("/register").To(orbit_register)).Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)
	ws.Route(ws.POST("/update").To(orbit_update)).Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)
	ws.Route(ws.POST("/withdraw").To(orbit_withdraw)).Consumes(restful.MIME_JSON).Produces(restful.MIME_JSON)
	wsContainer.Add(ws)

	// Add container filter to enable CORS
	/*
		cors := restful.CrossOriginResourceSharing{
			ExposeHeaders:  []string{"X-My-Header"},
			AllowedHeaders: []string{"Content-Type"},
			CookiesAllowed: false,
			Container:      wsContainer}
		wsContainer.Filter(cors.Filter)

		// Add container filter to respond to OPTIONS
		wsContainer.Filter(wsContainer.OPTIONSFilter)
	*/

	log.Printf("start listening on localhost:%d\n", conf.Opconfig.Announceport)
	server := &http.Server{Addr: conf.Opconfig.Ovip + ":" + strconv.Itoa(conf.Opconfig.Announceport), Handler: wsContainer}
	log.Fatal(server.ListenAndServe())
}