func()

in internal/remote/remote.go [146:165]


func (r *remote) CreateClient() error {
	if r.key.PublicKey == nil {
		return fmt.Errorf("no public key found. please make sure SetupKeys() is called before calling CreateClient()")
	}
	if r.key.PrivateKey == nil {
		return fmt.Errorf("no private key found. please make sure SetupKeys() is called before calling CreateClient()")
	}
	c, err := ssh.Dial("tcp", net.JoinHostPort(r.ip, strconv.FormatInt(int64(r.port), 10)), &ssh.ClientConfig{
		User:            r.user,
		HostKeyCallback: ssh.FixedHostKey(r.key.PublicKey),
		Auth: []ssh.AuthMethod{
			ssh.PublicKeys(r.key.PrivateKey),
		},
	})
	if err != nil {
		return fmt.Errorf("an error occurred while ssh dialing. %v", err)
	}
	r.client = c
	return nil
}