transport

package
v1.0.40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizedKeysPath

func AuthorizedKeysPath() string

AuthorizedKeysPath returns the default authorized_keys path.

func GenerateHostKey

func GenerateHostKey(path string) error

GenerateHostKey creates a new ed25519 key pair and saves the private key in OpenSSH format.

func GenerateRelayKey

func GenerateRelayKey(path string) (ssh.Signer, ssh.PublicKey, error)

GenerateRelayKey always generates a new relay Ed25519 keypair at path. Returns the signer and the SSH public key.

func KeyPath

func KeyPath() string

KeyPath returns the default host key path.

func LoadHostKey

func LoadHostKey(path string) (ssh.Signer, error)

LoadHostKey reads an ed25519 private key from file. If the file doesn't exist, generates a new key first.

func LoadOrGenerateRelayKey

func LoadOrGenerateRelayKey(path string) (ssh.Signer, ssh.PublicKey, error)

LoadOrGenerateRelayKey loads or creates the relay Ed25519 keypair. Returns the signer and the SSH public key.

func LoadOrGenerateTLS

func LoadOrGenerateTLS(certPath, keyPath string) (tls.Certificate, error)

LoadOrGenerateTLS loads a TLS certificate from certPath/keyPath. If the files don't exist, generates a self-signed certificate.

func RelayKeyPath

func RelayKeyPath() string

RelayKeyPath returns the default relay key path.

func TLSPaths

func TLSPaths() (certPath, keyPath string)

TLSPaths returns the default cert and key paths.

Types

type AuthorizedKey

type AuthorizedKey struct {
	Key     ssh.PublicKey
	Comment string
}

AuthorizedKey holds a parsed public key and its comment.

func LoadAuthorizedKeys

func LoadAuthorizedKeys(path string) ([]AuthorizedKey, error)

LoadAuthorizedKeys reads public keys from an authorized_keys file. Returns nil (no keys) if the file doesn't exist. Rejects the file if permissions are too open (must be 0600 or stricter).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL