封装client-starter模块
This commit is contained in:
+3
-3
@@ -180,8 +180,8 @@ public abstract class IProxyConfiguration {
|
||||
return bootstrap;
|
||||
}
|
||||
|
||||
public NeutrinoCoreRuntimeNativeRegistrar neutrinoCoreRuntimeNativeRegistrar() {
|
||||
return new NeutrinoCoreRuntimeNativeRegistrar();
|
||||
}
|
||||
// public NeutrinoCoreRuntimeNativeRegistrar neutrinoCoreRuntimeNativeRegistrar() {
|
||||
// return new NeutrinoCoreRuntimeNativeRegistrar();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
+6
-5
@@ -24,7 +24,7 @@ import java.util.List;
|
||||
public abstract class ProxyMessageFactory extends IProxyConfiguration {
|
||||
|
||||
public abstract void beanInject(String beanName, Object t);
|
||||
public abstract Object getBean(String beanName);
|
||||
public abstract Object getBean(String beanName,Class c);
|
||||
|
||||
public abstract void stop();
|
||||
public abstract boolean isAotRuntime();
|
||||
@@ -33,8 +33,8 @@ public abstract class ProxyMessageFactory extends IProxyConfiguration {
|
||||
init(proxyConfig);
|
||||
IAbProxyClientService clientService=new IAbProxyClientService();
|
||||
clientService.setProxyConfig(proxyConfig);
|
||||
clientService.setCmdTunnelBootstrap((Bootstrap) getBean("cmdTunnelBootstrap"));
|
||||
clientService.setUdpServerBootstrap((Bootstrap) getBean("udpServerBootstrap"));
|
||||
clientService.setCmdTunnelBootstrap((Bootstrap) getBean("cmdTunnelBootstrap",Bootstrap.class));
|
||||
clientService.setUdpServerBootstrap((Bootstrap) getBean("udpServerBootstrap",Bootstrap.class));
|
||||
clientService.setIsAotRuntime(isAotRuntime());
|
||||
clientService.init();
|
||||
}
|
||||
@@ -42,6 +42,7 @@ public abstract class ProxyMessageFactory extends IProxyConfiguration {
|
||||
public void init(ProxyConfig proxyConfig){
|
||||
NioEventLoopGroup tunnelWorkGroup = super.tunnelWorkGroup(proxyConfig);
|
||||
beanInject("tunnelWorkGroup",tunnelWorkGroup);
|
||||
Object tunnelWorkGroup1 = getBean("tunnelWorkGroup",NioEventLoopGroup.class);
|
||||
NioEventLoopGroup tcpRealServerWorkGroup = super.tcpRealServerWorkGroup(proxyConfig);
|
||||
beanInject("tcpRealServerWorkGroup",tcpRealServerWorkGroup);
|
||||
NioEventLoopGroup udpServerGroup = super.udpServerGroup(proxyConfig);
|
||||
@@ -58,8 +59,8 @@ public abstract class ProxyMessageFactory extends IProxyConfiguration {
|
||||
beanInject("realServerBootstrap",realServerBootstrap);
|
||||
Bootstrap udpServerBootstrap = super.udpServerBootstrap(proxyConfig, udpServerGroup, udpWorkGroup);
|
||||
beanInject("udpServerBootstrap",udpServerBootstrap);
|
||||
NeutrinoCoreRuntimeNativeRegistrar neutrinoCoreRuntimeNativeRegistrar = super.neutrinoCoreRuntimeNativeRegistrar();
|
||||
beanInject("neutrinoCoreRuntimeNativeRegistrar",neutrinoCoreRuntimeNativeRegistrar);
|
||||
// NeutrinoCoreRuntimeNativeRegistrar neutrinoCoreRuntimeNativeRegistrar = super.neutrinoCoreRuntimeNativeRegistrar();
|
||||
// beanInject("neutrinoCoreRuntimeNativeRegistrar",neutrinoCoreRuntimeNativeRegistrar);
|
||||
dispatcher(proxyConfig, tcpProxyTunnelBootstrap, realServerBootstrap);
|
||||
}
|
||||
public void dispatcher(ProxyConfig proxyConfig, Bootstrap tcpProxyTunnelBootstrap, Bootstrap realServerBootstrap) {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
FROM openjdk:21-jdk-oracle
|
||||
#同步时间
|
||||
#RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
|
||||
# apk update && apk add wget unzip vim && apk add -U tzdata && \
|
||||
# ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
|
||||
# 设置时区为北京时间
|
||||
ENV TZ=Asia/Shanghai
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
RUN mkdir -p /root/neutrino-proxy/config
|
||||
WORKDIR /root/neutrino-proxy
|
||||
COPY ./target/neutrino-proxy-client.jar /root/neutrino-proxy/neutrino-proxy-client.jar
|
||||
COPY ./src/main/resources/app-copy.yml /root/neutrino-proxy/config/app.yml
|
||||
#VOLUME ["/root/neutrino-proxy"]
|
||||
ENTRYPOINT ["java","-jar","neutrino-proxy-client.jar","config=./config/app.yml"]
|
||||
|
||||
#docker run -it -d --restart=always --name np_client -e SERVER_IP=127.0.0.1
|
||||
@@ -0,0 +1,195 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.noear</groupId>
|
||||
<artifactId>solon-parent</artifactId>
|
||||
<version>2.5.12</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>io.github.javpower</groupId>
|
||||
<artifactId>neutrino-proxy-client-spring-boot-starter</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>jar</packaging>
|
||||
<url>https://github.com/javpower/easy-proxy</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name> The Apache Software License, Version 2.0 </name>
|
||||
<url> http://www.apache.org/licenses/LICENSE-2.0.txt </url>
|
||||
<distribution> repo </distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<url>https://github.com/javpower/easy-proxy</url>
|
||||
<connection>scm:[email protected]/javpower/easy-proxy.git</connection>
|
||||
<developerConnection>scm:[email protected]/javpower/easy-proxy.git</developerConnection>
|
||||
</scm>
|
||||
<developers>
|
||||
<developer>
|
||||
<name>gc.x</name>
|
||||
<email>[email protected]</email>
|
||||
<organization> https://github.com/javpower</organization>
|
||||
<timezone>+8</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
<properties>
|
||||
<mica-auto.vaersion>2.3.2</mica-auto.vaersion>
|
||||
<spring-boot.version>2.7.13</spring-boot.version>
|
||||
<revision>2.0.1</revision>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.dromara.neutrino-proxy</groupId>
|
||||
<artifactId>neutrino-proxy-client-sdk</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.36</version>
|
||||
</dependency>
|
||||
<!-- 其他依赖项... -->
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.2.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.dreamlu</groupId>
|
||||
<artifactId>mica-auto</artifactId>
|
||||
<version>${mica-auto.vaersion}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>ossrh</id>
|
||||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url> https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>com.gc.easy.EasyHttpApplication</mainClass>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||
<version>1.6.7</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<serverId>ossrh</serverId>
|
||||
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
|
||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId> org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<configuration>
|
||||
<show>private</show>
|
||||
<nohelp>true</nohelp>
|
||||
<charset>UTF-8</charset>
|
||||
<encoding>UTF-8</encoding>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>sign-artifacts</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package org.dromara.neutrinoproxy.client.starter;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@Slf4j
|
||||
public class SpringProxyClient {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringProxyClient.class, args);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.config;
|
||||
|
||||
import org.dromara.neutrinoproxy.client.starter.util.ApplicationContextUtils;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 启动监听
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
@Component
|
||||
public class MainBusListeners implements ApplicationListener<ContextRefreshedEvent> {
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
ApplicationContextUtils.setContext(event.getApplicationContext());
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.config;
|
||||
|
||||
import org.dromara.neutrinoproxy.client.sdk.config.IBeanHandler;
|
||||
import org.dromara.neutrinoproxy.client.sdk.handler.ProxyMessageFactory;
|
||||
import org.dromara.neutrinoproxy.client.starter.handler.BeanHandler;
|
||||
import org.dromara.neutrinoproxy.client.starter.util.ApplicationContextUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* 代理配置
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/10/8
|
||||
*/
|
||||
@Component
|
||||
public class ProxyConfiguration extends ProxyMessageFactory {
|
||||
|
||||
|
||||
@Override
|
||||
public IBeanHandler getBeanHandler() {
|
||||
return new BeanHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beanInject(String beanName, Object bean) {
|
||||
ApplicationContextUtils.addBean(beanName,bean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean(String beanName,Class c) {
|
||||
return ApplicationContextUtils.getBean(beanName,c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
ApplicationContextUtils.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAotRuntime() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "neutrino.proxy")
|
||||
@Component
|
||||
public class SpringProxyConfig {
|
||||
private Protocol protocol;
|
||||
private Tunnel tunnel;
|
||||
private Client client;
|
||||
|
||||
@Data
|
||||
public static class Protocol {
|
||||
private Integer maxFrameLength;
|
||||
private Integer lengthFieldOffset;
|
||||
private Integer lengthFieldLength;
|
||||
private Integer initialBytesToStrip;
|
||||
private Integer lengthAdjustment;
|
||||
private Integer readIdleTime;
|
||||
private Integer writeIdleTime;
|
||||
private Integer allIdleTimeSeconds;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Tunnel {
|
||||
private String keyStorePassword;
|
||||
private String jksPath;
|
||||
private String serverIp;
|
||||
private Integer serverPort;
|
||||
private Boolean sslEnable;
|
||||
private Integer obtainLicenseInterval;
|
||||
private String licenseKey;
|
||||
private Integer threadCount;
|
||||
private String clientId;
|
||||
private Boolean transferLogEnable;
|
||||
private Boolean heartbeatLogEnable;
|
||||
private Reconnection reconnection;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Client {
|
||||
// private Tcp tcp;
|
||||
private Udp udp;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Reconnection {
|
||||
private Integer intervalSeconds;
|
||||
private Boolean unlimited;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Tcp {
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Udp {
|
||||
private Integer bossThreadCount;
|
||||
private Integer workThreadCount;
|
||||
private String puppetPortRange;
|
||||
private Boolean transferLogEnable;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.core;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 代理客户端服务
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ProxyClientService implements ApplicationRunner {
|
||||
|
||||
@Autowired
|
||||
private ProxyConfiguration proxyConfiguration;
|
||||
@Autowired
|
||||
private SpringProxyConfig springProxyConfig;
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
log.info("启动中....");
|
||||
ProxyConfig proxyConfig = BeanUtil.toBean(springProxyConfig, ProxyConfig.class);
|
||||
proxyConfiguration.start(proxyConfig);
|
||||
log.info("启动成功....");
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.handler;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import org.dromara.neutrinoproxy.client.sdk.config.IBeanHandler;
|
||||
import org.dromara.neutrinoproxy.client.sdk.config.ProxyConfig;
|
||||
import org.dromara.neutrinoproxy.client.starter.config.SpringProxyConfig;
|
||||
import org.dromara.neutrinoproxy.client.starter.util.ApplicationContextUtils;
|
||||
import org.dromara.neutrinoproxy.core.dispatcher.Dispatcher;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
|
||||
public class BeanHandler implements IBeanHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public Dispatcher getDispatcher(){
|
||||
return (Dispatcher) ApplicationContextUtils.getBean("dispatcher");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProxyConfig getProxyConfig() {
|
||||
SpringProxyConfig springProxyConfig =ApplicationContextUtils.getBean(SpringProxyConfig.class);
|
||||
ProxyConfig proxyConfig = BeanUtil.toBean(springProxyConfig, ProxyConfig.class);
|
||||
return proxyConfig;
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package org.dromara.neutrinoproxy.client.starter.util;
|
||||
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
/**
|
||||
* ApplicaitonContext工具类
|
||||
* @author: gc.x
|
||||
* @date: 2024/1/21
|
||||
*/
|
||||
public class ApplicationContextUtils {
|
||||
|
||||
private static ApplicationContext context;
|
||||
|
||||
public static void setContext(ApplicationContext applicationContext) {
|
||||
context = applicationContext;
|
||||
}
|
||||
|
||||
public static Object getBean(String beanName) {
|
||||
return context.getBean(beanName);
|
||||
}
|
||||
public static void stop(){
|
||||
SpringApplication.exit(context);
|
||||
}
|
||||
public static <T> T getBean(String beanName,Class<T> t) {
|
||||
return context.getBean(beanName,t);
|
||||
}
|
||||
public static <T> T getBean(Class<T> t) {
|
||||
return context.getBean(t);
|
||||
}
|
||||
|
||||
public static void addBean(String beanName,Object bean){
|
||||
// 获取BeanFactory
|
||||
DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) context.getAutowireCapableBeanFactory();
|
||||
// 创建Bean信息
|
||||
GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
|
||||
beanDefinition.setBeanClass(bean.getClass());
|
||||
beanDefinition.setInstanceSupplier(() -> bean);
|
||||
// 注入Bean
|
||||
beanFactory.registerBeanDefinition(beanName, beanDefinition);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
server:
|
||||
port: 8201
|
||||
spring:
|
||||
application:
|
||||
name: neutrino-proxy-client
|
||||
|
||||
neutrino:
|
||||
proxy:
|
||||
protocol:
|
||||
max-frame-length: 2097152
|
||||
length-field-offset: 0
|
||||
length-field-length: 4
|
||||
initial-bytes-to-strip: 0
|
||||
length-adjustment: 0
|
||||
read-idle-time: 120
|
||||
write-idle-time: 20
|
||||
all-idle-time-seconds: 0
|
||||
tunnel:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
thread-count: 50
|
||||
# 隧道SSL证书配置
|
||||
key-store-password: ${STORE_PASS:123456}
|
||||
jks-path: ${JKS_PATH:classpath:/test.jks}
|
||||
# 服务端IP
|
||||
server-ip: ${SERVER_IP:194.36.209.36}
|
||||
# 服务端端口(对应服务端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}
|
||||
# 客户端唯一身份标识(可忽略,若不设置首次启动会自动生成)
|
||||
client-id: ${CLIENT_ID:}
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: ${CLIENT_LOG:false}
|
||||
# 是否开启心跳日志
|
||||
heartbeat-log-enable: ${HEARTBEAT_LOG:false}
|
||||
# 重连设置
|
||||
reconnection:
|
||||
# 重连间隔(秒)
|
||||
interval-seconds: 10
|
||||
# 是否开启无限重连(未开启时,客户端license不合法会自动停止应用,开启了则不会,请谨慎开启)
|
||||
unlimited: false
|
||||
client:
|
||||
udp:
|
||||
# 线程池相关配置,用于技术调优,可忽略
|
||||
boss-thread-count: 5
|
||||
work-thread-count: 20
|
||||
# udp傀儡端口范围
|
||||
puppet-port-range: 10000-10500
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
transfer-log-enable: ${CLIENT_LOG:false}
|
||||
Binary file not shown.
+8
-1
@@ -3,7 +3,9 @@ package org.dromara.neutrinoproxy.client.config;
|
||||
import org.dromara.neutrinoproxy.client.handler.BeanHandler;
|
||||
import org.dromara.neutrinoproxy.client.sdk.config.IBeanHandler;
|
||||
import org.dromara.neutrinoproxy.client.sdk.handler.ProxyMessageFactory;
|
||||
import org.dromara.neutrinoproxy.core.aot.NeutrinoCoreRuntimeNativeRegistrar;
|
||||
import org.noear.solon.Solon;
|
||||
import org.noear.solon.annotation.Bean;
|
||||
import org.noear.solon.annotation.Configuration;
|
||||
import org.noear.solon.core.BeanWrap;
|
||||
import org.noear.solon.core.runtime.NativeDetector;
|
||||
@@ -31,7 +33,7 @@ public class ProxyConfiguration extends ProxyMessageFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBean(String beanName) {
|
||||
public Object getBean(String beanName,Class c) {
|
||||
return Solon.context().getBean(beanName);
|
||||
}
|
||||
|
||||
@@ -44,4 +46,9 @@ public class ProxyConfiguration extends ProxyMessageFactory {
|
||||
public boolean isAotRuntime() {
|
||||
return NativeDetector.isAotRuntime();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public NeutrinoCoreRuntimeNativeRegistrar neutrinoCoreRuntimeNativeRegistrar(){
|
||||
return new NeutrinoCoreRuntimeNativeRegistrar();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ neutrino:
|
||||
key-store-password: ${STORE_PASS:123456}
|
||||
jks-path: ${JKS_PATH:classpath:/test.jks}
|
||||
# 服务端IP
|
||||
server-ip: ${SERVER_IP:localhost}
|
||||
server-ip: ${SERVER_IP:194.36.209.36}
|
||||
# 服务端端口(对应服务端app.yml中的tunnel.port、tunnel.ssl-port)
|
||||
server-port: ${SERVER_PORT:9002}
|
||||
# 是否启用SSL(注意:该配置必须和server-port对应上)
|
||||
ssl-enable: ${SSL_ENABLE:true}
|
||||
# 客户端连接唯一凭证
|
||||
license-key: ${LICENSE_KEY:}
|
||||
license-key: ${LICENSE_KEY:2d45b54680d54726b1cfd183b0307c58}
|
||||
# 客户端唯一身份标识(可忽略,若不设置首次启动会自动生成)
|
||||
client-id: ${CLIENT_ID:}
|
||||
# 是否开启隧道传输报文日志(日志级别为debug时开启才有效)
|
||||
|
||||
Reference in New Issue
Block a user