Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- DNS Hook.
- By Mitchfizz05. Licensed under the GNU General Pubic License v3.
- ]]
- print("Hooking into the Rednet API...")
- if not dns then
- if fs.exists("dns") then
- os.loadAPI("dns")
- else
- print("DNS API not found!")
- return
- end
- end
- rawSend = rednet.send
- -- Override the send function.
- function rednet.send(id, msg, protocol)
- if type(id) == "string" then
- -- A hostname was given. Preform a DNS lookup.
- local resolvedID = dns.lookup(id)
- if id == nil then
- return false
- end
- -- We have the ID - pass it into the generic rednet function.
- rawSend(resolvedID, msg, protocol)
- return true
- else
- -- An ID was given. Use the generic rednet function.
- rawSend(id, msg, protocol)
- return true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement