Lookup both A and AAAA records for node FQDNs (#4398)
Allows IPv6 addresses to be used, instead of IPv4 being required. Closes <https://github.com/pterodactyl/panel/issues/4011>
This commit is contained in:
parent
815e1e4c4d
commit
7b91c38396
3 changed files with 17 additions and 3 deletions
|
@ -34,8 +34,12 @@ class NodeFormRequest extends AdminFormRequest
|
|||
public function withValidator($validator)
|
||||
{
|
||||
$validator->after(function ($validator) {
|
||||
// Check that the FQDN is a valid IP address.
|
||||
if (!filter_var(gethostbyname($this->input('fqdn')), FILTER_VALIDATE_IP)) {
|
||||
// Note, this function will also resolve CNAMEs for us automatically,
|
||||
// there is no need to manually resolve them here.
|
||||
//
|
||||
// Using @ as workaround to fix https://bugs.php.net/bug.php?id=73149
|
||||
$records = @dns_get_record($this->input('fqdn'), DNS_A + DNS_AAAA);
|
||||
if (empty($records)) {
|
||||
$validator->errors()->add('fqdn', trans('admin/node.validation.fqdn_not_resolvable'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue