Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mamantoha committed Jun 27, 2024
1 parent 6e4597c commit 314e1b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/resolv.cr
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ module Resolv
end
end

# Extracts a domain name from the DNS response message starting at the specified offset.
# Returns a Tuple containing the extracted domain name and the new offset position after the name.
private def extract_name(response : Bytes, offset : Int32) : Tuple(String, Int32)
name = ""

Expand Down Expand Up @@ -244,7 +246,7 @@ module Resolv
private def extract_a_records(response : Bytes) : Array(String)
records = extract_records(response, :a)

records.map do |_record_data, offset|
records.map do |_, offset|
[response[offset], response[offset + 1], response[offset + 2], response[offset + 3]].join('.')
end
end
Expand Down

0 comments on commit 314e1b3

Please sign in to comment.