|
@@ -8,6 +8,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.annotation.PostConstruct;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
@Getter
|
|
@Getter
|
|
@@ -21,6 +22,8 @@ public class TsiCvimServerConfig extends NettyServerConfig {
|
|
|
private int loggingWorkers = 0;
|
|
private int loggingWorkers = 0;
|
|
|
private int dbmsWorkers = 0;
|
|
private int dbmsWorkers = 0;
|
|
|
private boolean checkPacket = true;
|
|
private boolean checkPacket = true;
|
|
|
|
|
+ private List<String> whiteListIps = new ArrayList<>();
|
|
|
|
|
+ private Set<String> whiteListIpSet = new HashSet<>();
|
|
|
private boolean startup = false;
|
|
private boolean startup = false;
|
|
|
|
|
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
@@ -44,13 +47,28 @@ public class TsiCvimServerConfig extends NettyServerConfig {
|
|
|
setReaderIdleTimeSeconds(5);
|
|
setReaderIdleTimeSeconds(5);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ this.whiteListIpSet = getWhitelistIpSet();
|
|
|
|
|
+
|
|
|
log.info("[{}] -------------------------", this.getClass().getSimpleName());
|
|
log.info("[{}] -------------------------", this.getClass().getSimpleName());
|
|
|
log.info("[{}] serverId: {}", this.getClass().getSimpleName(), this.serverId);
|
|
log.info("[{}] serverId: {}", this.getClass().getSimpleName(), this.serverId);
|
|
|
log.info("[{}] packetWorkers: {}", this.getClass().getSimpleName(), this.packetWorkers);
|
|
log.info("[{}] packetWorkers: {}", this.getClass().getSimpleName(), this.packetWorkers);
|
|
|
log.info("[{}] loggingWorkers: {}", this.getClass().getSimpleName(), this.loggingWorkers);
|
|
log.info("[{}] loggingWorkers: {}", this.getClass().getSimpleName(), this.loggingWorkers);
|
|
|
log.info("[{}] dbmsWorkers: {}", this.getClass().getSimpleName(), this.dbmsWorkers);
|
|
log.info("[{}] dbmsWorkers: {}", this.getClass().getSimpleName(), this.dbmsWorkers);
|
|
|
log.info("[{}] checkPacket: {}", this.getClass().getSimpleName(), this.checkPacket);
|
|
log.info("[{}] checkPacket: {}", this.getClass().getSimpleName(), this.checkPacket);
|
|
|
|
|
+ log.info("[{}] whiteListIpSet: {}", this.getClass().getSimpleName(), this.whiteListIpSet);
|
|
|
log.info("{}", super.toString());
|
|
log.info("{}", super.toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public Set<String> getWhitelistIpSet() {
|
|
|
|
|
+ if (this.whiteListIps == null) {
|
|
|
|
|
+ return Collections.emptySet();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return new HashSet<>(this.whiteListIps);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public boolean isInWhitelistIps(String ip) {
|
|
|
|
|
+ return this.whiteListIpSet.contains(ip);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|