-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ilmanzo/ch_class
support for CH class
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#query local bind server version using CH class, TXT record | ||
|
||
require "../src/durian.cr" | ||
|
||
buffer = uninitialized UInt8[4096_i32] | ||
|
||
request = Durian::Packet::Request.new | ||
|
||
request.queries << Durian::Section::Question.new Durian::RecordFlag::TXT, "version.bind", Durian::Cls::CH | ||
|
||
_request = IO::Memory.new request.to_slice | ||
puts [:Request, Durian::Packet::Request.from_io _request] | ||
|
||
udp_socket = UDPSocket.new | ||
udp_socket.connect Socket::IPAddress.new "127.0.0.1", 53_i32 | ||
udp_socket.send _request.to_slice | ||
length, ip_address = udp_socket.receive buffer.to_slice | ||
|
||
_response = IO::Memory.new buffer.to_slice[0_i32, length] | ||
puts [:Response, Durian::Packet::Response.from_io _response] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters