HTTP(S)代理端口检测,不配置则不支持HTTP(S)域名映射

This commit is contained in:
suxiang
2024-09-18 13:25:49 +08:00
parent b6224c42e7
commit fa5030277f
3 changed files with 8 additions and 6 deletions
@@ -1,8 +1,7 @@
package org.dromara.neutrinoproxy.server.proxy.enhance;
import cn.hutool.core.util.StrUtil;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.*;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
@@ -10,7 +9,6 @@ import io.netty.handler.logging.LoggingHandler;
import lombok.extern.slf4j.Slf4j;
import org.dromara.neutrinoproxy.server.base.proxy.ProxyConfig;
import org.dromara.neutrinoproxy.server.proxy.core.BytesMetricsHandler;
import org.dromara.neutrinoproxy.server.proxy.core.ProxyTunnelServer;
import org.dromara.neutrinoproxy.server.proxy.security.HttpVisitorSecurityChannelHandler;
import org.dromara.neutrinoproxy.server.proxy.security.VisitorFlowLimiterChannelHandler;
import org.noear.solon.annotation.Component;
@@ -31,7 +29,7 @@ public class HttpProxy implements EventListener<AppLoadEndEvent> {
@Override
public void onEvent(AppLoadEndEvent appLoadEndEvent) throws Throwable {
if (null == proxyConfig.getServer().getTcp().getHttpProxyPort()) {
log.info("no config domain name,nonsupport http proxy.");
log.info("no config http proxy port, nonsupport http proxy.");
return;
}
this.start();
@@ -33,6 +33,10 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
@Override
public void onEvent(AppLoadEndEvent appLoadEndEvent) {
if (null == proxyConfig.getServer().getTcp().getHttpsProxyPort()) {
log.info("no config https proxy port, nonsupport http proxy.");
return;
}
this.start();
}
@@ -54,9 +54,9 @@ neutrino:
# 线程池相关配置,用于技术调优,可忽略
boss-thread-count: 5
work-thread-count: 20
# http代理端口,默认80
# http代理端口,默认80(不配置不支持)
http-proxy-port: ${HTTP_PROXY_PORT:80}
# https代理端口,默认443 (需要配置域名、证书)
# https代理端口,默认443 不配置不支持,同时需要配置域名、证书)
https-proxy-port: ${HTTPS_PROXY_PORT:443}
# 是否开启代理服务报文日志(日志级别为debug时开启才有效)
transfer-log-enable: ${SERVER_LOG:false}