@@ -42,7 +42,7 @@ type Server struct {
42
42
}
43
43
44
44
// internal for now
45
- type channelHandler func (srv * Server , conn * gossh.ServerConn , newChan gossh.NewChannel , ctx * sshContext )
45
+ type channelHandler func (srv * Server , conn * gossh.ServerConn , newChan gossh.NewChannel , ctx Context )
46
46
47
47
func (srv * Server ) ensureHostSigner () error {
48
48
if len (srv .HostSigners ) == 0 {
@@ -55,7 +55,7 @@ func (srv *Server) ensureHostSigner() error {
55
55
return nil
56
56
}
57
57
58
- func (srv * Server ) config (ctx * sshContext ) * gossh.ServerConfig {
58
+ func (srv * Server ) config (ctx Context ) * gossh.ServerConfig {
59
59
srv .channelHandlers = map [string ]channelHandler {
60
60
"session" : sessionHandler ,
61
61
"direct-tcpip" : directTcpipHandler ,
@@ -72,7 +72,7 @@ func (srv *Server) config(ctx *sshContext) *gossh.ServerConfig {
72
72
}
73
73
if srv .PasswordHandler != nil {
74
74
config .PasswordCallback = func (conn gossh.ConnMetadata , password []byte ) (* gossh.Permissions , error ) {
75
- ctx . applyConnMetadata (conn )
75
+ applyConnMetadata (ctx , conn )
76
76
if ok := srv .PasswordHandler (ctx , string (password )); ! ok {
77
77
return ctx .Permissions ().Permissions , fmt .Errorf ("permission denied" )
78
78
}
@@ -81,7 +81,7 @@ func (srv *Server) config(ctx *sshContext) *gossh.ServerConfig {
81
81
}
82
82
if srv .PublicKeyHandler != nil {
83
83
config .PublicKeyCallback = func (conn gossh.ConnMetadata , key gossh.PublicKey ) (* gossh.Permissions , error ) {
84
- ctx . applyConnMetadata (conn )
84
+ applyConnMetadata (ctx , conn )
85
85
if ok := srv .PublicKeyHandler (ctx , key ); ! ok {
86
86
return ctx .Permissions ().Permissions , fmt .Errorf ("permission denied" )
87
87
}
@@ -223,7 +223,7 @@ func (srv *Server) handleConn(newConn net.Conn) {
223
223
defer srv .trackConn (sshConn , false )
224
224
225
225
ctx .SetValue (ContextKeyConn , sshConn )
226
- ctx . applyConnMetadata (sshConn )
226
+ applyConnMetadata (ctx , sshConn )
227
227
go gossh .DiscardRequests (reqs )
228
228
for ch := range chans {
229
229
handler , found := srv .channelHandlers [ch .ChannelType ()]
0 commit comments