aboutsummaryrefslogtreecommitdiff
path: root/ssh.go
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.go')
-rw-r--r--ssh.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/ssh.go b/ssh.go
new file mode 100644
index 0000000..3d43a6c
--- /dev/null
+++ b/ssh.go
@@ -0,0 +1,33 @@
+package main
+
+import (
+ "fmt"
+ "io"
+ "io/ioutil"
+ "math/rand"
+ "net"
+ "time"
+)
+
+type empty struct{}
+
+func sshHandler(conn net.Conn) {
+ eof := make(chan empty)
+ go func() {
+ io.Copy(ioutil.Discard, conn)
+ eof <- empty{}
+ }()
+
+ tick := time.Tick(10 * time.Second)
+ for {
+ select {
+ case <-eof:
+ return
+ case <-tick:
+ _, err := fmt.Fprintf(conn, "%x\r\n", rand.Uint32())
+ if err != nil {
+ return
+ }
+ }
+ }
+}