Project

General

Profile

$dns » History » Version 4

Per Amundsen, 02/16/2023 09:27 PM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*$dns(N)*
4
5
Returns the IP address that was resolved during a [[on DNS]] [[Scripting_Events|event]].
6
7 3 Per Amundsen
See also [[/dns]], [[on DNS]].
8 2 Per Amundsen
9 1 Per Amundsen
*Parameters*
10
11 4 Per Amundsen
table(ktable).
12
|*Parameter*|*Description*|
13
| N | If N = 0, returns number of associated IP addresses, otherwise the Nth IP address. |
14 1 Per Amundsen
15
*Properties*
16
17 4 Per Amundsen
table(ktable).
18
|*Property*|*Description*|
19
| .nick | Returns the nick if [[/dns]] was used on a nick. |
20
| .addr | Returns the resolved hostname. |
21
| .ip | Returns the resolved Ip address. |
22 1 Per Amundsen
23
*Example*
24
25
<pre>
26
; Lookup a nick
27
/dns nick
28
29
; Lookup a hostname
30
/dns google.com
31
32
; Lookup a IP address.
33
/dns 8.8.8.8
34
35
; Print the results from the lookups.
36
on *:DNS:{
37
var %n = $dns(0)
38
 echo 4 Found %n addresses
39
 while (%n > 0) {
40
   echo 4 dns: $dns(%n) nick: $dns(%n).nick addr: $dns(%n).addr ip: $dns(%n).ip
41
   dec %n
42
43
 }
44
}
45
</pre>