feat: initial goget release — modern IPv6-first download utility

This commit is contained in:
2026-06-26 21:21:58 +02:00
commit 53db81e1f7
147 changed files with 45931 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
//go:build linux || freebsd
// +build linux freebsd
package sftp
import (
"fmt"
"os"
"path/filepath"
"golang.org/x/crypto/ssh"
"golang.org/x/crypto/ssh/knownhosts"
)
func hostKeyCallback(knownHostsPath string, insecure bool) (ssh.HostKeyCallback, error) {
if insecure {
return ssh.InsecureIgnoreHostKey(), nil
}
if knownHostsPath == "" {
home, err := os.UserHomeDir()
if err != nil {
return nil, fmt.Errorf("known_hosts: %w", err)
}
knownHostsPath = filepath.Join(home, ".ssh", "known_hosts")
}
if _, err := os.Stat(knownHostsPath); err != nil {
return nil, fmt.Errorf("known_hosts file not found: %s (use --ssh-insecure to skip host key check)", knownHostsPath)
}
return knownhosts.New(knownHostsPath)
}