OverviewFilesCommitsIssuesDocsReleasesPeers

hyperident-gateway commits / 91f9d4f

Fix: Include gateway IP in announcement protocol
Each gateway must announce its own IP address (10.22.0.1, 10.22.0.2) in addition to service IPs so peers can route packets to it. Changes: - GatewayIdentity: Add gatewayIP field and include in getOwnedIPs() - gateway.js: Pass virtualIP to GatewayIdentity constructor Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
91f9d4ff9c7cd0b2e800af4826b52ed0f2c3e5c3
by plankatron <fleeky@gmail.com> · 2026-01-17T18:13:41.000Z

Changed files (2) +8 -0

gateway.js +2 -0
……@@ -86,9 +86,11 @@ async function startGateway(config) {
8686 const gatewayIdentity = new GatewayIdentity({
8787 hyperidentPath: config.hyperident && config.hyperident.identityPath,
8888 subnet: config.gateway.subnet,
89 gatewayIP: config.gateway.virtualIP,
8990 staticMappings: config.staticMappings || {}
9091 })
9192 console.log(` Subnet: ${config.gateway.subnet}`)
93 console.log(` Gateway IP: ${config.gateway.virtualIP}`)
9294 console.log(` Static mappings: ${Object.keys(config.staticMappings || {}).length}\n`)
9395
9496 // Initialize ServiceRegistry
lib/gateway-identity.js +6 -0
……@@ -18,6 +18,7 @@ export class GatewayIdentity {
1818 this.subnet = config.subnet || '10.22.0.0/16'
1919 this.ipAssignmentStrategy = config.ipAssignmentStrategy || 'hash'
2020 this.staticMappings = config.staticMappings || {}
21 this.gatewayIP = config.gatewayIP || null // Store gateway's own IP
2122
2223 // Parse subnet
2324 const [network, cidr] = this.subnet.split('/')
……@@ -187,6 +188,11 @@ export class GatewayIdentity {
187188 getOwnedIPs() {
188189 const ips = []
189190
191 // Add gateway's own IP first
192 if (this.gatewayIP) {
193 ips.push(this.gatewayIP)
194 }
195
190196 // Add all service IPs
191197 for (const service of this.services.values()) {
192198 ips.push(service.ip)