-
Notifications
You must be signed in to change notification settings - Fork 1
/
state.go
38 lines (32 loc) · 886 Bytes
/
state.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
package easyssh
// A ConnState represents the state of a client connection to a server.
// It's used by the optional Server.ConnState hook.
type ConnState int
const (
// StateNew represents a new connection that has newly connected. Connections
// begin at this state and then transition to either StateActive or
// StateClosed.
StateNew ConnState = iota
// StateHandshake represents a connection that is currently performing the
// handshake.
StateHandshake
// StateActive represents a connection that has read 1 or more
// bytes of a request.
StateActive
// StateClosed represents a closed connection.
// This is a terminal state.
StateClosed
)
func (s ConnState) String() string {
switch s {
case StateNew:
return "new"
case StateHandshake:
return "handshake"
case StateActive:
return "active"
case StateClosed:
return "closed"
}
return "unknown"
}