/
runtime.go
66 lines (57 loc) · 1.58 KB
/
runtime.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (c) 2022 Wireleap
package restapi
import (
"runtime"
"github.com/blang/semver"
"github.com/wireleap/client/version"
"github.com/wireleap/common/api/interfaces/clientcontract"
"github.com/wireleap/common/api/interfaces/clientdir"
"github.com/wireleap/common/api/interfaces/clientrelay"
"github.com/wireleap/common/cli/upgrade"
)
type Versions struct {
Software *semver.Version `json:"software"`
Api *semver.Version `json:"api"`
ClientRelay *semver.Version `json:"client-relay"`
ClientDir *semver.Version `json:"client-dir"`
ClientContract *semver.Version `json:"client-contract"`
}
type Upgrade struct {
Supported bool `json:"supported"`
}
type Build struct {
GitCommit string `json:"gitcommit"`
GoVersion string `json:"goversion"`
Time string `json:"time"`
Flags string `json:"flags"`
}
type Platform struct {
Os string `json:"os"`
Arch string `json:"arch"`
}
type Runtime struct {
Versions Versions `json:"versions"`
Upgrade Upgrade `json:"upgrade"`
Build Build `json:"build"`
Platform Platform `json:"platform"`
}
var RuntimeReply = Runtime{
Versions: Versions{
Software: &version.VERSION,
Api: &VERSION,
ClientRelay: &clientrelay.T.Version,
ClientDir: &clientdir.T.Version,
ClientContract: &clientcontract.T.Version,
},
Upgrade: Upgrade{Supported: upgrade.Supported},
Build: Build{
GitCommit: version.GIT_COMMIT,
GoVersion: runtime.Version(),
Time: version.BUILD_TIME,
Flags: version.BUILD_FLAGS,
},
Platform: Platform{
Os: runtime.GOOS,
Arch: runtime.GOARCH,
},
}