aboutsummaryrefslogtreecommitdiffstats
path: root/api/handlers/index.go
diff options
context:
space:
mode:
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,
+ })
+ }
+}