mirror of
https://github.com/hierynomus/sshj.git
synced 2025-12-07 07:40:55 +03:00
Deprecated Proxy connect methods, moved Sockets utility class to backport package
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package com.hierynomus.sshj.socket;
|
package com.hierynomus.sshj.backport;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -55,6 +55,15 @@ public abstract class SocketClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to a host via a proxy.
|
||||||
|
* @param host The host address to connect to.
|
||||||
|
* @param port The port to connect to.
|
||||||
|
* @param proxy The proxy to connect via.
|
||||||
|
* @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory}
|
||||||
|
* into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket(java.net.Proxy)} constructor.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void connect(InetAddress host, int port, Proxy proxy) throws IOException {
|
public void connect(InetAddress host, int port, Proxy proxy) throws IOException {
|
||||||
if (JavaVersion.isJava7OrEarlier() && proxy.type() == Proxy.Type.HTTP) {
|
if (JavaVersion.isJava7OrEarlier() && proxy.type() == Proxy.Type.HTTP) {
|
||||||
// Java7 and earlier have no support for HTTP Connect proxies, return our custom socket.
|
// Java7 and earlier have no support for HTTP Connect proxies, return our custom socket.
|
||||||
@@ -71,6 +80,15 @@ public abstract class SocketClient {
|
|||||||
connect(InetAddress.getByName(hostname), port);
|
connect(InetAddress.getByName(hostname), port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to a host via a proxy.
|
||||||
|
* @param hostname The host name to connect to.
|
||||||
|
* @param port The port to connect to.
|
||||||
|
* @param proxy The proxy to connect via.
|
||||||
|
* @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory}
|
||||||
|
* into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket(java.net.Proxy)} constructor.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void connect(String hostname, int port, Proxy proxy) throws IOException {
|
public void connect(String hostname, int port, Proxy proxy) throws IOException {
|
||||||
this.hostname = hostname;
|
this.hostname = hostname;
|
||||||
connect(InetAddress.getByName(hostname), port, proxy);
|
connect(InetAddress.getByName(hostname), port, proxy);
|
||||||
@@ -97,10 +115,26 @@ public abstract class SocketClient {
|
|||||||
connect(hostname, defaultPort);
|
connect(hostname, defaultPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to a host via a proxy.
|
||||||
|
* @param host The host address to connect to.
|
||||||
|
* @param proxy The proxy to connect via.
|
||||||
|
* @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory}
|
||||||
|
* into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket(java.net.Proxy)} constructor.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void connect(InetAddress host, Proxy proxy) throws IOException {
|
public void connect(InetAddress host, Proxy proxy) throws IOException {
|
||||||
connect(host, defaultPort, proxy);
|
connect(host, defaultPort, proxy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to a host via a proxy.
|
||||||
|
* @param hostname The host name to connect to.
|
||||||
|
* @param proxy The proxy to connect via.
|
||||||
|
* @deprecated This method will be removed after v0.12.0. If you want to connect via a proxy, you can do this by injecting a {@link javax.net.SocketFactory}
|
||||||
|
* into the SocketClient. The SocketFactory should create sockets using the {@link java.net.Socket(java.net.Proxy)} constructor.
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void connect(String hostname, Proxy proxy) throws IOException {
|
public void connect(String hostname, Proxy proxy) throws IOException {
|
||||||
connect(hostname, defaultPort, proxy);
|
connect(hostname, defaultPort, proxy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,16 +15,14 @@
|
|||||||
*/
|
*/
|
||||||
package net.schmizz.sshj.connection.channel;
|
package net.schmizz.sshj.connection.channel;
|
||||||
|
|
||||||
import com.hierynomus.sshj.socket.Sockets;
|
|
||||||
import net.schmizz.concurrent.Event;
|
import net.schmizz.concurrent.Event;
|
||||||
import net.schmizz.sshj.common.IOUtils;
|
import net.schmizz.sshj.common.IOUtils;
|
||||||
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.hierynomus.sshj.socket.Sockets.asCloseable;
|
import static com.hierynomus.sshj.backport.Sockets.asCloseable;
|
||||||
|
|
||||||
public class SocketStreamCopyMonitor
|
public class SocketStreamCopyMonitor
|
||||||
extends Thread {
|
extends Thread {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import java.net.ServerSocket;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static com.hierynomus.sshj.socket.Sockets.asCloseable;
|
import static com.hierynomus.sshj.backport.Sockets.asCloseable;
|
||||||
|
|
||||||
public class LocalPortForwarder {
|
public class LocalPortForwarder {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user