Commit fd4b9c7b authored by Michael Herold's avatar Michael Herold
Browse files

Adds support for NS, SSHFP and TXT records (#19)

parent 28a1508c
v0.6.0-unreleased
- Fixes missing unicode support for requests.
- [dns] Adds support for NS, SSHFP and TXT resource records
v0.5.0
- Fixes missing generation of global gettext .mo-files.
This fixes missing l10n in top bar also.
......
......@@ -35,7 +35,10 @@ class CustomCreate extends Window
'AAAA' => ['address'],
'CNAME' => ['cname'],
'MX' => ['priority', 'exchange'],
'SRV' => ['service', 'proto', 'priority', 'weight', 'port', 'target']
'NS' => ['nsdname'],
'SRV' => ['service', 'proto', 'priority', 'weight', 'port', 'target'],
'SSHFP' => ['algorithm', 'fptype', 'fingerprint'],
'TXT' => ['txtdata']
];
public function content($domain, $type)
......@@ -46,24 +49,30 @@ class CustomCreate extends Window
return $this->details($domain, $type);
}
protected function type($domain)
public static function types()
{
$window = $this->newWindow(
_('New Custom DNS Record')
, $domain, _('Create')
);
$types = [
return [
'A' => _('Host Address (IPv4)'),
'AAAA' => _('Host Address (IPv6)'),
'CNAME' => _('Canonical Name for an Alias'),
'MX' => _('Mail Exchange'),
'SRV' => _('Service Locator')
'NS' => _('Authoritative Name Server'),
'SRV' => _('Service Locator'),
'SSHFP' => _('SSH Fingerprint'),
'TXT' => _('Text String')
];
}
protected function type($domain)
{
$window = $this->newWindow(
_('New Custom DNS Record')
, $domain, _('Create')
);
$list = new gui\Listbox();
foreach ($types as $type => $desc)
foreach (self::types() as $type => $desc)
$list->addLinkEntry(
$this->request->derive(true, true, $type)
, new html\Str(sprintf('%s: %s', $type, $desc))
......@@ -124,9 +133,18 @@ class CustomCreate extends Window
case 'MX':
return $this->formMx($domain);
case 'NS':
return $this->formNs();
case 'SRV':
return $this->formSrv($domain);
case 'SSHFP':
return $this->formSshfp();
case 'TXT':
return $this->formTxt();
default:
throw new exception\Error(_('Unkown record type'));
}
......@@ -193,6 +211,14 @@ class CustomCreate extends Window
return $container;
}
protected function formNs()
{
$cname = new form\FieldText('nsdname', _('Authoritive Nameserver'));
$cname->setPlaceholder('ns1.example.com.');
return $cname;
}
protected function formSrv($domain)
{
$container = new form\Container();
......@@ -223,4 +249,36 @@ class CustomCreate extends Window
return $container;
}
protected function formSshfp()
{
$container = new form\Container();
$algorithm = new form\FieldSelect('algorithm', _('Algorithm'));
$algorithm->addOption('', '');
$algorithm->addOption('1', 'RSA');
$algorithm->addOption('2', 'DSS');
$fptype = new form\FieldSelect('fptype', _('Fingerprint Type'));
$fptype->addOption('', '');
$fptype->addOption('1', 'SHA-1');
$fptype->addOption('2', 'SHA-256');
$fptype->addOption('3', 'ECDSA');
$fingerprint = new form\FieldText('fingerprint', _('Fingerprint'));
$container[] = $algorithm;
$container[] = $fptype;
$container[] = $fingerprint;
return $container;
}
protected function formTxt()
{
$cname = new form\FieldText('txtdata', _('Text String'));
$cname->setPlaceholder('');
return $cname;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment