starter内添加了SSH中转隧道的实现
This commit is contained in:
+5
@@ -1,5 +1,10 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.ssh;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
public class SSHConnectionFactory {
|
||||
public static final SSHConnectionService factory = new SSHConnectionServiceImpl();
|
||||
}
|
||||
|
||||
+5
@@ -1,5 +1,10 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.ssh;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
public interface SSHConnectionService {
|
||||
String addConnection(String host, String username, String password, int localPort, int remotePort,String remoteHost);
|
||||
void openTunnel(String sshId);
|
||||
|
||||
+5
-1
@@ -3,7 +3,11 @@ package org.dromara.neutrinoproxy.client.starter.ssh;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
public class SSHConnectionServiceImpl implements SSHConnectionService {
|
||||
|
||||
private Map<String, SSHProxy> connections;
|
||||
|
||||
+5
-1
@@ -1,7 +1,11 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.ssh;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
@Data
|
||||
public class SSHProxy {
|
||||
private String sshId;
|
||||
|
||||
+5
-1
@@ -1,5 +1,9 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.ssh;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
public interface SSHProxyFactory {
|
||||
void openTunnel();
|
||||
void closeTunnel();
|
||||
|
||||
+5
-1
@@ -3,7 +3,11 @@ package org.dromara.neutrinoproxy.client.starter.ssh;
|
||||
import com.jcraft.jsch.JSch;
|
||||
import com.jcraft.jsch.Session;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
@Slf4j
|
||||
public class SSHProxyFactoryImpl implements SSHProxyFactory {
|
||||
private SSHProxy connection;
|
||||
|
||||
+5
-1
@@ -1,5 +1,9 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.ssh;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user