Interface ITunnel
-
- All Superinterfaces:
AutoCloseable
public interface ITunnel extends AutoCloseable
The support class to open SSH tunnel. Tinnel is mainly useful for passing through firewalls, though it can also be used to provide a secure endpoint into other network.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes tunnel.URL
getUrl()
Returns opened tunnel URL that client may call to get tunnelled target URL.URL
open(URL url, int port)
Opens tunnel to the provided URL and the provided application port.URL
open(URL url, int port, TunnelOptions options)
Opens tunnel to the provided URL and the provided application port.
-
-
-
Method Detail
-
open
URL open(URL url, int port) throws TunnelException
Opens tunnel to the provided URL and the provided application port.- Parameters:
url
- the URL to open tunnel on, cannot benull
port
- the port to tunnel to, must be positive- Returns:
- a URL that client may call to get tunnelled target URL, never
null
- Throws:
TunnelException
- if tunnel open failed
-
open
URL open(URL url, int port, TunnelOptions options) throws TunnelException
Opens tunnel to the provided URL and the provided application port.- Parameters:
url
- the URL to open tunnel on, cannot benull
port
- the port to tunnel to, must be positiveoptions
- a tunnel options to open with, cannot benull
- Returns:
- a URL that client may call to get tunnelled target URL, never
null
- Throws:
TunnelException
- if tunnel open failed
-
getUrl
URL getUrl() throws TunnelException
Returns opened tunnel URL that client may call to get tunnelled target URL.- Returns:
- a URL that client may call to get tunnelled target URL, never
null
- Throws:
TunnelException
- if tunnel is not opened
-
close
void close() throws TunnelException
Closes tunnel. If tunnel is already closed then does nothing.- Specified by:
close
in interfaceAutoCloseable
- Throws:
TunnelException
- if tunnel close failed
-
-