Documentation
¶
Overview ¶
Package version provides version management and compatibility checking for upterm/uptermd.
This package centralizes version handling across the upterm ecosystem, including:
- Single source of truth for version constants
- Semantic version parsing and comparison
- SSH server version extraction and validation
- Host/server compatibility checking with detailed results
The main entry point is CheckCompatibility() which compares the current host version with a server's SSH version string and returns detailed compatibility information.
Example usage:
result := version.CheckCompatibility("SSH-2.0-uptermd-0.14.3")
if !result.Compatible {
fmt.Printf("Warning: %s\n", result.Message)
fmt.Printf("Host: %s, Server: %s\n", result.HostVersion, result.ServerVersion)
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( GitCommit string // Git commit SHA Date string // Build date )
Build-time variables set via ldflags
var Version = "0.0.0+dev"
Version is the semantic version of upterm/uptermd This is the single source of truth for both client and server versions Can be overridden at build time with ldflags
Functions ¶
func Current ¶
Current returns the current version as a parsed version object Panics if Version constant is not a valid semantic version
func ParseFromSSHVersion ¶
ParseFromSSHVersion extracts version from SSH version strings like "SSH-2.0-uptermd-0.14.3" Uses regex for precise parsing and supports complex semantic versions like "1.0.0-beta.1+build.123"
func PrintVersion ¶ added in v0.15.1
func PrintVersion(binaryName string)
PrintVersion prints version information with the given binary name
func ServerSSHVersion ¶
func ServerSSHVersion() string
ServerSSHVersion returns the SSH server version string with embedded version
Types ¶
type BuildInfo ¶ added in v0.15.1
type BuildInfo struct {
Version string `json:"version"`
GitCommit string `json:"git_commit,omitempty"`
BuildDate string `json:"build_date,omitempty"`
}
BuildInfo contains version and build information
func GetBuildInfo ¶ added in v0.15.1
func GetBuildInfo() BuildInfo
GetBuildInfo returns comprehensive build information
type CompatibilityResult ¶
type CompatibilityResult struct {
Compatible bool
HostVersion string
ServerVersion string
Message string
}
CompatibilityResult contains the result of version compatibility checking
func CheckCompatibility ¶
func CheckCompatibility(sshVersion string) *CompatibilityResult
CheckCompatibility checks if the server version is compatible with the current host version Always returns a result - Compatible=false for unparseable server versions to indicate incompatibility