version

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

View Source
var (
	GitCommit string // Git commit SHA
	Date      string // Build date
)

Build-time variables set via ldflags

View Source
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

func Current() *version.Version

Current returns the current version as a parsed version object Panics if Version constant is not a valid semantic version

func Parse

func Parse(v string) (*version.Version, error)

Parse parses a version string using hashicorp's go-version library

func ParseFromSSHVersion

func ParseFromSSHVersion(sshVersion string) (*version.Version, error)

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

func String

func String() string

String returns the current version as a string

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL