32 lines
528 B
Lua
32 lines
528 B
Lua
|
local dns = require "org.conman.dns"
|
||
|
|
||
|
e,err = dns.encode {
|
||
|
id = math.random(),
|
||
|
query = true,
|
||
|
rd = true,
|
||
|
opcode = 'query',
|
||
|
question = {
|
||
|
name = '_http._matrix.admins._tcp.marathon.mesos.',
|
||
|
type = 'SRV',
|
||
|
class = 'in'
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if e == nil then
|
||
|
print('error: ', err)
|
||
|
os.exit(2)
|
||
|
end
|
||
|
|
||
|
r,err = dns.query('10.15.56.154',e)
|
||
|
|
||
|
if r == nil then
|
||
|
print("error: ",err)
|
||
|
os.exit(2)
|
||
|
end
|
||
|
|
||
|
d = dns.decode(r)
|
||
|
|
||
|
for i = 1, #d.answers do
|
||
|
print(d.answers[i].target, d.answers[i].port)
|
||
|
end
|