We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 93eb073 commit ac34feaCopy full SHA for ac34fea
_examples/ssh-remoteforward/portforward.go
@@ -11,6 +11,8 @@ func main() {
11
12
log.Println("starting ssh server on port 2222...")
13
14
+ forwardHandler := &ssh.ForwardedTCPHandler{}
15
+
16
server := ssh.Server{
17
LocalPortForwardingCallback: ssh.LocalPortForwardingCallback(func(ctx ssh.Context, dhost string, dport uint32) bool {
18
log.Println("Accepted forward", dhost, dport)
@@ -25,6 +27,10 @@ func main() {
25
27
log.Println("attempt to bind", host, port, "granted")
26
28
return true
29
}),
30
+ RequestHandlers: map[string]ssh.RequestHandler{
31
+ "tcpip-forward": forwardHandler.HandleSSHRequest,
32
+ "cancel-tcpip-forward": forwardHandler.HandleSSHRequest,
33
+ },
34
}
35
36
log.Fatal(server.ListenAndServe())
0 commit comments