| … | … | @@ -86,9 +86,11 @@ async function startGateway(config) { |
| 86 | 86 | const gatewayIdentity = new GatewayIdentity({ |
| 87 | 87 | hyperidentPath: config.hyperident && config.hyperident.identityPath, |
| 88 | 88 | subnet: config.gateway.subnet, |
| 89 | gatewayIP: config.gateway.virtualIP, | |
| 89 | 90 | staticMappings: config.staticMappings || {} |
| 90 | 91 | }) |
| 91 | 92 | console.log(` Subnet: ${config.gateway.subnet}`) |
| 93 | console.log(` Gateway IP: ${config.gateway.virtualIP}`) | |
| 92 | 94 | console.log(` Static mappings: ${Object.keys(config.staticMappings || {}).length}\n`) |
| 93 | 95 | |
| 94 | 96 | // Initialize ServiceRegistry |
| … | … | @@ -18,6 +18,7 @@ export class GatewayIdentity { |
| 18 | 18 | this.subnet = config.subnet || '10.22.0.0/16' |
| 19 | 19 | this.ipAssignmentStrategy = config.ipAssignmentStrategy || 'hash' |
| 20 | 20 | this.staticMappings = config.staticMappings || {} |
| 21 | this.gatewayIP = config.gatewayIP || null // Store gateway's own IP | |
| 21 | 22 | |
| 22 | 23 | // Parse subnet |
| 23 | 24 | const [network, cidr] = this.subnet.split('/') |
| … | … | @@ -187,6 +188,11 @@ export class GatewayIdentity { |
| 187 | 188 | getOwnedIPs() { |
| 188 | 189 | const ips = [] |
| 189 | 190 | |
| 191 | // Add gateway's own IP first | |
| 192 | if (this.gatewayIP) { | |
| 193 | ips.push(this.gatewayIP) | |
| 194 | } | |
| 195 | ||
| 190 | 196 | // Add all service IPs |
| 191 | 197 | for (const service of this.services.values()) { |
| 192 | 198 | ips.push(service.ip) |