Files
ziti/common/version/info.go
2026-01-28 15:01:35 -05:00

80 lines
1.5 KiB
Go

/*
Copyright NetFoundry Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package version
import (
"runtime"
"github.com/openziti/foundation/v2/versions"
)
type cmdBuildInfo struct{}
func (c cmdBuildInfo) EncoderDecoder() versions.VersionEncDec {
return &versions.StdVersionEncDec
}
func (c cmdBuildInfo) Version() string {
return Version
}
func (c cmdBuildInfo) Revision() string {
return Revision
}
func (c cmdBuildInfo) BuildDate() string {
return BuildDate
}
func (c cmdBuildInfo) AsVersionInfo() *versions.VersionInfo {
return &versions.VersionInfo{
Version: c.Version(),
Revision: c.Revision(),
BuildDate: c.BuildDate(),
OS: GetOS(),
Arch: GetArchitecture(),
}
}
func GetCmdBuildInfo() versions.VersionProvider {
return cmdBuildInfo{}
}
func GetVersion() string {
return Version
}
func GetRevision() string {
return Revision
}
func GetBuildDate() string {
return BuildDate
}
func GetGoVersion() string {
return runtime.Version()
}
func GetOS() string {
return runtime.GOOS
}
func GetArchitecture() string {
return runtime.GOARCH
}