|
|
@@ -1,11 +1,26 @@
|
|
|
package main
|
|
|
|
|
|
+// NativePlanet GroundSeg: Go Edition (goseg)
|
|
|
+// 🄯 2023 ~nallux-dozryl & ~sitful-hatred
|
|
|
+// This is a Golang rewrite of GroundSeg that serves the v2 json
|
|
|
+// object via websocket.
|
|
|
+// The v2 rewrite decouples the frontend and backend, which makes it
|
|
|
+// straightforward to implement alternative backends.
|
|
|
+//
|
|
|
+// Under development: reimplementing all pyseg functionality.
|
|
|
+// Advantages:
|
|
|
+// - Really, really fast
|
|
|
+// - Event-driven
|
|
|
+// - First-class support for concurrent operations
|
|
|
+// - Very good golang Docker libraries
|
|
|
+
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"goseg/config"
|
|
|
"goseg/docker"
|
|
|
"goseg/rectify"
|
|
|
+ "goseg/startram"
|
|
|
"goseg/structs"
|
|
|
"goseg/ws"
|
|
|
"io/ioutil"
|
|
|
@@ -13,25 +28,12 @@ import (
|
|
|
"net/http"
|
|
|
"os"
|
|
|
"path/filepath"
|
|
|
+ "strings"
|
|
|
// "time"
|
|
|
|
|
|
"github.com/gorilla/mux"
|
|
|
)
|
|
|
|
|
|
-// NativePlanet GroundSeg: Go Edition (goseg)
|
|
|
-// 🄯 2023 ~nallux-dozryl & ~sitful-hatred
|
|
|
-// This is a Golang rewrite of GroundSeg that serves the v2 json
|
|
|
-// object via websocket.
|
|
|
-// The v2 rewrite decouples the frontend and backend, which makes it
|
|
|
-// straightforward to implement alternative backends.
|
|
|
-//
|
|
|
-// Under development: reimplementing all pyseg functionality.
|
|
|
-// Advantages:
|
|
|
-// - Really, really fast
|
|
|
-// - Event-driven
|
|
|
-// - First-class support for concurrent operations
|
|
|
-// - Very good golang Docker libraries
|
|
|
-
|
|
|
var (
|
|
|
logger = slog.New(slog.NewJSONHandler(os.Stdout, nil))
|
|
|
DevMode = false
|
|
|
@@ -100,15 +102,17 @@ func main() {
|
|
|
// digest docker events from eventbus
|
|
|
go rectify.DockerSubscriptionHandler()
|
|
|
// just making sure we can parse (debug)
|
|
|
- var pierList string
|
|
|
- for _, pier := range conf.Piers {
|
|
|
- pierList = pierList + ", " + pier
|
|
|
+ if len(conf.Piers) > 0 {
|
|
|
+ pierList := strings.Join(conf.Piers, ", ")
|
|
|
+ logger.Info(fmt.Sprintf("Loaded piers: %s", pierList))
|
|
|
}
|
|
|
- logger.Info(pierList)
|
|
|
// block until returns
|
|
|
if remoteVersion == true {
|
|
|
<-versionUpdateChannel
|
|
|
}
|
|
|
+ if conf.WgRegistered == true {
|
|
|
+ startram.Retrieve()
|
|
|
+ }
|
|
|
// Load Netdata
|
|
|
loadService(docker.LoadNetdata, "Unable to load Netdata!")
|
|
|
// Load Wireguard
|