Compare commits

...

2 Commits

Author SHA1 Message Date
Ed Robbins
40cd14bff0 If no SRV record found when no port specifiec, look for A record. (#125)
* If no SRV record found when no port specifiec, look for A record.

* update log statement to info level
2025-12-11 23:55:39 -05:00
Sam Machin
93095fcdab add ephemeral gateways for ip regtrunk (#124)
* add ephemeral gateways for ip regtrunk

* linting
2025-12-10 10:43:44 -05:00

View File

@@ -204,17 +204,32 @@ class Regbot {
}));
// for reg trunks, create ephemeral set of IP addresses for inbound gateways
if (this.trunk_type === 'reg' && !isValidIPv4(this.ipv4)) {
if (this.trunk_type === 'reg') {
this.addresses = [];
if (this.port) {
const addrs = await dnsResolverA(this.logger, this.ipv4);
this.addresses.push(...addrs);
if (isValidIPv4(this.ipv4)) {
this.addresses.push(this.ipv4);
}
else {
const addrs = await dnsResolverSrv(this.logger, this.ipv4, this.transport);
this.addresses.push(...addrs);
if (this.port) {
const addrs = await dnsResolverA(this.logger, this.ipv4);
this.addresses.push(...addrs);
}
else {
const addrs = await dnsResolverSrv(this.logger, this.ipv4, this.transport);
if (addrs.length) {
this.addresses.push(...addrs);
} else {
this.logger.info({ipv4: this.ipv4, transport: this.transport},
'No SRV addresses found for reg-gateway');
const addrsARecord = await dnsResolverA(this.logger, this.ipv4);
if (addrsARecord.length) {
this.addresses.push(...addrsARecord);
} else {
this.logger.info({ipv4: this.ipv4}, 'No A record found for reg-gateway');
}
}
}
}
if (this.addresses.length) {
try {
await Promise.all(