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() { if httpServerPort != 8080 { if verbose == true { log.Printf("%s Starting the http server", green("[i]")) } // setup the http server and start it httpServer := setupHTTPServer() log.Fatalln(httpServer.ListenAndServe()) if verbose == true { log.Printf("%s Done starting the http server", boldGreen("[+]")) } } else { return } } // handle requests to the /api/found endpoint func apiFoundHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") }