Skip to content

golang implementation of remote execution base on ssh.

Notifications You must be signed in to change notification settings

kikimo/goremote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

goremote

golang implementation of remote execution base on ssh.

Install

$ go get -u  github.com/kikimo/goremote

Usage

package main

import (
	"fmt"

	"github.com/kikimo/goremote"
)

func main() {
	// user := "root"
	// port := 22
	host := "192.168.15.12"
	password := ""
	builder := goremote.NewSSHClientBuilder()
	client, err := builder.WithHost(host).WithKeyPass(password).Build()
	if err != nil {
		panic(err)
	}
	ret, err := client.Run("ls -l /root")
	if err != nil {
		panic(err)
	}

	fmt.Printf("stdout: %+v\n", ret.Stdout)
	fmt.Printf("stderr: %+v\n", ret.Stderr)
	fmt.Printf("err: %+v\n", ret.Err)
}

About

golang implementation of remote execution base on ssh.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages