mirror of
https://github.com/fernwerker/ownDynDNS.git
synced 2025-07-13 23:15:43 +02:00
can create entries if not existing
This commit is contained in:
parent
49c53721c6
commit
7300eafd6f
3 changed files with 171 additions and 17 deletions
|
@ -39,6 +39,16 @@ final class Payload
|
|||
*/
|
||||
private $txt;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $host;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $create = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
|
@ -96,7 +106,30 @@ final class Payload
|
|||
*/
|
||||
public function getDomain()
|
||||
{
|
||||
return $this->domain;
|
||||
if (empty($this->host))
|
||||
{
|
||||
return $this->domain;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->host . "." . $this->domain;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHost()
|
||||
{
|
||||
if (!empty($this->host))
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
else
|
||||
{
|
||||
$domainParts = explode('.', $this->domain);
|
||||
return $domainParts[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -116,6 +149,35 @@ final class Payload
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getCreate()
|
||||
{
|
||||
return $this->create;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTypes()
|
||||
{
|
||||
$types = array();
|
||||
if ($this->getIpv4() && $this->isValidIpv4())
|
||||
{
|
||||
array_push($types, "A");
|
||||
}
|
||||
if ($this->getIpv6() && $this->isValidIpv6())
|
||||
{
|
||||
array_push($types, "AAAA");
|
||||
}
|
||||
if ($this->getTxt())
|
||||
{
|
||||
array_push($types, "TXT");
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* there is no good way to get the correct "registrable" Domain without external libs!
|
||||
*
|
||||
|
@ -133,7 +195,7 @@ final class Payload
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHostname()
|
||||
public function getDomainName()
|
||||
{
|
||||
// hack if top level domain are used for dynDNS
|
||||
if (1 === substr_count($this->domain, '.')) {
|
||||
|
@ -192,4 +254,13 @@ final class Payload
|
|||
{
|
||||
return $this->force;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
// TODO:
|
||||
return "A";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue