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
package ssh
import (
"context"
"net"
)
const (
CapabilityRun = "stream.dial"
ScopeRun = "command"
)
type Account struct {
DID string
Handle string
PDS string
}
type PTYSize struct {
Cols int
Rows int
}
type CommandIO interface {
Write(chunk []byte) error
WriteErr(chunk []byte) error
OnData(handler func(chunk []byte))
OnClose(handler func())
Exit(code int)
PTY() *PTYSize
}
type Runner interface {
RunCommand(ctx context.Context, account Account, command string, env map[string]string, io CommandIO) error
}
type Server interface {
ServeConn(ctx context.Context, conn net.Conn) error
Shutdown(ctx context.Context) error
}