Documentation ¶
Index ¶
- Constants
- func AddKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) error
- func CheckKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) (bool, error)
- func Conn(c *Client, cfg *ssh.ClientConfig) (err error)
- func DefaultKnownHosts() (ssh.HostKeyCallback, error)
- func Download(c *ssh.Client, src string, dest string) (err error)
- func GetSigner(prvFile string, passphrase string) (ssh.Signer, error)
- func KnownHosts(file string) (ssh.HostKeyCallback, error)
- func Upload(c *ssh.Client, src string, dest string) (err error)
- type Auth
- type Client
Constants ¶
const ( UDP string = "udp" TCP string = "tcp" )
Variables ¶
This section is empty.
Functions ¶
func AddKnownHost ¶ added in v0.3.0
Add a host to knows hosts this function by @dixonwille see: https://github.com/melbahja/goph/issues/2
func CheckKnownHost ¶ added in v0.3.0
func CheckKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) (bool, error)
Check is host in known hosts file. It returns is the host found in known_hosts file and error, If the host found in known_hosts file and error not nil that means public key mismatch, Maybe MAN IN THE MIDDLE ATTACK! you should not handshake.
func Conn ¶
func Conn(c *Client, cfg *ssh.ClientConfig) (err error)
Set new net connection to a client.
func DefaultKnownHosts ¶
func DefaultKnownHosts() (ssh.HostKeyCallback, error)
Use default known hosts files to verify host public key.
func KnownHosts ¶
func KnownHosts(file string) (ssh.HostKeyCallback, error)
Get known hosts callback from a custom path.
Types ¶
type Auth ¶
type Auth []ssh.AuthMethod
type Client ¶
func NewConn ¶
func NewConn(user string, addr string, auth Auth, callback ssh.HostKeyCallback) (c *Client, err error)
Get new client connection.
func NewUnknown ¶
Connect to ssh and get client without cheking knownhosts. PLEASE AVOID USING THIS, UNLESS YOU KNOW WHAT ARE YOU DOING! if there a "man in the middle proxy", this can harm you! You can add the key to know hosts and use New() func instead!
func (Client) NewSession ¶
Get new ssh session from client connection See: https://pkg.go.dev/golang.org/x/crypto/ssh?tab=doc#Session