-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed streamlocal example from main page
- Loading branch information
Showing
1 changed file
with
1 addition
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,45 +25,4 @@ As I explained in a [blog post](http://www.matez.de/index.php/2020/06/22/the-fut | |
* 0.1.59 fixing issue from https://sourceforge.net/p/jsch/mailman/message/36872566/ | ||
* 0.1.58 support for more algorithms contributed by [@norrisjeremy](https://github.com/norrisjeremy) see [#4](https://github.com/mwiede/jsch/pull/4) | ||
* 0.1.57 support for rsa-sha2-256 and rsa-sha2-512. [#1](https://github.com/mwiede/jsch/pull/1) | ||
* 0.1.56 support for direct-streamlocal@<!-- -->openssh.com | ||
|
||
Example: (see [SocketForwardingL.java](examples/SocketForwardingL.java)) | ||
```java | ||
session.connect(30000); // making a connection with timeout. | ||
|
||
final int boundPort = session.setSocketForwardingL(null, 0, "/var/run/docker.sock", null, 1000); | ||
|
||
URL myURL = new URL("http://localhost:" + boundPort + "/_ping"); | ||
HttpURLConnection myURLConnection = (HttpURLConnection) myURL.openConnection(); | ||
System.out.println("Docker Ping http response code (" + myURL + "): " + myURLConnection.getResponseCode()); | ||
|
||
session.disconnect(); | ||
``` | ||
|
||
or directly: | ||
|
||
```java | ||
final ChannelDirectStreamLocal channel = (ChannelDirectStreamLocal) session.openChannel("[email protected]"); | ||
try { | ||
final OutputStream outputStream = channel.getOutputStream(); | ||
final InputStream inputStream = channel.getInputStream(); | ||
|
||
channel.setSocketPath("/var/run/docker.sock"); | ||
channel.connect(); | ||
|
||
String cmd = "GET /_ping HTTP/1.0\r\n\r\n"; | ||
try (final PrintWriter printWriter = new PrintWriter(outputStream)) { | ||
printWriter.println(cmd); | ||
printWriter.flush(); | ||
} | ||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { | ||
for (String line; (line = reader.readLine()) != null; ) { | ||
System.out.println(line); | ||
} | ||
} | ||
} catch (IOException exc) { | ||
exc.printStackTrace(); | ||
} finally { | ||
channel.disconnect(); | ||
} | ||
``` | ||
* 0.1.56 support for direct-streamlocal@<!-- -->openssh.com (see [SocketForwardingL.java](examples/SocketForwardingL.java)) |