$dns » History » Version 2
Per Amundsen, 11/14/2015 06:26 AM
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 | 2 | Per Amundsen | See also [[/dns]] [[on DNS]]. |
8 | |||
9 | 1 | Per Amundsen | *Parameters* |
10 | |||
11 | N - If N = 0, returns number of associated IP addresses, otherwise the Nth IP address. |
||
12 | |||
13 | *Properties* |
||
14 | |||
15 | .nick - Returns the nick if [[/dns]] was used on a nick. |
||
16 | .addr - Returns the resolved hostname. |
||
17 | .ip - Returns the resolved Ip address. |
||
18 | |||
19 | *Example* |
||
20 | |||
21 | <pre> |
||
22 | ; Lookup a nick |
||
23 | /dns nick |
||
24 | |||
25 | ; Lookup a hostname |
||
26 | /dns google.com |
||
27 | |||
28 | ; Lookup a IP address. |
||
29 | /dns 8.8.8.8 |
||
30 | |||
31 | ; Print the results from the lookups. |
||
32 | on *:DNS:{ |
||
33 | var %n = $dns(0) |
||
34 | echo 4 Found %n addresses |
||
35 | while (%n > 0) { |
||
36 | echo 4 dns: $dns(%n) nick: $dns(%n).nick addr: $dns(%n).addr ip: $dns(%n).ip |
||
37 | dec %n |
||
38 | |||
39 | } |
||
40 | } |
||
41 | </pre> |