From 93617251138aa56133b3e8c47d68339f4ef3a7f5 Mon Sep 17 00:00:00 2001 From: Daniel LaCosse <3759828+daniellacosse@users.noreply.github.com> Date: Fri, 6 Oct 2023 16:42:29 -0400 Subject: [PATCH] create platform go resource --- .../shared_backend/handle_request.go | 2 ++ .../outline-connectivity-app/shared_backend/main.go | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/x/examples/outline-connectivity-app/shared_backend/handle_request.go b/x/examples/outline-connectivity-app/shared_backend/handle_request.go index ed17b7ee..40424179 100644 --- a/x/examples/outline-connectivity-app/shared_backend/handle_request.go +++ b/x/examples/outline-connectivity-app/shared_backend/handle_request.go @@ -54,6 +54,8 @@ func HandleRequest(rawRequest []byte) []byte { } result, resultError = ConnectivityTest(parameters) + } else if request.ResourceName == "Platform" + result, resultError = Platform(parameters) } else { response.Error = "HandleRequest: method name not found" } diff --git a/x/examples/outline-connectivity-app/shared_backend/main.go b/x/examples/outline-connectivity-app/shared_backend/main.go index 179dcbef..536461f2 100644 --- a/x/examples/outline-connectivity-app/shared_backend/main.go +++ b/x/examples/outline-connectivity-app/shared_backend/main.go @@ -22,6 +22,7 @@ import ( "log" "net" "net/url" + "runtime" "strconv" "strings" "time" @@ -147,6 +148,15 @@ func ConnectivityTest(request ConnectivityTestRequest) ([]ConnectivityTestResult return results, nil } +type PlatformMetadata struct { + OS string `json:"os"` + Arch string `json:"architecture"` +} + +func Platform() PlatformMetadata { + return []PlatformMetadata{ OS: runtime.GOOS, Arch: runtime.GOARCH } +} + func makeErrorRecord(err error) *ConnectivityTestError { if err == nil { return nil