diff options
| author | Xe Iaso <me@xeiaso.net> | 2023-12-14 11:47:13 -0500 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2023-12-14 11:47:18 -0500 |
| commit | e48204a5e494640a597d38bf0c23cc7e230bceb5 (patch) | |
| tree | cdcd573e5d2647762015d9e369d81780174cfab3 /cmd/xedn/main.go | |
| parent | b5eda2067dcfc71bc48b4859993683baf81f8c21 (diff) | |
| download | x-e48204a5e494640a597d38bf0c23cc7e230bceb5.tar.xz x-e48204a5e494640a597d38bf0c23cc7e230bceb5.zip | |
cmd/xedn: add cdn-cgi/wtf/json
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd/xedn/main.go')
| -rw-r--r-- | cmd/xedn/main.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/xedn/main.go b/cmd/xedn/main.go index 5e7e2cd..8eabddb 100644 --- a/cmd/xedn/main.go +++ b/cmd/xedn/main.go @@ -205,6 +205,21 @@ func main() { fmt.Fprintln(w) }) + cdn.HandleFunc("/cgi-cdn/wtf/json", func(w http.ResponseWriter, r *http.Request) { + enc := json.NewEncoder(w) + enc.SetIndent("", " ") + + enc.Encode(map[string]any{ + "headers": r.Header, + "your_ip": r.Header.Get("Fly-Client-Ip"), + "xedn": map[string]any{ + "region": os.Getenv("FLY_REGION"), + "instance": os.Getenv("FLY_ALLOC_ID"), + "binary": os.Args[0], + }, + }) + }) + hdlr := func(w http.ResponseWriter, r *http.Request) { etagLock.RLock() etag, ok := etags[r.URL.Path] |
