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