-
Notifications
You must be signed in to change notification settings - Fork 3
/
metadata.go
69 lines (60 loc) · 1.46 KB
/
metadata.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
67
68
69
package treblle
import (
"runtime"
)
type MetaData struct {
ApiKey string `json:"api_key"`
ProjectID string `json:"project_id"`
Version float32 `json:"version"`
Sdk string `json:"sdk"`
Data DataInfo `json:"data"`
}
type DataInfo struct {
Server ServerInfo `json:"server"`
Language LanguageInfo `json:"language"`
Request RequestInfo `json:"request"`
Response ResponseInfo `json:"response"`
}
type ServerInfo struct {
Ip string `json:"ip"`
Timezone string `json:"timezone"`
Software string `json:"software"`
Signature string `json:"signature"`
Protocol string `json:"protocol"`
Os OsInfo `json:"os"`
}
type OsInfo struct {
Name string `json:"name"`
Release string `json:"release"`
Architecture string `json:"architecture"`
}
type LanguageInfo struct {
Name string `json:"name"`
Version string `json:"version"`
}
// Get information about the server environment
func getServerInfo() ServerInfo {
return ServerInfo{
Ip: "",
Timezone: "UTC",
Software: "",
Signature: "",
Protocol: "",
Os: getOsInfo(),
}
}
// Get information about the programming language
func getLanguageInfo() LanguageInfo {
return LanguageInfo{
Name: "go",
Version: runtime.Version(),
}
}
// Get information about the operating system that is running on the server
func getOsInfo() OsInfo {
return OsInfo{
Name: runtime.GOOS,
Release: "",
Architecture: runtime.GOARCH,
}
}