Added ssh Connection to callback so additional info is available about connection
This commit is contained in:
parent
91d8c1f8ab
commit
b1cb51d887
@ -16,7 +16,7 @@ const DefaultRPCChannel = "RPCChannel"
|
|||||||
const RPCSubsystem = "RPCSubsystem"
|
const RPCSubsystem = "RPCSubsystem"
|
||||||
|
|
||||||
// CallbackFunc to be called when reverse RPC client is created
|
// CallbackFunc to be called when reverse RPC client is created
|
||||||
type CallbackFunc func(RPCClient *rpc.Client)
|
type CallbackFunc func(RPCClient *rpc.Client, conn ssh.Conn)
|
||||||
|
|
||||||
// Server represents an SSH Server that spins up RPC servers when requested.
|
// Server represents an SSH Server that spins up RPC servers when requested.
|
||||||
type Server struct {
|
type Server struct {
|
||||||
@ -122,7 +122,7 @@ func (s *Server) handleChannels(chans <-chan ssh.NewChannel, sshConn ssh.Conn) {
|
|||||||
}
|
}
|
||||||
rpcClient := rpc.NewClient(clientChannel)
|
rpcClient := rpc.NewClient(clientChannel)
|
||||||
if s.CallbackFunc != nil {
|
if s.CallbackFunc != nil {
|
||||||
s.CallbackFunc(rpcClient)
|
s.CallbackFunc(rpcClient, sshConn)
|
||||||
}
|
}
|
||||||
log.Printf("Started SSH RPC client")
|
log.Printf("Started SSH RPC client")
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user