Skip to content

Commit c205794

Browse files
committed
Simplify address formatting in IPv4 header by removing unnecessary hex conversion
1 parent 8b092a7 commit c205794

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/redhound/header/ipv4.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def generate
3030
@protocol = @bytes[9]
3131
@check = @bytes[10..11]
3232
@saddr = @bytes[12..15]
33+
pp @saddr.class
3334
@daddr = @bytes[16..19]
3435
self
3536
end
@@ -101,11 +102,11 @@ def check
101102
end
102103

103104
def saddr
104-
@saddr.map { |b| b.to_s(16).rjust(2, '0') }.join('.')
105+
@saddr.join('.')
105106
end
106107

107108
def daddr
108-
@daddr.map { |b| b.to_s(16).rjust(2, '0') }.join('.')
109+
@daddr.join('.')
109110
end
110111
end
111112
end

0 commit comments

Comments
 (0)