| Tim Windelschmidt | 6d33a43 | 2025-02-04 14:34:25 +0100 | [diff] [blame^] | 1 | // Copyright The Monogon Project Authors. |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| Lorenz Brun | 276a746 | 2023-07-12 21:28:54 +0200 | [diff] [blame] | 4 | // httpserver serves a test HTTP endpoint for E2E testing. |
| 5 | package main |
| 6 | |
| 7 | import ( |
| 8 | "net/http" |
| 9 | "os" |
| 10 | ) |
| 11 | |
| 12 | func main() { |
| 13 | nodeName := os.Getenv("NODE_NAME") |
| 14 | http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 15 | w.Header().Set("X-Node-Name", nodeName) |
| 16 | w.Header().Set("X-Remote-IP", r.RemoteAddr) |
| 17 | w.WriteHeader(http.StatusOK) |
| 18 | // Send a big chunk to root out MTU/MSS issues. |
| 19 | testPayload := make([]byte, 2000) |
| 20 | w.Write(testPayload) |
| 21 | })) |
| 22 | } |