command/remote_execute.go
func NewRemoteExecutor(sshCfg SshConfig) (executor Executer, err error) {
	clientconfig := &ssh.ClientConfig{
		User:            sshCfg.Username,
		Auth:            sshCfg.GetAuthMethod(),
		HostKeyCallback: ssh.InsecureIgnoreHostKey(),
	}
	remoteExecutor := &DefaultRemoteExecutor{}
	remoteExecutor.LazyClientDial = func() {
		client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", sshCfg.Host, sshCfg.Port), clientconfig)
		if err != nil {
			lo.G.Error("ssh connection issue:", err)
			return
		}
		remoteExecutor.Client = NewClientWrapper(client)
	}
	executor = remoteExecutor
	return
}
func NewRemoteExecutor(sshCfg SshConfig) (executor Executer, err error) {
	clientconfig := &ssh.ClientConfig{
		User:            sshCfg.Username,
		Auth:            sshCfg.GetAuthMethod(),
		HostKeyCallback: ssh.InsecureIgnoreHostKey(),
	}
	remoteExecutor := &DefaultRemoteExecutor{}
	remoteExecutor.LazyClientDial = func() {
		client, err := ssh.Dial("tcp", fmt.Sprintf("%s:%d", sshCfg.Host, sshCfg.Port), clientconfig)
		if err != nil {
			lo.G.Error("ssh connection issue:", err)
			return
		}
		remoteExecutor.Client = NewClientWrapper(client)
	}
	executor = remoteExecutor
	return
}
func NewRemoteExecutor ( sshCfg SshConfig ) ( executor Executer , err error ) { clientconfig := & ssh . ClientConfig { User : sshCfg . Username , Auth : sshCfg . GetAuthMethod ( ) , HostKeyCallback : ssh . InsecureIgnoreHostKey ( ) , } remoteExecutor := & DefaultRemoteExecutor { } remoteExecutor . LazyClientDial = func ( ) { client , err := ssh . Dial ( " " , fmt . Sprintf ( " " , sshCfg . Host , sshCfg . Port ) , clientconfig ) if err != nil { lo . G . Error ( " " , err ) return } remoteExecutor . Client = NewClientWrapper ( client ) } executor = remoteExecutor return }
//NewRemoteExecutor - This method creates executor based on ssh, it has concrete ssh reference
NewRemoteExecutor - This method creates executor based on ssh it has concrete ssh reference