this is separate from newContext because we will get ConnMetadata at different points so it needs to be applied separately
(ctx Context, conn gossh.ConnMetadata)
| 111 | // this is separate from newContext because we will get ConnMetadata |
| 112 | // at different points so it needs to be applied separately |
| 113 | func applyConnMetadata(ctx Context, conn gossh.ConnMetadata) { |
| 114 | if ctx.Value(ContextKeySessionID) != nil { |
| 115 | return |
| 116 | } |
| 117 | ctx.SetValue(ContextKeySessionID, hex.EncodeToString(conn.SessionID())) |
| 118 | ctx.SetValue(ContextKeyClientVersion, string(conn.ClientVersion())) |
| 119 | ctx.SetValue(ContextKeyServerVersion, string(conn.ServerVersion())) |
| 120 | ctx.SetValue(ContextKeyUser, conn.User()) |
| 121 | ctx.SetValue(ContextKeyLocalAddr, conn.LocalAddr()) |
| 122 | ctx.SetValue(ContextKeyRemoteAddr, conn.RemoteAddr()) |
| 123 | } |
| 124 | |
| 125 | func (ctx *sshContext) Value(key interface{}) interface{} { |
| 126 | ctx.valuesMu.Lock() |
no test coverage detected
searching dependent graphs…