Context is a package specific context interface. It exposes connection metadata and allows new values to be easily written to it. It's used in authentication handlers and callbacks, and its underlying context.Context is exposed on Session in the session Handler. A connection-scoped lock is also embe
| 63 | // exposed on Session in the session Handler. A connection-scoped lock is also |
| 64 | // embedded in the context to make it easier to limit operations per-connection. |
| 65 | type Context interface { |
| 66 | context.Context |
| 67 | sync.Locker |
| 68 | |
| 69 | // User returns the username used when establishing the SSH connection. |
| 70 | User() string |
| 71 | |
| 72 | // SessionID returns the session hash. |
| 73 | SessionID() string |
| 74 | |
| 75 | // ClientVersion returns the version reported by the client. |
| 76 | ClientVersion() string |
| 77 | |
| 78 | // ServerVersion returns the version reported by the server. |
| 79 | ServerVersion() string |
| 80 | |
| 81 | // RemoteAddr returns the remote address for this connection. |
| 82 | RemoteAddr() net.Addr |
| 83 | |
| 84 | // LocalAddr returns the local address for this connection. |
| 85 | LocalAddr() net.Addr |
| 86 | |
| 87 | // Permissions returns the Permissions object used for this connection. |
| 88 | Permissions() *Permissions |
| 89 | |
| 90 | // SetValue allows you to easily write new values into the underlying context. |
| 91 | SetValue(key, value interface{}) |
| 92 | } |
| 93 | |
| 94 | type sshContext struct { |
| 95 | context.Context |
no outgoing calls
no test coverage detected
searching dependent graphs…