Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialSSH ¶
DialSSH opens an authenticated SSH client connection to the target. Caller must Close.
func SSHAuthMethods ¶
func SSHAuthMethods() ([]ssh.AuthMethod, error)
SSHAuthMethods probes the user's environment for usable SSH auth. Agent first, then the three common Ed25519/RSA/ECDSA private keys.
func SSHClientConfig ¶
func SSHClientConfig(t vmshared.SSHTarget) (*ssh.ClientConfig, error)
SSHClientConfig builds an *ssh.ClientConfig for the given target using (in order):
- SSH_AUTH_SOCK — ssh-agent keys, if available.
- ~/.ssh/id_ed25519, ~/.ssh/id_rsa, ~/.ssh/id_ecdsa — any readable key file (unencrypted; we don't prompt for passphrases here — the user's normal workflow should keep keys in the agent).
Host-key checking honors ~/.ssh/known_hosts when present; otherwise it falls back to InsecureIgnoreHostKey. Callers that need strict verification should ensure the agent path is available.
Types ¶
type SSHTunnel ¶
type SSHTunnel struct {
// contains filtered or unexported fields
}
SSHTunnel is a live SSH connection plus any forwards opened against it. Call Close to tear everything down.
func NewSSHTunnel ¶
NewSSHTunnel dials the target and returns a tunnel handle. The underlying ssh.Client can host any number of forwards.
func (*SSHTunnel) Client ¶
Client returns the underlying SSH client, for consumers that open their own channels over the same connection (e.g. dialing a remote unix socket). The client stays owned by the tunnel — use Close to disconnect.
func (*SSHTunnel) ForwardTCP ¶
func (t *SSHTunnel) ForwardTCP(ctx context.Context, remoteHost string, remotePort int) (string, func(), error)
ForwardTCP opens a local 127.0.0.1:<random> listener that forwards each accepted connection to <remoteHost>:<remotePort> via the SSH connection. Returns the local "127.0.0.1:<port>" address plus a cleanup func that closes the listener (but not the SSH client — use Close for that).
func (*SSHTunnel) ForwardUnix ¶
ForwardUnix opens a local UNIX socket under /tmp/charly-tunnel-<uuid>.sock that forwards each accepted connection to <remoteSocket> on the other side of the SSH connection. Returns the local socket path plus a cleanup func.