Gateway group support server that have multi ip address

This commit is contained in:
hongqiaowei
2021-09-28 13:39:57 +08:00
parent a5a03c7aa2
commit 11947dec91
2 changed files with 38 additions and 25 deletions

View File

@@ -184,12 +184,14 @@ public class GatewayGroupService {
private void updateCurrentGatewayGroupSet(Set<String> currentGatewayGroupSet, Map<String,
GatewayGroup> gatewayGroupMap) {
String ip = NetworkUtils.getServerIp();
Set<String> ips = NetworkUtils.getServerIps();
String applicationName = environment.getProperty("spring.application.name");
currentGatewayGroupSet.clear();
gatewayGroupMap.forEach(
(k, gg) -> {
if (gg.gateways.contains(ip) || gg.gateways.contains(applicationName)) {
Set<String> set = new HashSet<>(ips);
set.retainAll(gg.gateways);
if (!set.isEmpty() || gg.gateways.contains(applicationName)) {
currentGatewayGroupSet.add(gg.group);
}
}