Skip to content

Commit

Permalink
add channel handler and local port forwarding callback
Browse files Browse the repository at this point in the history
  • Loading branch information
benasse authored and gustavosbarreto committed Oct 3, 2022
1 parent b368bfa commit 333f517
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ssh/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ func NewServer(opts *Options, tunnel *httptunnel.Tunnel) *Server {
SubsystemHandlers: map[string]gliderssh.SubsystemHandler{
handler.SFTPSubsystem: handler.SFTPSubsystemHandler(tunnel),
},
ChannelHandlers: map[string]gliderssh.ChannelHandler{
"session": gliderssh.DefaultSessionHandler,
"direct-tcpip": gliderssh.DirectTCPIPHandler,
},
LocalPortForwardingCallback: gliderssh.LocalPortForwardingCallback(func(ctx gliderssh.Context, dhost string, dport uint32) bool {
log.Println("Accepted forward", dhost, dport)
return true
}),
}

if _, err := os.Stat(os.Getenv("PRIVATE_KEY")); os.IsNotExist(err) {
Expand Down

0 comments on commit 333f517

Please sign in to comment.