sshpoke/internal/server/driver/ssh/validate.go

11 lines
325 B
Go
Raw Normal View History

package ssh
import "regexp"
var clientVersionVerifier = regexp.MustCompile(`^[a-zA-Z0-9\.\-\_]+\x{20}?[a-zA-Z0-9\.\-\_]+?$`)
// isValidClientVersion returns true if provided SSH client version string is compliant with RFC-4253.
func isValidClientVersion(ver string) bool {
return clientVersionVerifier.MatchString(ver)
}