Documentation
¶
Index ¶
- Constants
- func Contains(slice []string, s string) bool
- func CreateSSHClient(config *SSHConfig) (*ssh.ClientConfig, error)
- func GenerateInstanceName(podName, sandboxID string, podvmNameMax int) string
- func NodeLabels(ctx context.Context, name string) (map[string]string, error)
- func ReadAndValidatePrivateKey(path string) (string, error)
- func ReadAndValidatePublicKey(path string) (string, error)
- func RedactStruct(struc interface{}, fields ...string) interface{}
- func SendFileViaSFTP(address string, sshConfig *ssh.ClientConfig, remotePath string, content []byte) error
- func SendFileViaSFTPWithContext(ctx context.Context, address string, sshConfig *ssh.ClientConfig, ...) error
- func ValidateSSHPrivateKey(privKey string) error
- func ValidateSSHPublicKey(pubKey string) error
- type SSHConfig
Constants ¶
View Source
const ( // Maximum number of allowed SSH host keys MaxAllowedHostKeys = 100 // Maximum size of a single SSH public key file (in bytes) MaxKeyFileSize = 16 * 1024 // 16KB should be more than enough for any SSH key )
Variables ¶
This section is empty.
Functions ¶
func CreateSSHClient ¶ added in v0.16.0
func CreateSSHClient(config *SSHConfig) (*ssh.ClientConfig, error)
CreateSSHClient creates a complete SSH client configuration
func GenerateInstanceName ¶
func ReadAndValidatePrivateKey ¶ added in v0.16.0
ReadAndValidatePrivateKey reads and validates a private key file
func ReadAndValidatePublicKey ¶ added in v0.16.0
ReadAndValidatePublicKey reads and validates a public key file
func RedactStruct ¶
func RedactStruct(struc interface{}, fields ...string) interface{}
func SendFileViaSFTP ¶ added in v0.16.0
func SendFileViaSFTP(address string, sshConfig *ssh.ClientConfig, remotePath string, content []byte) error
SendFileViaSFTP sends file content to a remote path via SFTP
func SendFileViaSFTPWithContext ¶ added in v0.16.0
func SendFileViaSFTPWithContext(ctx context.Context, address string, sshConfig *ssh.ClientConfig, remotePath string, content []byte) error
SendFileViaSFTPWithContext sends file content to a remote path via SFTP with context support
func ValidateSSHPrivateKey ¶ added in v0.16.0
ValidateSSHPrivateKey validates that the provided string is a valid SSH private key
func ValidateSSHPublicKey ¶ added in v0.16.0
ValidateSSHPublicKey validates that the provided string is a valid SSH public key
Types ¶
type SSHConfig ¶ added in v0.16.0
type SSHConfig struct {
// Key content (populated from files or generated)
PublicKey string
PrivateKey string
// Key file paths (for loading)
PublicKeyPath string
PrivateKeyPath string
// SSH client configuration
Username string
Timeout time.Duration
HostKeyAllowlistDir string
// Internal settings
EnableSFTP bool
}
SSHConfig holds the SSH configuration for connecting to pod VM
Click to show internal directories.
Click to hide internal directories.