aboutsummaryrefslogtreecommitdiffstats
path: root/api/handlers/index.go
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2025-02-06 15:22:34 +0000
committerLeonardo Bishop <me@leonardobishop.com>2025-02-06 15:22:34 +0000
commit2475f5a8b92ef0dd28e7af5f36d01b25243ed778 (patch)
tree12f8931d241db4159f8d30f7bf2b648709a94166 /api/handlers/index.go
Initial commit
Diffstat (limited to 'api/handlers/index.go')
-rw-r--r--api/handlers/index.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/api/handlers/index.go b/api/handlers/index.go
new file mode 100644
index 0000000..c165f3b
--- /dev/null
+++ b/api/handlers/index.go
@@ -0,0 +1,22 @@
+package handlers
+
+import (
+ "net/http"
+
+ "github.com/LMBishop/gunnel/pkg/config"
+ "github.com/LMBishop/gunnel/web"
+)
+
+func Index(configService config.Service) func(http.ResponseWriter, *http.Request) {
+ return func(w http.ResponseWriter, r *http.Request) {
+ web.Index().Execute(w, struct {
+ Host string
+ ExpireAfter int
+ Iface string
+ }{
+ Host: configService.Config().Hostname,
+ ExpireAfter: configService.Config().ExpireAfter,
+ Iface: configService.Config().WireGuard.InterfaceName,
+ })
+ }
+}