package main import ( "fmt" "log" "net/http" "github.com/gorilla/mux" ) // setupHTTPServer sets up a http server func setupHTTPServer() http.Server { r := mux.NewRouter() r.HandleFunc("/", indexHandler) r.HandleFunc("/api/found", apiFoundHandler) return http.Server{ Addr: fmt.Sprintf("0.0.0.0:%d", httpServerPort), Handler: r, } } // indexHandler handles requests to the / endpoint func indexHandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "%s", "FUZZ!") } // httpStartServer starts the http server func httpStartServer() { log.Printf("%s Starting the http server", green("[i]")) // setup the http server and start it httpServer := setupHTTPServer() log.Fatalln(httpServer.ListenAndServe()) log.Printf("%s Done starting the http server", boldGreen("[+]")) } // handle requests to the /api/found endpoint func apiFoundHandler() { w.Header().Set("Content-Type", "application/json") }