-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd59202
commit 9d272e9
Showing
1 changed file
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,36 @@ | ||
# controlmaster | ||
An implementation of SSH controlmaster support for Golang | ||
controlmaster | ||
------------- | ||
[![GoDoc](http://godoc.org/github.com/bored-engineer/controlmaster?status.svg)](http://godoc.org/github.com/bored-engineer/controlmaster) | ||
|
||
An implementation of the OpenSSH ControlMaster [protocol](https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.mux) for Golang | ||
|
||
NOTE: this relies on a _fork_ of golang.org/x/crypto/ssh with support for custom transports ([github.com/bored-engineer/ssh](https://github.com/bored-engineer/ssh)) | ||
|
||
usage | ||
----- | ||
```go | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/bored-engineer/controlmaster" | ||
) | ||
|
||
func main() { | ||
client, err := controlmaster.Dial("unix", "PATH_TO_CONTROLMASTER") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
session, err := client.NewSession() | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
defer session.Close() | ||
out, err := session.CombinedOutput("id") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
log.Println(string(out)) | ||
} | ||
``` |