feat(添加支持): 添加服务器对SSL密码参数支持
This commit is contained in:
parent
c8ae336116
commit
5c4dd0dcdd
|
|
@ -34,9 +34,11 @@ import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler;
|
||||||
import io.netty.handler.ssl.SslContext;
|
import io.netty.handler.ssl.SslContext;
|
||||||
import io.netty.handler.ssl.SslContextBuilder;
|
import io.netty.handler.ssl.SslContextBuilder;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.SSLException;
|
import javax.net.ssl.SSLException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
@ -56,7 +58,10 @@ public abstract class AbstractWebSocketServer {
|
||||||
* Should enable SSL
|
* Should enable SSL
|
||||||
*/
|
*/
|
||||||
boolean SslEnabled;
|
boolean SslEnabled;
|
||||||
|
/**
|
||||||
|
* SSL 密码
|
||||||
|
*/
|
||||||
|
String SslPassword;
|
||||||
/**
|
/**
|
||||||
* Cert File
|
* Cert File
|
||||||
*/
|
*/
|
||||||
|
|
@ -166,9 +171,19 @@ public abstract class AbstractWebSocketServer {
|
||||||
* @param keyFile 私钥文件
|
* @param keyFile 私钥文件
|
||||||
*/
|
*/
|
||||||
public void enableSSL(@NotNull File certFile, @NotNull File keyFile) {
|
public void enableSSL(@NotNull File certFile, @NotNull File keyFile) {
|
||||||
|
enableSSL(certFile, keyFile, null);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 启用SSL
|
||||||
|
* @param certFile 证书文件
|
||||||
|
* @param keyFile 私钥文件
|
||||||
|
* @param password ssl密码
|
||||||
|
*/
|
||||||
|
public void enableSSL(@NotNull File certFile, @NotNull File keyFile, @Nullable String password) {
|
||||||
this.SslEnabled = true;
|
this.SslEnabled = true;
|
||||||
this.CertFile = certFile;
|
this.CertFile = certFile;
|
||||||
this.KeyFile = keyFile;
|
this.KeyFile = keyFile;
|
||||||
|
this.SslPassword = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -210,7 +225,7 @@ public abstract class AbstractWebSocketServer {
|
||||||
ChannelPipeline pipeline = ch.pipeline();
|
ChannelPipeline pipeline = ch.pipeline();
|
||||||
// 根据配置启用 SSL
|
// 根据配置启用 SSL
|
||||||
if (SslEnabled) {
|
if (SslEnabled) {
|
||||||
SslContext sslCtx = SslContextBuilder.forServer(CertFile, KeyFile).build();
|
SslContext sslCtx = SslContextBuilder.forServer(CertFile, KeyFile, SslPassword).build();
|
||||||
pipeline.addFirst(sslCtx.newHandler(ch.alloc()));
|
pipeline.addFirst(sslCtx.newHandler(ch.alloc()));
|
||||||
}
|
}
|
||||||
pipeline.addLast(DgLab.LOGGING_HANDLER);
|
pipeline.addLast(DgLab.LOGGING_HANDLER);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ org.gradle.configuration-cache=true
|
||||||
org.gradle.configuration-cache.problems=warn
|
org.gradle.configuration-cache.problems=warn
|
||||||
# ROOT
|
# ROOT
|
||||||
project_name=DgLab
|
project_name=DgLab
|
||||||
project_version=4.2.10.18
|
project_version=4.2.11.18
|
||||||
project_group=top.r3944realms.dg_lab
|
project_group=top.r3944realms.dg_lab
|
||||||
|
|
||||||
# API
|
# API
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,15 @@
|
||||||
统一用4位版本,对于测试性更新统一在其后加-Beta。
|
统一用4位版本,对于测试性更新统一在其后加-Beta。
|
||||||
修复问题更新为加0.0.0.1,添加/移除新特性加0.0.1.0,小部分重构更新加0.1.0.0,大量重构加1.0.0.0
|
修复问题更新为加0.0.0.1,添加/移除新特性加0.0.1.0,小部分重构更新加0.1.0.0,大量重构加1.0.0.0
|
||||||
|
|
||||||
|
2025-09-21-4
|
||||||
|
project_version=4.2.11.18
|
||||||
|
* 添加服务器对SSL密码参数支持
|
||||||
|
|
||||||
2025-09-21-3
|
2025-09-21-3
|
||||||
project_version=4.2.10.18
|
project_version=4.2.10.18
|
||||||
* 添加ClientPowerBoxSharedData添加新字段 isEnableSsl,用于WS地址协议头判断
|
* 添加ClientPowerBoxSharedData添加新字段 isEnableSsl,用于WS地址协议头判断
|
||||||
* 让PowerBoxWSClient继承了父类的#enableSSL #disableSSL方法以适配添加ClientPowerBoxSharedData添加新字段的字段 isEnableSsl
|
* 让PowerBoxWSClient继承了父类的#enableSSL #disableSSL方法以适配添加ClientPowerBoxSharedData添加新字段的字段 isEnableSsl
|
||||||
|
|
||||||
|
|
||||||
2025-09-21-2
|
2025-09-21-2
|
||||||
project_version=4.2.10.17
|
project_version=4.2.10.17
|
||||||
* 修正 DGPBClientManager 的实现接口为com.r3944realms.dg_lab.api.manager.IDGLabManager
|
* 修正 DGPBClientManager 的实现接口为com.r3944realms.dg_lab.api.manager.IDGLabManager
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user