Skip to content
Snippets Groups Projects
Commit dfbd7054 authored by David Cowden's avatar David Cowden
Browse files

readme: Add more info and brush up examples

parent a978de10
No related branches found
No related tags found
No related merge requests found
...@@ -23,10 +23,29 @@ A small, but tedious, amount of work is required to implement a full connection- ...@@ -23,10 +23,29 @@ A small, but tedious, amount of work is required to implement a full connection-
[rfc4252]: https://tools.ietf.org/html/rfc4252 [rfc4252]: https://tools.ietf.org/html/rfc4252
[rfc4253]: https://tools.ietf.org/html/rfc4253 [rfc4253]: https://tools.ietf.org/html/rfc4253
## Get
```
$ go get go.step.sm/sshutil
```
## Examples ## Examples
Example can be found in the [examples][] directory.
Run with:
```
$ go run go.step.sm/example/<name>
$ go run ./example/<name>
```
[examples]: https://github.com/smallstep/sshutil/tree/master/example
### Hello SSH ### Hello SSH
[`hello`](https://github.com/smallstep/sshutil/tree/master/example/hello/main.go)
```golang ```golang
package main package main
...@@ -45,7 +64,7 @@ func main() { ...@@ -45,7 +64,7 @@ func main() {
Output: Output:
``` ```
$ ./main $ go run ./example/hello
$ ssh localhost -p 2022 $ ssh localhost -p 2022
Hello SSH Hello SSH
Server closed remote connection to localhost. Server closed remote connection to localhost.
...@@ -56,6 +75,8 @@ Server closed remote connection to localhost. ...@@ -56,6 +75,8 @@ Server closed remote connection to localhost.
The default session handler is an echo server. The default session handler is an echo server.
Easily configure a persistent host key. Easily configure a persistent host key.
[`hostkey`](https://github.com/smallstep/sshutil/tree/master/example/hostkey/main.go)
```golang ```golang
package main package main
...@@ -84,6 +105,7 @@ func main() { ...@@ -84,6 +105,7 @@ func main() {
Output: Output:
``` ```
$ go run ./example/hostkey
$ ssh localhost -p 2022 $ ssh localhost -p 2022
> echo > echo
echo echo
...@@ -91,3 +113,8 @@ echo ...@@ -91,3 +113,8 @@ echo
Client closed connection to localhost. Client closed connection to localhost.
``` ```
## Test
```
$ go test
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment