!59 删除stater敏感信息

Merge pull request !59 from xgc/feature/sdk
This commit is contained in:
傲世孤尘
2024-01-25 07:33:24 +00:00
committed by Gitee
5 changed files with 31 additions and 3 deletions
@@ -1,9 +1,12 @@
package org.dromara.neutrinoproxy.client.starter.config;
import lombok.Data;
import org.dromara.neutrinoproxy.client.starter.ssh.SSHProxy;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
/**
*
* @author: gc.x
@@ -14,9 +17,11 @@ import org.springframework.stereotype.Component;
@Component
public class SpringProxyConfig {
private Boolean enable=false;
private Boolean sshEnable=false;
private Protocol protocol;
private Tunnel tunnel;
private Client client;
private List<SSHProxy> sshProxys;
@Data
public static class Protocol {
@@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
import org.dromara.neutrinoproxy.client.sdk.config.ProxyConfig;
import org.dromara.neutrinoproxy.client.starter.config.ProxyConfiguration;
import org.dromara.neutrinoproxy.client.starter.config.SpringProxyConfig;
import org.dromara.neutrinoproxy.client.starter.ssh.SSHConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
@@ -31,5 +32,11 @@ public class ProxyClientService implements ApplicationRunner {
proxyConfiguration.start(proxyConfig);
log.info("start success!");
}
if(springProxyConfig.getSshEnable()){
springProxyConfig.getSshProxys().forEach(sshProxy -> {
String sshId = SSHConnectionFactory.factory.addConnection(sshProxy);
SSHConnectionFactory.factory.openTunnel(sshId);
});
}
}
}
@@ -7,6 +7,7 @@ package org.dromara.neutrinoproxy.client.starter.ssh;
*/
public interface SSHConnectionService {
String addConnection(String host, String username, String password, int localPort, int remotePort,String remoteHost);
String addConnection(SSHProxy sshProxy);
void openTunnel(String sshId);
void closeTunnel(String sshId);
void closeAllTunnels();
@@ -32,6 +32,13 @@ public class SSHConnectionServiceImpl implements SSHConnectionService {
connections.put(connection.getSshId(), connection);
return sshId;
}
@Override
public String addConnection(SSHProxy sshProxy) {
String sshId = UUID.randomUUID().toString();
sshProxy.setSshId(sshId);
connections.put(sshProxy.getSshId(), sshProxy);
return sshId;
}
@Override
public void openTunnel(String sshId) {
@@ -3,7 +3,6 @@ server:
spring:
application:
name: neutrino-proxy-client
neutrino:
proxy:
protocol:
@@ -22,13 +21,13 @@ neutrino:
key-store-password: ${STORE_PASS:123456}
jks-path: ${JKS_PATH:classpath:/test.jks}
# 服务端IP
server-ip: ${SERVER_IP:194.36.209.36}
server-ip: ${SERVER_IP:}
# 服务端端口(对应服务端app.yml中的tunnel.port、tunnel.ssl-port)
server-port: ${SERVER_PORT:9002}
# 是否启用SSL(注意:该配置必须和server-port对应上)
ssl-enable: ${SSL_ENABLE:true}
# 客户端连接唯一凭证
license-key: ${LICENSE_KEY:2d45b54680d54726b1cfd183b0307c58}
license-key: ${LICENSE_KEY:}
# 客户端唯一身份标识(可忽略,若不设置首次启动会自动生成)
client-id: ${CLIENT_ID:}
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
@@ -51,3 +50,12 @@ neutrino:
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
transfer-log-enable: ${CLIENT_LOG:false}
enable: true
sshEnable: false
sshProxys[0]:
host:
username:
password:
localPort:
remotePort:
remoteHost: