A Simple go
SCP client library.
import (
"github.com/dtylman/scp"
"golang.org/x/crypto/ssh"
)
Copies /var/log/messages
to remote /tmp/lala
:
var sc* ssh.Client
// establish ssh connection into sc here...
n,err:=scp.CopyTo(sc, "/var/log/messages", "/tmp/lala")
if err==nil{
fmt.Printf("Sent %v bytes",n)
}
Copies remote /var/log/message
to local /tmp/lala
:
var sc* ssh.Client
// establish ssh connection into sc here...
n,err:=scp.CopyFrom(sc, "/var/log/message", "/tmp/lala")
if err==nil{
fmt.Printf("Sent %v bytes",n)
}