mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-08 13:09:04 +08:00
Implement specify Port for DNS Monitor #1059
This commit should fully implement #1059. When the user selects the DNS monitor option, a new input box has been added below the resolver address allowing the user to implement the port to access the resolver on. This uses the same `monitor.port` as the TCP monitor but a monitor has been added to prefill the port value to the default of `53` if the value in this field has not already been set. This is then cleared if the user selects a different monitor type and has not changed the port value. A translation has also been added explaining what this field does in order to reduce any confusion. JSDoc documentation has also been added to the `dnsResolve` function in `util-server.js`. Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
@@ -89,9 +89,17 @@ exports.pingAsync = function (hostname, ipv6 = false) {
|
||||
});
|
||||
};
|
||||
|
||||
exports.dnsResolve = function (hostname, resolver_server, rrtype) {
|
||||
/**
|
||||
* Resolves a given record using the specified DNS server
|
||||
* @param {string} hostname The hostname of the record to lookup
|
||||
* @param {string} resolver_server The DNS server to use
|
||||
* @param {string} resolver_port The port the DNS server is listening on
|
||||
* @param {string} rrtype The type of record to request
|
||||
* @returns {Promise} Promise object represents DNS lookup result
|
||||
*/
|
||||
exports.dnsResolve = function (hostname, resolver_server, resolver_port, rrtype) {
|
||||
const resolver = new Resolver();
|
||||
resolver.setServers([resolver_server]);
|
||||
resolver.setServers([`${resolver_server}:${resolver_port}`]);
|
||||
return new Promise((resolve, reject) => {
|
||||
if (rrtype == "PTR") {
|
||||
resolver.reverse(hostname, (err, records) => {
|
||||
|
Reference in New Issue
Block a user