Files
teleport/pkg/version/version.go
Justin Harms d24d1dc5ae Add initial project structure with core functionality
- Created a new Go module named 'teleport' for secure port forwarding.
- Added essential files including .gitignore, LICENSE, and README.md with project details.
- Implemented configuration management with YAML support in config package.
- Developed core client and server functionalities for handling port forwarding.
- Introduced DNS server capabilities and integrated logging with sanitization.
- Established rate limiting and metrics tracking for performance monitoring.
- Included comprehensive tests for core components and functionalities.
- Set up CI workflows for automated testing and release management using Gitea actions.
2025-09-20 18:07:08 -05:00

48 lines
1.0 KiB
Go

package version
import (
"fmt"
"runtime"
)
// These variables are set during build time via ldflags
var (
Version = "dev"
GitCommit = "unknown"
BuildDate = "unknown"
GoVersion = runtime.Version()
Platform = fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH)
)
// Info holds version information
type Info struct {
Version string `json:"version"`
GitCommit string `json:"git_commit"`
BuildDate string `json:"build_date"`
GoVersion string `json:"go_version"`
Platform string `json:"platform"`
}
// Get returns version information
func Get() Info {
return Info{
Version: Version,
GitCommit: GitCommit,
BuildDate: BuildDate,
GoVersion: GoVersion,
Platform: Platform,
}
}
// String returns a formatted version string
func String() string {
info := Get()
return fmt.Sprintf("teleport version %s (commit: %s, built: %s, go: %s, platform: %s)",
info.Version, info.GitCommit, info.BuildDate, info.GoVersion, info.Platform)
}
// Short returns a short version string
func Short() string {
return fmt.Sprintf("teleport %s", Version)
}