-
Notifications
You must be signed in to change notification settings - Fork 1
/
types.go
41 lines (34 loc) · 640 Bytes
/
types.go
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
package ssh
import (
"context"
"golang.org/x/crypto/ssh"
)
type Permissions struct {
ssh.Permissions
}
type Channel struct {
ssh.Channel
ctx context.Context
cancelCtx context.CancelFunc
}
type Request struct {
ssh.Request
}
func wrapRequests(requests <-chan *ssh.Request) <-chan *Request {
wrapped := make(chan *Request)
go func() {
for r := range requests {
wrapped <- &Request{*r}
}
}()
return wrapped
}
func unwrapRequests(requests <-chan *Request) <-chan *ssh.Request {
unwrapped := make(chan *ssh.Request)
go func() {
for r := range requests {
unwrapped <- &r.Request
}
}()
return unwrapped
}