MCPcopy
hub / github.com/gliderlabs/ssh / applyConnMetadata

Function applyConnMetadata

context.go:113–123  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

111// this is separate from newContext because we will get ConnMetadata
112// at different points so it needs to be applied separately
113func 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
125func (ctx *sshContext) Value(key interface{}) interface{} {
126 ctx.valuesMu.Lock()

Callers 2

configMethod · 0.85
HandleConnMethod · 0.85

Calls 8

ValueMethod · 0.80
SetValueMethod · 0.65
SessionIDMethod · 0.65
ClientVersionMethod · 0.65
ServerVersionMethod · 0.65
UserMethod · 0.65
LocalAddrMethod · 0.65
RemoteAddrMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…