blob: 48cfefe0206c60cea31df57a3d6603d6f5323491 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# scp
[![Go Report Card](https://goreportcard.com/badge/github.com/dtylman/scp)](https://goreportcard.com/report/github.com/dtylman/scp)
A Simple `go` SCP client library.
## Usage
```go
import (
"github.com/dtylman/scp"
"golang.org/x/crypto/ssh"
)
```
## Sending Files
Copies `/var/log/messages` to remote `/tmp/lala`:
```go
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)
}
```
## Receiving Files
Copies remote `/var/log/message` to local `/tmp/lala`:
```go
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)
}
```
|