cloudflare/cloudflared

Public

mirrored from https://github.com/cloudflare/cloudflaredAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
2021.5.8

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

cmd/cloudflared/buildinfo/build_info.go

33lines · modecode

1package buildinfo
2
3import (
4 "fmt"
5 "runtime"
6
7 "github.com/rs/zerolog"
8)
9
10type BuildInfo struct {
11 GoOS string `json:"go_os"`
12 GoVersion string `json:"go_version"`
13 GoArch string `json:"go_arch"`
14 CloudflaredVersion string `json:"cloudflared_version"`
15}
16
17func GetBuildInfo(cloudflaredVersion string) *BuildInfo {
18 return &BuildInfo{
19 GoOS: runtime.GOOS,
20 GoVersion: runtime.Version(),
21 GoArch: runtime.GOARCH,
22 CloudflaredVersion: cloudflaredVersion,
23 }
24}
25
26func (bi *BuildInfo) Log(log *zerolog.Logger) {
27 log.Info().Msgf("Version %s", bi.CloudflaredVersion)
28 log.Info().Msgf("GOOS: %s, GOVersion: %s, GoArch: %s", bi.GoOS, bi.GoVersion, bi.GoArch)
29}
30
31func (bi *BuildInfo) OSArch() string {
32 return fmt.Sprintf("%s_%s", bi.GoOS, bi.GoArch)
33}
34