Refactor - now wireguard based. (#7)
This commit is contained in:
18
hub/app.go
18
hub/app.go
@@ -2,6 +2,7 @@ package hub
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"encoding/base64"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
@@ -47,6 +48,19 @@ func NewApp(conf Config) (*App, error) {
|
||||
return app, nil
|
||||
}
|
||||
|
||||
var templateFuncs = template.FuncMap{
|
||||
"ipToString": ipBytesTostring,
|
||||
func (app *App) Handler() http.Handler {
|
||||
cop := http.NewCrossOriginProtection()
|
||||
return cop.Handler(app.mux)
|
||||
}
|
||||
|
||||
var templateFuncs = template.FuncMap{
|
||||
"ipToString": ipBytesTostring,
|
||||
"wgKeyString": wgKeyString,
|
||||
}
|
||||
|
||||
func wgKeyString(key []byte) string {
|
||||
if len(key) == 0 {
|
||||
return "not set"
|
||||
}
|
||||
return base64.StdEncoding.EncodeToString(key)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user