Skip to content

Commit

Permalink
Add example in README
Browse files Browse the repository at this point in the history
  • Loading branch information
bored-engineer authored Oct 13, 2019
1 parent cd59202 commit 9d272e9
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions README.md
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))
}
```

0 comments on commit 9d272e9

Please sign in to comment.