中文日志改为英文

This commit is contained in:
aoshiguchen
2023-09-19 12:56:42 +08:00
parent 67c362b423
commit 5578874df7
26 changed files with 84 additions and 85 deletions
@@ -58,7 +58,7 @@ public class ProxyClient {
logger.setLevel(level);
}
} catch (Exception e) {
log.error("日志级别设置失败", e);
log.error("logger level set failed", e);
}
}
}
@@ -35,7 +35,7 @@ public class ProxyConfiguration implements LifecycleBean {
@Override
public void start() throws Throwable {
List<ProxyMessageHandler> list = Solon.context().getBeansOfType(ProxyMessageHandler.class);
Dispatcher<ChannelHandlerContext, ProxyMessage> dispatcher = new DefaultDispatcher<>("消息调度器", list,
Dispatcher<ChannelHandlerContext, ProxyMessage> dispatcher = new DefaultDispatcher<>("MessageDispatcher", list,
proxyMessage -> ProxyDataTypeEnum.of((int)proxyMessage.getType()) == null ?
null : ProxyDataTypeEnum.of((int)proxyMessage.getType()).getName());
Solon.context().wrapAndPut(Dispatcher.class, dispatcher);
@@ -49,7 +49,7 @@ public class CmdChannelHandler extends SimpleChannelInboundHandler<ProxyMessage>
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
log.info("Client CmdChannel 与服务端断开连接");
log.info("Client CmdChannel disconnect");
ProxyUtil.setCmdChannel(null);
ProxyUtil.clearRealServerChannels();
@@ -69,14 +69,14 @@ public class CmdChannelHandler extends SimpleChannelInboundHandler<ProxyMessage>
switch (event.state()) {
case READER_IDLE:
// 读超时,断开连接
log.error("Client CmdChannel 读超时,断开连接");
log.error("[Client CmdChannel] Read timeout disconnect");
ctx.channel().close();
break;
case WRITER_IDLE:
ctx.channel().writeAndFlush(ProxyMessage.buildHeartbeatMessage());
break;
case ALL_IDLE:
log.error("Client CmdChannel 读写超时,断开连接");
log.error("[Client CmdChannel] ReadWrite timeout disconnect");
ctx.close();
break;
}
@@ -64,14 +64,14 @@ public class ProxyChannelHandler extends SimpleChannelInboundHandler<ProxyMessag
switch (event.state()) {
case READER_IDLE:
// 读超时,断开连接
// log.info("读超时");
// log.info("Read timeout");
// ctx.channel().close();
break;
case WRITER_IDLE:
ctx.channel().writeAndFlush(ProxyMessage.buildHeartbeatMessage());
break;
case ALL_IDLE:
log.debug("读写超时");
log.debug("ReadWrite timeout");
ctx.close();
break;
}
@@ -46,7 +46,7 @@ public class ProxyClientService {
this.start();
} catch (Exception e) {
// 启动连不上也做一下重连,因此先catch异常
log.error("[客户端指令隧道] 启动异常", e);
log.error("[CmdChannel] start error", e);
}
}
@@ -97,12 +97,12 @@ public class ProxyClientService {
// 连接成功,向服务器发送客户端认证信息(licenseKey)
ProxyUtil.setCmdChannel(future.channel());
future.channel().writeAndFlush(ProxyMessage.buildAuthMessage(proxyConfig.getTunnel().getLicenseKey(), ProxyUtil.getClientId()));
log.info("[客户端指令隧道] 连接代理服务成功. channelId:{}", future.channel().id().asLongText());
log.info("[CmdChannel] connect proxy server success. channelId:{}", future.channel().id().asLongText());
// reconnectServiceEnable = true;
reconnectCount = 0;
} else {
log.info("[客户端指令隧道] 连接代理服务失败!");
log.info("[CmdChannel] connect proxy server failed!");
}
}
}).sync();
@@ -116,11 +116,11 @@ public class ProxyClientService {
channel.close();
}
log.info("[客户端指令隧道] 客户端重连 seq:{}", ++reconnectCount);
log.info("[CmdChannel] client reconnect seq:{}", ++reconnectCount);
try {
connectProxyServer();
} catch (Exception e) {
log.error("[客户端指令隧道] 重连异常", e);
log.error("[CmdChannel] reconnect error", e);
}
}
}
@@ -29,7 +29,7 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
String info = proxyMessage.getInfo();
JSONObject data = JSONObject.parseObject(info);
Integer code = data.getInteger("code");
log.info("认证结果:{}", info);
log.info("Auth result:{}", info);
if (ExceptionEnum.AUTH_FAILED.getCode().equals(code)) {
// 客户端认证失败,直接停止服务
log.info("client auth failed , client stop.");
@@ -20,7 +20,7 @@ public class ProxyMessageErrorHandler implements ProxyMessageHandler {
@Override
public void handle(ChannelHandlerContext ctx, ProxyMessage proxyMessage) {
log.info("异常信息: {}", proxyMessage.getInfo());
log.info("error: {}", proxyMessage.getInfo());
JSONObject data = JSONObject.parseObject(proxyMessage.getInfo());
Integer code = data.getInteger("code");
if (ExceptionEnum.AUTH_FAILED.getCode().equals(code)) {
@@ -182,7 +182,7 @@ public class ProxyUtil {
return new SslHandler(sslEngine);
} catch (Exception e) {
log.error("创建SSL处理器失败", e);
log.error("create SSL handler failed", e);
e.printStackTrace();
}
return null;
@@ -33,11 +33,11 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ExceptionEnum {
SUCCESS(0, "成功"),
AUTH_FAILED(1, "认证失败"),
CONNECT_FAILED(2, "连接失败"),
SUCCESS(0, "success"),
AUTH_FAILED(1, "auth failed"),
CONNECT_FAILED(2, "connect failed"),
@Deprecated
LICENSE_CANNOT_REPEAT_CONNECT(3, "license不能多个客户端同时使用"),
LICENSE_CANNOT_REPEAT_CONNECT(3, "license cannot multiple client simultaneous use"),
;
private Integer code;
@@ -38,13 +38,13 @@ import java.util.stream.Stream;
@Getter
@AllArgsConstructor
public enum ProxyDataTypeEnum {
HEARTBEAT(0x01, Constants.ProxyDataTypeName.HEARTBEAT, "心跳"),
AUTH(0x02, Constants.ProxyDataTypeName.AUTH,"认证"),
CONNECT(0x03, Constants.ProxyDataTypeName.CONNECT,"连接"),
DISCONNECT(0x04, Constants.ProxyDataTypeName.DISCONNECT,"断开连接"),
TRANSFER(0x05, Constants.ProxyDataTypeName.TRANSFER,"数据传输"),
ERROR(0x06, Constants.ProxyDataTypeName.ERROR,"异常"),
PORT_MAPPING_SYNC(0x07, Constants.ProxyDataTypeName.PORT_MAPPING_SYNC, "端口映射同步");
HEARTBEAT(0x01, Constants.ProxyDataTypeName.HEARTBEAT, "HEARTBEAT"),
AUTH(0x02, Constants.ProxyDataTypeName.AUTH,"AUTH"),
CONNECT(0x03, Constants.ProxyDataTypeName.CONNECT,"CONNECT"),
DISCONNECT(0x04, Constants.ProxyDataTypeName.DISCONNECT,"DISCONNECT"),
TRANSFER(0x05, Constants.ProxyDataTypeName.TRANSFER,"TRANSFER"),
ERROR(0x06, Constants.ProxyDataTypeName.ERROR,"ERROR"),
PORT_MAPPING_SYNC(0x07, Constants.ProxyDataTypeName.PORT_MAPPING_SYNC, "PORT_MAPPING_SYNC");
private static Map<Integer,ProxyDataTypeEnum> cache = Stream.of(values()).collect(Collectors.toMap(ProxyDataTypeEnum::getType, Function.identity()));
private int type;
@@ -35,10 +35,10 @@ public class DefaultDispatcher<Context, Data> implements Dispatcher<Context, Dat
private Function<Data,String> matcher;
public DefaultDispatcher(String name, List<? extends Handler<Context,Data>> handlerList, Function<Data,String> matcher) {
Assert.notNull(name, "名称不能为空!");
Assert.notNull(matcher, "匹配器不能为空!");
Assert.notNull(name, "name cannot empty!");
Assert.notNull(matcher, "matcher cannot empty!");
if (CollectionUtil.isEmpty(handlerList)) {
log.error("{} 处理器列表为空.", name);
log.error("{} handler list empty.", name);
return;
}
this.name = name == null ? "" : name;
@@ -48,20 +48,20 @@ public class DefaultDispatcher<Context, Data> implements Dispatcher<Context, Dat
for (Handler handler : handlerList) {
Match match = handler.getClass().getAnnotation(Match.class);
if (null == match) {
log.warn("{} 类: {} 缺失Match注解", this.name, handler.getClass().getName());
log.warn("{} class: {} notfound Match annotation", this.name, handler.getClass().getName());
continue;
}
if (StrUtil.isEmpty(match.type())) {
log.warn("{} : {} match注解缺失type参数", this.name, handler.getClass().getName());
log.warn("{} class: {} match annotation notfound type param", this.name, handler.getClass().getName());
continue;
}
if (handlerMap.containsKey(match.type())) {
log.warn("{} : {} match注解type值{} 存在重复!", this.name, handler.getClass().getName(), match.type());
log.warn("{} class: {} match annotation type value {} repeat!", this.name, handler.getClass().getName(), match.type());
continue;
}
handlerMap.put(match.type(), handler);
}
log.info("{} 处理器初始化完成", this.name);
log.info("{} dispatcher init success", this.name);
}
@Override
@@ -71,19 +71,18 @@ public class DefaultDispatcher<Context, Data> implements Dispatcher<Context, Dat
}
String type = matcher.apply(data);
if (null == type) {
log.warn("{} 获取匹配类型失败 data:{}", this.name, JSONObject.toJSONString(data));
log.warn("{} get match type failed data:{}", this.name, JSONObject.toJSONString(data));
return;
}
Handler<Context,Data> handler = handlerMap.get(type);
if (null == handler) {
// log.debug("{} 找不到匹配的处理器 type:{}", this.name, type);
return;
}
String handlerName = handler.name();
if (StrUtil.isEmpty(handlerName)) {
handlerName = TypeUtil.getSimpleName(handler.getClass());
}
log.debug("{} 处理器[{}]执行.", this.name, handlerName);
log.debug("{} handler[{}]execute.", this.name, handlerName);
handler.handle(context, data);
}
}
@@ -46,7 +46,7 @@ public class ProxyServer {
logger.setLevel(level);
}
} catch (Exception e) {
log.error("日志级别设置失败", e);
log.error("logger level set failed", e);
}
}
}
@@ -57,7 +57,7 @@ public class DBInitialize implements EventListener<AppLoadEndEvent> {
dbTypeEnum = DbTypeEnum.of(dbConfig.getType());
Assert.notNull(dbTypeEnum, "neutrino.data.db.type取值异常!");
log.info("{}数据库初始化...", dbConfig.getType());
log.info("{} database init...", dbConfig.getType());
initDBStructure();
initDBData();
}
@@ -82,7 +82,7 @@ public class DBInitialize implements EventListener<AppLoadEndEvent> {
}
sql += "\r\n" + line.trim();
if (sql.endsWith(";")) {
log.debug("初始化数据库表 sql:{}", sql);
log.debug("init database table sql:{}", sql);
Db.update(sql);
sql = "";
}
@@ -116,7 +116,7 @@ public class DBInitialize implements EventListener<AppLoadEndEvent> {
}
sql += "\r\n" + line.trim();
if (sql.endsWith(";")) {
log.debug("初始化数据[table={}] sql:{}", tableName, sql);
log.debug("init database data[table={}] sql:{}", tableName, sql);
Db.update(sql);
sql = "";
}
@@ -38,7 +38,7 @@ public class ProxyConfiguration implements LifecycleBean {
@Override
public void start() throws Throwable {
List<ProxyMessageHandler> list = Solon.context().getBeansOfType(ProxyMessageHandler.class);
Dispatcher<ChannelHandlerContext, ProxyMessage> dispatcher = new DefaultDispatcher<>("消息调度器", list,
Dispatcher<ChannelHandlerContext, ProxyMessage> dispatcher = new DefaultDispatcher<>("MessageDispatcher", list,
proxyMessage -> ProxyDataTypeEnum.of((int)proxyMessage.getType()) == null ?
null : ProxyDataTypeEnum.of((int)proxyMessage.getType()).getName());
@@ -74,7 +74,7 @@ public class BaseAuthInterceptor implements RouterInterceptor {
}
if (result instanceof Throwable) {
log.error("全局异常", (Throwable) result);
log.error("global error", (Throwable) result);
if (result instanceof ServiceException) {
ServiceException exception = (ServiceException) result;
@@ -23,7 +23,7 @@ public class GlobalExceptionFilter implements Filter {
try {
chain.doFilter(ctx);
} catch (Throwable e) {
log.error("全局异常", e);
log.error("global error", e);
if (e instanceof ServiceException) {
ServiceException serviceException = (ServiceException) e;
@@ -31,7 +31,7 @@ public class VisitLogInterceptor implements RouterInterceptor {
} finally {
Date now = new Date();
long elapsedTime = now.getTime() - startTime.getTime();
log.debug("\n-----------------------------------------------------------------接口请求日志\n{} url:{} 执行耗时:{}\n请求体参数:{}\n响应结果:{}\n客户端IP:{}\n",
log.debug("\n-----------------------------------------------------------------interface request log\n{} url:{} elapsed time:{}\nrequest:{}\nresponse:{}\nclient ip:{}\n",
ctx.method(), ctx.path(), getElapsedTimeStr(elapsedTime),
JSONObject.toJSONString(ctx.paramMap()),
JSONObject.toJSONString(JSONObject.toJSONString(ctx.result)),
@@ -47,11 +47,11 @@ public class VisitLogInterceptor implements RouterInterceptor {
*/
private static String getElapsedTimeStr(long elapsedTime) {
if (elapsedTime < 1000) {
return String.format("%s毫秒", elapsedTime);
return String.format("%sms", elapsedTime);
} else if (elapsedTime < 60000) {
return String.format("%.2f", (elapsedTime * 1.0) / 1000);
return String.format("%.2fs", (elapsedTime * 1.0) / 1000);
}
return String.format("%.2f分钟", (elapsedTime * 1.0) / 1000 / 60);
return String.format("%.2fm", (elapsedTime * 1.0) / 1000 / 60);
}
}
@@ -70,37 +70,37 @@ public class DataCleanJob implements IJobHandler {
{
Date date = DateUtil.addDate(new Date(), Calendar.DATE, -1 * jobParams.getJobLogKeepDays());
log.info("清理调度管理日志 date:{}", sdf.format(date));
log.info("clean job log date:{}", sdf.format(date));
jobLogMapper.clean(date);
}
{
Date date = DateUtil.addDate(new Date(), Calendar.DATE, -1 * jobParams.getUserLoginRecordKeepDays());
log.info("清理用户登录日志 date:{}", sdf.format(date));
log.info("clean user login record date:{}", sdf.format(date));
userLoginRecordMapper.clean(date);
}
{
Date date = DateUtil.addDate(new Date(), Calendar.DATE, -1 * jobParams.getClientConnectRecordKeepDays());
log.info("清理客户端连接日志 date:{}", sdf.format(date));
log.info("clean client connect record date:{}", sdf.format(date));
clientConnectRecordMapper.clean(date);
}
{
Date date = DateUtil.addDate(new Date(), Calendar.DATE, -1 * jobParams.getFlowMinuteReportKeepDays());
log.info("清理流通统计分钟报表日志 date:{}", sdf.format(date));
log.info("clean flow report minute record date:{}", sdf.format(date));
flowReportMinuteMapper.clean(date);
}
{
Date date = DateUtil.addDate(new Date(), Calendar.DATE, -1 * jobParams.getFlowHourReportKeepDays());
log.info("清理流通统计小时报表日志 date:{}", sdf.format(date));
log.info("clean flow report hour record date:{}", sdf.format(date));
flowReportHourMapper.clean(date);
}
{
Date date = DateUtil.addDate(new Date(), Calendar.DATE, -1 * jobParams.getFlowDayReportKeepDays());
log.info("清理流通统计日报表日志 date:{}", sdf.format(date));
log.info("clean flow report day record date:{}", sdf.format(date));
flowReportDayMapper.clean(date);
}
}
@@ -136,7 +136,7 @@ public class ProxyTunnelChannelHandler extends SimpleChannelInboundHandler<Proxy
switch (event.state()) {
case READER_IDLE:
// 读超时,断开连接
log.debug("读超时");
log.debug("Read timeout");
ctx.channel().close();
break;
case WRITER_IDLE:
@@ -59,9 +59,9 @@ public class ProxyTunnelServer implements EventListener<AppLoadEndEvent> {
});
try {
bootstrap.bind(proxyConfig.getTunnel().getPort()).sync();
log.info("代理服务启动,端口{}", proxyConfig.getTunnel().getPort());
log.info("proxy server startedport{}", proxyConfig.getTunnel().getPort());
} catch (Exception e) {
log.error("代理服务异常", e);
log.error("proxy server error", e);
}
}
@@ -80,9 +80,9 @@ public class ProxyTunnelServer implements EventListener<AppLoadEndEvent> {
});
try {
bootstrap.bind(proxyConfig.getTunnel().getSslPort()).sync();
log.info("代理服务启动,SSL端口 {}", proxyConfig.getTunnel().getSslPort());
log.info("proxy server startedSSL port {}", proxyConfig.getTunnel().getSslPort());
} catch (Exception e) {
log.error("代理服务异常", e);
log.error("proxy server error", e);
}
}
@@ -105,7 +105,7 @@ public class ProxyTunnelServer implements EventListener<AppLoadEndEvent> {
return new SslHandler(sslEngine);
} catch (Exception e) {
log.error("创建SSL处理器失败", e);
log.error("create SSL handler error", e);
e.printStackTrace();
}
return null;
@@ -50,7 +50,7 @@ public class HttpProxy implements EventListener<AppLoadEndEvent> {
}
});
bootstrap.bind("0.0.0.0", proxyConfig.getServer().getTcp().getHttpProxyPort()).sync();
log.info("Http代理服务启动成功port:{}", proxyConfig.getServer().getTcp().getHttpProxyPort());
log.info("Http proxy server start successport:{}", proxyConfig.getServer().getTcp().getHttpProxyPort());
} catch (Exception e) {
log.error("http proxy start err!", e);
}
@@ -59,7 +59,7 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
}
});
bootstrap.bind("0.0.0.0", proxyConfig.getServer().getTcp().getHttpsProxyPort()).sync();
log.info("Https代理服务启动成功port:{}", proxyConfig.getServer().getTcp().getHttpsProxyPort());
log.info("Https proxy server startedport:{}", proxyConfig.getServer().getTcp().getHttpsProxyPort());
} catch (Exception e) {
log.error("https proxy start err!", e);
}
@@ -84,7 +84,7 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
return new SslHandler(sslEngine);
} catch (Exception e) {
log.error("创建SSL处理器失败", e);
log.error("create SSL handler failed", e);
e.printStackTrace();
}
return null;
@@ -89,7 +89,7 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
}
if (StrUtil.isEmpty(licenseKey)) {
log.warn("[客户端连接] license不能为空 info:{} ", info);
log.warn("[client connection] license cannot empty info:{} ", info);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license不能为空!", licenseKey));
ctx.channel().close();
clientConnectRecordService.add(new ClientConnectRecordDO()
@@ -97,14 +97,14 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
.setType(ClientConnectTypeEnum.CONNECT.getType())
.setMsg(licenseKey)
.setCode(SuccessCodeEnum.FAIL.getCode())
.setErr("license不能为空!")
.setErr("license cannot empty!")
.setCreateTime(now)
);
return;
}
LicenseDO licenseDO = licenseService.findByKey(licenseKey);
if (null == licenseDO) {
log.warn("[客户端连接] license不存在 info:{} ", info);
log.warn("[client connection] license notfound info:{} ", info);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "license不存在!", licenseKey));
ctx.channel().close();
clientConnectRecordService.add(new ClientConnectRecordDO()
@@ -112,14 +112,14 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
.setType(ClientConnectTypeEnum.CONNECT.getType())
.setMsg(licenseKey)
.setCode(SuccessCodeEnum.FAIL.getCode())
.setErr("license不存在!")
.setErr("license notfound!")
.setCreateTime(now)
);
return;
}
if (EnableStatusEnum.DISABLE.getStatus().equals(licenseDO.getEnable())) {
log.warn("[客户端连接] 当前license已被禁用 info:{} ", info);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "当前license已被禁用!", licenseKey));
log.warn("[client connection] the license disabled info:{} ", info);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "the license disabled!", licenseKey));
ctx.channel().close();
clientConnectRecordService.add(new ClientConnectRecordDO()
.setIp(ip)
@@ -127,14 +127,14 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
.setType(ClientConnectTypeEnum.CONNECT.getType())
.setMsg(licenseKey)
.setCode(SuccessCodeEnum.FAIL.getCode())
.setErr("当前license已被禁用!")
.setErr("the license disabled!")
.setCreateTime(now));
return;
}
UserDO userDO = userService.findById(licenseDO.getUserId());
if (null == userDO || EnableStatusEnum.DISABLE.getStatus().equals(userDO.getEnable())) {
log.warn("[客户端连接] 当前license无效 info:{} ", info);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "当前license无效!", licenseKey));
log.warn("[client connection] the license invalid info:{} ", info);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "the license invalid!", licenseKey));
ctx.channel().close();
clientConnectRecordService.add(new ClientConnectRecordDO()
.setIp(ip)
@@ -142,7 +142,7 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
.setType(ClientConnectTypeEnum.CONNECT.getType())
.setMsg(licenseKey)
.setCode(SuccessCodeEnum.FAIL.getCode())
.setErr("当前license无效!")
.setErr("the license invalid!")
.setCreateTime(now));
return;
}
@@ -150,8 +150,8 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
if (null != cmdChannel) {
String _clientId = ProxyUtil.getClientIdByLicenseId(licenseDO.getId());
if (!clientId.equals(_clientId)) {
log.warn("[客户端连接] 当前license已被另一节点使用 info:{} _clientId:{}", info, _clientId);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "当前license已被另一节点使用!", licenseKey));
log.warn("[client connection] the license on another no used info:{} _clientId:{}", info, _clientId);
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.AUTH_FAILED.getCode(), "the license on another no used!", licenseKey));
ctx.channel().close();
clientConnectRecordService.add(new ClientConnectRecordDO()
.setIp(ip)
@@ -159,13 +159,13 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
.setType(ClientConnectTypeEnum.CONNECT.getType())
.setMsg(licenseKey)
.setCode(SuccessCodeEnum.FAIL.getCode())
.setErr("当前license已被另一节点使用!")
.setErr("the license on another no used!")
.setCreateTime(now));
return;
}
}
// 发送认证成功消息
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.SUCCESS.getCode(), "认证成功!", licenseKey));
ctx.channel().writeAndFlush(ProxyMessage.buildAuthResultMessage(ExceptionEnum.SUCCESS.getCode(), "auth success!", licenseKey));
clientConnectRecordService.add(new ClientConnectRecordDO()
.setIp(ip)
@@ -178,7 +178,7 @@ public class ProxyMessageAuthHandler implements ProxyMessageHandler {
// 设置当前licenseId对应的客户端ID
ProxyUtil.setLicenseIdToClientIdMap(licenseDO.getId(), clientId);
log.warn("[客户端连接] 认证成功 info:{} ", info);
log.warn("[client connection] auth success info:{} ", info);
// 更新license在线状态
licenseMapper.updateOnlineStatus(licenseDO.getId(), OnlineStatusEnum.ONLINE.getStatus(), now);
@@ -60,11 +60,11 @@ public class JobLogService implements IJobCallback {
Integer code = 0;
String msg = "";
if (null == throwable) {
msg = "执行成功";
log.debug("job[id={},name={}]执行完毕", jobInfo.getId(), jobInfo.getName());
msg = "execute success";
log.debug("job[id={},name={}]execute success", jobInfo.getId(), jobInfo.getName());
} else {
log.error("job[id={},name={}]执行异常", jobInfo.getId(), jobInfo.getName(), throwable);
msg = "执行异常:\r\n" + ExceptionUtils.getStackTrace(throwable);
log.error("job[id={},name={}]execute error", jobInfo.getId(), jobInfo.getName(), throwable);
msg = "execute error:\r\n" + ExceptionUtils.getStackTrace(throwable);
code = -1;
}
jobLogMapper.insert(new JobLogDO()
@@ -53,7 +53,7 @@ public class ProxyMutualService {
Date now = new Date();
portMappingMapper.updateOnlineStatus(attachInfo.getLicenseId(), serverPort, OnlineStatusEnum.ONLINE.getStatus(), now);
licenseMapper.updateOnlineStatus(attachInfo.getLicenseId(), OnlineStatusEnum.ONLINE.getStatus(), now);
log.info("绑定服务端端口 licenseId:{},ip:{},serverPort:{}", attachInfo.getLicenseId(), attachInfo.getIp(), serverPort);
log.info("bind server port licenseId:{},ip:{},serverPort:{}", attachInfo.getLicenseId(), attachInfo.getIp(), serverPort);
}
/**
@@ -64,7 +64,7 @@ public class ProxyMutualService {
Date now = new Date();
portMappingMapper.updateOnlineStatus(attachInfo.getLicenseId(), OnlineStatusEnum.OFFLINE.getStatus(), now);
licenseMapper.updateOnlineStatus(attachInfo.getLicenseId(), OnlineStatusEnum.OFFLINE.getStatus(), now);
log.info("客户端下线 licenseId:{},ip:{}", attachInfo.getLicenseId(), attachInfo.getIp());
log.info("client offline licenseId:{},ip:{}", attachInfo.getLicenseId(), attachInfo.getIp());
}
}
@@ -232,10 +232,10 @@ public class VisitorChannelService {
NetworkProtocolEnum networkProtocolEnum = NetworkProtocolEnum.of(portMapping.getProtocal());
if (networkProtocolEnum == NetworkProtocolEnum.UDP) {
udpServerBootstrap.bind(portMapping.getServerPort()).get();
log.info("绑定UDP用户端口 {}", portMapping.getServerPort());
log.info("bind UDP user port {}", portMapping.getServerPort());
} else {
tcpServerBootstrap.bind(portMapping.getServerPort()).get();
log.info("绑定TCP用户端口 {}", portMapping.getServerPort());
log.info("bind TCP user port {}", portMapping.getServerPort());
}
} catch (Exception ex) {
// BindException表示该端口已经绑定过