Debian Codegraph @

example/proxy/proxy.go

raw
1 package main
2
3 import (
4 "fmt"
5
6 "github.com/appleboy/easyssh-proxy"
7 )
8
9 func main() {
10 // Create MakeConfig instance with remote username, server address and path to private key.
11 ssh := &easyssh.MakeConfig{
12 User: "drone-scp",
13 Server: "localhost",
14 Port: "22",
15 KeyPath: "./tests/.ssh/id_rsa",
16 Proxy: easyssh.DefaultConfig{
17 User: "drone-scp",
18 Server: "localhost",
19 Port: "22",
20 KeyPath: "./tests/.ssh/id_rsa",
21 },
22 }
23
24 // Call Scp method with file you want to upload to remote server.
25 // Please make sure the `tmp` floder exists.
26 err := ssh.Scp("/root/source.csv", "/tmp/target.csv")
27 if err != nil {
28 panic("Can't run remote command: " + err.Error())
29 }
30 fmt.Println("success")
31 }