Sha256: 815488bfe08f7d69bf801cbadeb8abe0a7b687dbf1380e580d013801d8edd808
Contents?: true
Size: 966 Bytes
Versions: 2
Compression:
Stored size: 966 Bytes
Contents
Forwarding remote connections to the local host is also straightforward; simply call the @#remote_to@ method of the @#forward@ service. This takes three (or four) parameters: the local port and host to be forwarded to (in that order), and the remote port to listen on. The fourth parameter is optional, and is the bind address on the remote machine; this defaults to "127.0.0.1". [!figure lang=ruby,number=true,caption=Forwarding a remote port Net::SSH.start( 'host' ) do |session| session.forward.remote_to( 80, 'www.google.com', 1234 ) session.loop end !] The above example causes any connection on port 1234 of the remote machine (_from_ the remote machine) to be forwarded via the local host to port 80 at www.google.com. To make things a bit more open, you could specify a bind address of 0.0.0.0: [!figure lang=ruby,caption=Specifying the bind address when forwarding a remote port session.forward.remote_to( 80, 'www.google.com', 1234, '0.0.0.0' ) !]
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
net-ssh-0.9.0 | doc/manual/parts/forward_remote.txt |
net-ssh-1.0.0 | doc/manual/parts/forward_remote.txt |