1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package userhome
import (
"context"
"github.com/gliderlabs/ssh"
uuid "github.com/satori/go.uuid"
)
func NewSSHConn(sess ssh.Session) *SSHConn {
return &SSHConn{
conn: sess,
uuid: uuid.NewV4(),
}
}
type SSHConn struct {
conn ssh.Session
uuid uuid.UUID
}
func (s *SSHConn) SessionID() string {
return s.uuid.String()
}
func (s *SSHConn) User() string {
return s.conn.User()
}
func (s *SSHConn) UUID() uuid.UUID {
return s.uuid
}
func (s *SSHConn) Pty() (ssh.Pty, <-chan ssh.Window, bool) {
return s.conn.Pty()
}
func (s *SSHConn) Context() context.Context {
return s.conn.Context()
}
func (s *SSHConn) Read(b []byte) (n int, err error) {
return s.conn.Read(b)
}
func (s *SSHConn) Write(b []byte) (n int, err error) {
return s.conn.Write(b)
}
func (s *SSHConn) Close() error {
return s.conn.Close()
}