aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Earthfile4
-rw-r--r--cmd/reverseproxyd/main.go38
-rw-r--r--go.mod2
3 files changed, 43 insertions, 1 deletions
diff --git a/Earthfile b/Earthfile
index 1496226..76992a7 100644
--- a/Earthfile
+++ b/Earthfile
@@ -150,6 +150,9 @@ relayd:
SAVE IMAGE --push ghcr.io/xe/x/relayd:latest
+reverseproxyd:
+ BUILD +ship --PROGRAM=reverseproxyd --GOARCH=amd64
+
sapientwindex:
FROM +runtime
@@ -279,6 +282,7 @@ all:
BUILD --pass-args --platform=linux/amd64 +mi
BUILD --pass-args --platform=linux/amd64 +mimi
BUILD --pass-args --platform=linux/amd64 +relayd
+ BUILD --pass-args --platform=linux/amd64 +reverseproxyd
BUILD --pass-args --platform=linux/amd64 +sapientwindex
BUILD --pass-args --platform=linux/amd64 +stealthmountain
BUILD --pass-args --platform=linux/amd64 +stickers
diff --git a/cmd/reverseproxyd/main.go b/cmd/reverseproxyd/main.go
new file mode 100644
index 0000000..964ef38
--- /dev/null
+++ b/cmd/reverseproxyd/main.go
@@ -0,0 +1,38 @@
+package main
+
+import (
+ "flag"
+ "log"
+ "log/slog"
+ "net/http"
+ "net/http/httputil"
+ "net/url"
+
+ "within.website/x/internal"
+)
+
+var (
+ bind = flag.String("bind", ":3004", "port to listen on")
+ proxyTo = flag.String("proxy-to", "http://localhost:5000", "where to reverse proxy to")
+)
+
+func main() {
+ internal.HandleStartup()
+
+ slog.Info("starting",
+ "bind", *bind,
+ "proxy-to", *proxyTo,
+ )
+
+ u, err := url.Parse(*proxyTo)
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ log.Fatal(
+ http.ListenAndServe(
+ *bind,
+ httputil.NewSingleHostReverseProxy(u),
+ ),
+ )
+}
diff --git a/go.mod b/go.mod
index 024f20d..b2b6d55 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module within.website/x
-go 1.24
+go 1.24.2
require (
al.essio.dev/pkg/shellescape v1.6.0