Skip to content

Commit

Permalink
create platform go resource
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellacosse committed Oct 6, 2023
1 parent 12bb31b commit 9361725
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
10 changes: 10 additions & 0 deletions x/examples/outline-connectivity-app/shared_backend/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"log"
"net"
"net/url"
"runtime"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9361725

Please sign in to comment.