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.
This commit is contained in:
47
pkg/version/version.go
Normal file
47
pkg/version/version.go
Normal file
@@ -0,0 +1,47 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user