Some tests
authorJosué Rodríguez <jrpc@google.com>
Fri, 21 Jul 2023 23:10:31 +0000 (23:10 +0000)
committerJosué Rodríguez <jrpc@google.com>
Fri, 21 Jul 2023 23:10:31 +0000 (23:10 +0000)
12 files changed:
.vscode/settings.json [new file with mode: 0644]
exporter.sh [new file with mode: 0755]
getter.sh [new file with mode: 0755]
go.mod
go.sum
handlers/controller/controllerHandlers.go
handlers/health/healthHandlers.go
handlers/management/managementHandlers.go
handlers/static/staticHandlers.go
handlers/virtualapi/virtualapiHandlers.go
monospace.json [new file with mode: 0644]
vscpweb.go

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644 (file)
index 0000000..33eaebb
--- /dev/null
@@ -0,0 +1,4 @@
+{
+    "IDX.aI.enableCodebaseIndexing": true,
+    "IDX.corgiMode": true
+}
\ No newline at end of file
diff --git a/exporter.sh b/exporter.sh
new file mode 100755 (executable)
index 0000000..284cc77
--- /dev/null
@@ -0,0 +1,7 @@
+#/usr/bin/env bash
+#
+#
+#This is a bit of a setup to export the server
+export port=8000
+export API_SERVICE="${port}-${HOSTNAME}.cluster-lknrrkkitbcdsvoir6wqg4mwt6.cloudworkstations.dev"
+echo $API_SERVICE
diff --git a/getter.sh b/getter.sh
new file mode 100755 (executable)
index 0000000..b4ad031
--- /dev/null
+++ b/getter.sh
@@ -0,0 +1,6 @@
+#/usr/bin/env bash
+wget https://go.dev/dl/go1.20.6.linux-amd64.tar.gz
+rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.6.linux-amd64.tar.gz
+export PATH=$PATH:/usr/local/go/bin
+rm go1.20.6*
+go version
diff --git a/go.mod b/go.mod
index f12f975f7382e5ae7d1423f71b8e280f17890f86..3365cb2f44b80d2291bdf605c3fd7217e6082dfe 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -22,4 +22,12 @@ replace virtualAPIHandlers v0.0.0 => ./handlers/virtualapi/
 
 require staticHandlers v0.0.0
 
+require (
+       github.com/keegancsmith/rpc v1.1.0 // indirect
+       github.com/stamblerre/gocode v1.0.0 // indirect
+       golang.org/x/mod v0.12.0 // indirect
+       golang.org/x/sys v0.10.0 // indirect
+       golang.org/x/tools v0.11.0 // indirect
+)
+
 replace staticHandlers v0.0.0 => ./handlers/static/
diff --git a/go.sum b/go.sum
index 433d6716adb60c6f3a705309b6d8b87ac51a746c..ef2a5705e7b27f29f9fb2d794c0d4e81dc8c9f31 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,20 @@
 github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8=
 github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
+github.com/keegancsmith/rpc v1.1.0 h1:bXVRk3EzbtrEegTGKxNTc+St1lR7t/Z1PAO8misBnCc=
+github.com/keegancsmith/rpc v1.1.0/go.mod h1:Xow74TKX34OPPiPCdz6x1o9c0SCxRqGxDuKGk7ZOo8s=
+github.com/stamblerre/gocode v1.0.0 h1:5aTRgkRTOS8mELHoKatkwhfX44OdEV3iwu3FCXyvLzk=
+github.com/stamblerre/gocode v1.0.0/go.mod h1:ONyGamdxpnxaG2+XLyGkNuuoYISmz0QFVHScxvsXsqM=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
+golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
+golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/tools v0.0.0-20191030062658-86caa796c7ab h1:tpc/nJ4vD66vAk/2KN0sw/DvQIz2sKmCpWvyKtPmfMQ=
+golang.org/x/tools v0.0.0-20191030062658-86caa796c7ab/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8=
+golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
index f01514a7965ad88e82b93644e6a4293da2640021..04c0150f558eb0264afe9cc0fc276b2060e97fba 100644 (file)
@@ -13,6 +13,7 @@ import (
 // the special agent that each of them will already have installed in order to
 // connect to the cluster.
 func MasterHealthHandler(w http.ResponseWriter, r *http.Request) {
-            fmt.Fprintf("Ëverything should be okay my boi")
+        w.WriteHeader(http.StatusOK)
+       fmt.Fprintf(w, "Ëverything should be okay my boi")
 }
 
index 81d0525d54a08e05ae7f3b3159d406b6d6f535f1..3b2ec63f5ae45f6f6e4f11e39ab980c3fa5f77d6 100644 (file)
@@ -19,4 +19,5 @@ import (
 func MasterHealthHandler(w http.ResponseWriter, r *http.Request) {
        w.WriteHeader(http.StatusOK)
        fmt.Fprintf(w, "Ëverything should be okay my boi")
+       fmt.Println("health handler")
 }
index 869cf9e693825a5519936853d933b0a6529d6186..fc1a92a1af6e9d0b883ab74ee8861c940a04c9c0 100644 (file)
@@ -13,6 +13,7 @@ import (
 // the special agent that each of them will already have installed in order to
 // connect to the cluster.
 func MasterHealthHandler(w http.ResponseWriter, r *http.Request) {
-            fmt.Fprintf("Ëverything should be okay my boi")
+        w.WriteHeader(http.StatusOK)
+       fmt.Fprintf(w, "Ëverything should be okay my boi")
 }
 
index 7b182dbd38540dddad1016648e3489b91ad5f3de..51cd2b3b3bdc495f50690a2de6c9db98fd72f49a 100644 (file)
@@ -13,6 +13,7 @@ import (
 // the special agent that each of them will already have installed in order to
 // connect to the cluster.
 func MasterHealthHandler(w http.ResponseWriter, r *http.Request) {
-            fmt.Fprintf("Ëverything should be okay my boi")
+        w.WriteHeader(http.StatusOK)
+       fmt.Fprintf(w, "Ëverything should be okay my boi")
 }
 
index 264e910e6fe9c787833f2cd257b59ef3dbadc1d7..f5d73bedc1da3cafb9606eb75b10a0a1587e2b36 100644 (file)
@@ -13,6 +13,7 @@ import (
 // the special agent that each of them will already have installed in order to
 // connect to the cluster.
 func MasterHealthHandler(w http.ResponseWriter, r *http.Request) {
-            fmt.Fprintf("Ëverything should be okay my boi")
+        w.WriteHeader(http.StatusOK)
+       fmt.Fprintf(w, "Ëverything should be okay my boi")
 }
 
diff --git a/monospace.json b/monospace.json
new file mode 100644 (file)
index 0000000..610b206
--- /dev/null
@@ -0,0 +1,9 @@
+{
+    "previews": [
+      {
+        "command": ["go","run","vscpweb.go"],
+        "id": "web",
+        "manager": "web"
+      }
+    ]
+  }
\ No newline at end of file
index a977ad8f10652aca5689b474aa8cc3af42d00424..23a07ab6cd6a8b914d258254b17eb393485ceafa 100644 (file)
@@ -1,17 +1,17 @@
 // This is a system for playing with SDN based openvswitches using a simple web
 // interface. This project will be combined with a CLI version or probably just
 // made compatible with a core version in the future.
-package vscpweb
+package main
 
 import (
        "fmt"
        "net/http"
 
        hh "healthHandlers"
-       mh "managementHandlers"
-       vh "virtualAPIHandlers"
-       ch "controllerHandlers"
-       sh "staticHandlers"
+       //mh "managementHandlers"
+       //vh "virtualAPIHandlers"
+       //ch "controllerHandlers"
+       //sh "staticHandlers"
 
        "github.com/go-chi/chi/v5"
        "github.com/go-chi/chi/v5/middleware"
@@ -92,6 +92,7 @@ func (s *server) MountHandlers() {
        //healthRouter.Get("/", )//this renders the health page "/health"
        //healthRouter.Get("/ping", )// "/rpiping"
        healthRouter.Get("/masterHealth", hh.MasterHealthHandler) //return a JSON with healt of the master "/free"
+       healthRouter.Get("/", hh.MasterHealthHandler) //return a JSON with healt of the master "/free"
        //controllerRouter.Delete("/flow", )//this is an external request "/flowdel"
        //controllerRouter.Get("/resetflows", )//not sure if here or managementRouter
        //controllerRouter.Get("/listswitch", )