]> git.lizzy.rs Git - hydra-dragonfire.git/blob - example/dump-traffic.lua
1fd43163049e6473c3b09d759008713c4b3af278
[hydra-dragonfire.git] / example / dump-traffic.lua
1 #!/usr/bin/env hydra-dragonfire
2 local address, name, password = unpack(arg)
3 local client = hydra.client(address)
4
5 client:enable("auth")
6 client.auth:username(name)
7 client.auth:password(password or "")
8
9 client:wildcard(true)
10 client:connect()
11
12 while not hydra.canceled() do
13         local pkt, interrupt = client:poll()
14
15         if pkt then
16                 print(pkt._type)
17                 for k, v in pairs(pkt) do
18                         if k ~= "_type" then
19                                 print("", k, v)
20                         end
21                 end
22         elseif not interrupt then
23                 print("disconnected")
24                 break   
25         end
26 end
27
28 client:disconnect()