MCPcopy
hub / github.com/lima-vm/lima / SSHOptsRemovingControlPath

Function SSHOptsRemovingControlPath

pkg/sshutil/sshutil.go:382–388  ·  view source on GitHub ↗

SSHOptsRemovingControlPath removes ControlMaster, ControlPath, and ControlPersist options from SSH options.

(opts []string)

Source from the content-addressed store, hash-verified

380
381// SSHOptsRemovingControlPath removes ControlMaster, ControlPath, and ControlPersist options from SSH options.
382func SSHOptsRemovingControlPath(opts []string) []string {
383 // Create a copy of opts to avoid modifying the original slice, since slices.DeleteFunc modifies the slice in place.
384 copiedOpts := slices.Clone(opts)
385 return slices.DeleteFunc(copiedOpts, func(s string) bool {
386 return strings.HasPrefix(s, "ControlMaster") || strings.HasPrefix(s, "ControlPath") || strings.HasPrefix(s, "ControlPersist")
387 })
388}
389
390func ParseOpenSSHVersion(version []byte) *semver.Version {
391 regex := regexp.MustCompile(`(?m)^OpenSSH_(\d+\.\d+)(?:p(\d+))?\b`)

Callers 2

writeSSHConfigFileFunction · 0.92
shellActionFunction · 0.92

Calls 1

CloneMethod · 0.80

Tested by

no test coverage detected