Files
cloud-ip-validator/scripts/httpstub/main.go
T

23 lines
645 B
Go
Raw Normal View History

2026-08-21 07:34:45 +03:00
// Command httpstub is a trivial "always 200 OK" HTTP server used only by
// scripts/run-local-e2e.sh, standing in for the real internet targets
// (hub.docker.com, github.com, packages.ubuntu.com) so the offline
// end-to-end harness needs no real internet access.
package main
import (
"flag"
"log"
"net/http"
)
func main() {
addr := flag.String("addr", ":9090", "address to listen on")
flag.Parse()
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("stub ok\n"))
})
log.Printf("httpstub listening on %s", *addr)
log.Fatal(http.ListenAndServe(*addr, nil))
}