diff options
| -rw-r--r-- | Earthfile | 10 | ||||
| -rw-r--r-- | cmd/uncle-ted/bomb.txt.gz.gz | bin | 0 -> 84876 bytes | |||
| -rw-r--r-- | cmd/uncle-ted/main.go | 38 |
3 files changed, 48 insertions, 0 deletions
@@ -170,6 +170,16 @@ todayinmarch2020: SAVE IMAGE --push ghcr.io/xe/x/todayinmarch2020:latest +uncle-ted: + FROM +runtime + + COPY +everything/bin/uncle-ted /app/bin/uncle-ted + CMD ["/app/bin/uncle-ted"] + + LABEL org.opencontainers.image.source="https://github.com/Xe/x" + + SAVE IMAGE --push ghcr.io/xe/x/uncle-ted:latest + within-website: FROM +runtime diff --git a/cmd/uncle-ted/bomb.txt.gz.gz b/cmd/uncle-ted/bomb.txt.gz.gz Binary files differnew file mode 100644 index 0000000..7dacf06 --- /dev/null +++ b/cmd/uncle-ted/bomb.txt.gz.gz diff --git a/cmd/uncle-ted/main.go b/cmd/uncle-ted/main.go new file mode 100644 index 0000000..c3865ce --- /dev/null +++ b/cmd/uncle-ted/main.go @@ -0,0 +1,38 @@ +package main + +import ( + _ "embed" + "flag" + "fmt" + "log" + "log/slog" + "net/http" + + "within.website/x/internal" +) + +var ( + bind = flag.String("bind", ":2836", "TCP port to bind on") + + //go:embed bomb.txt.gz.gz + kaboom []byte +) + +func main() { + internal.HandleStartup() + + http.HandleFunc("/", defenseHandler) + + slog.Info("started up", "url", "http://localhost"+*bind) + log.Fatal(http.ListenAndServe(*bind, nil)) +} + +func defenseHandler(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Type", "text/plain") + w.Header().Set("Content-Encoding", "gzip") + w.Header().Set("Transfer-Encoding", "gzip") + w.Header().Set("Content-Length", fmt.Sprint(len(kaboom))) + + w.WriteHeader(http.StatusOK) + w.Write(kaboom) +} |
