Add ifcico to DNS query responses

This commit is contained in:
2023-10-05 15:23:49 +11:00
parent 0cabdcd3c1
commit 614d332fae
2 changed files with 16 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ use App\Models\{Address,Domain,Mailer};
/**
* Respond to DNS queries and provide addresses to FTN nodes.
* http://ftsc.org/docs/fts-5004.001
*
* This implementation doesnt support EDNS nor DNSSEC.
*
@@ -180,18 +181,23 @@ final class DNS extends BaseProtocol
// If this is a SRV record query
if ($this->query->type === self::DNS_TYPE_SRV) {
if ($labels->skip(1)->first() !== '_tcp')
return $this->reply(self::DNS_NAMEERR);
switch ($labels->first()) {
case '_binkp':
if ($labels->skip(1)->first() !== '_tcp')
return $this->reply(self::DNS_NAMEERR);
$labels->shift(2);
$mailer = Mailer::where('name','BINKP')->singleOrFail();
break;
case '_ifcico':
$mailer = Mailer::where('name','EMSI')->singleOrFail();
break;
default:
return $this->reply(self::DNS_NAMEERR);
}
$labels->shift(2);
}
// First check that it is a query we can answer
@@ -242,8 +248,8 @@ final class DNS extends BaseProtocol
return $this->reply(
self::DNS_NOERROR,
[serialize([
0,
0,
0, // priority
1, // weight
$xx->pivot->port,
$this->domain_split($ao->system->address),
]) => self::DNS_TYPE_SRV]);