-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlookup.js
71 lines (71 loc) · 1.58 KB
/
lookup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
module.exports = {
name: "lookup",
ns: "dns",
title: "Lookup",
description: "Resolves a domain (e.g. 'google.com') into the first found A (IPv4) or AAAA (IPv6) record.",
phrases: {
active: "Looking up domain name {{input.domain}}"
},
ports: {
input: {
domain: {
type: "string",
format: "host",
title: "Domain",
description: "e.g. 'google.com'"
},
family: {
"enum": [4,
6
],
title: "Family",
description: "The family can be the integer 4 or 6. Defaults to null that indicates both Ip v4 and v6 address family.",
"default": null,
required: false
}
},
output: {
error: {
title: "error",
type: "object"
},
address: {
type: "string",
format: ["ipv4",
"ipv6"
],
title: "Address",
description: "The address is a string representation of a IP v4 or v6 address"
},
family: {
"enum": [4,
6
],
title: "Family",
description: "Denotes the family of the address"
}
}
},
dependencies: {
npm: {
dns: require('dns')
}
},
fn: function lookup(input, $, output, state, done, cb, on, dns) {
var r = function() {
dns.lookup($.domain, $.family, function lookupCallback(error, address, family) {
cb({
error: error,
address: address,
family: family
});
});
}.call(this);
return {
output: output,
state: state,
on: on,
return: r
};
}
}