nesser 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 268e527319ed6991bec2ba743f29b161cf759ef9
4
- data.tar.gz: 451ee70bbc0032ff146f19eaff3ab97b4dbe400c
3
+ metadata.gz: dc1d02c1db20cd839649b20cd8d066c6060afddc
4
+ data.tar.gz: 79ac270b89167dfa2e095a7909cad9ea4b7c04b2
5
5
  SHA512:
6
- metadata.gz: 29782f61da9adf57d73bc80aa750459abb02a5f74b654410793b6bf5637240da703b88f08affd3d31b0015e940fd64f62126c0c1246064c7e0dcb9b1c41abbb0
7
- data.tar.gz: af31ebdbce5c02e2f58a4804b4d400be0d0b9b52ebfdba45cf4e47590a2b433a1d7a44bf469f238de3eae3f6b0327bb6244fb4836ec64dd611446626cb6e5ba6
6
+ metadata.gz: a312b3dd971426587e3aeda68e0fe17a6437076b682e4d1910f41cb8a80656c7a95771c12471ce088c2c4111f56bf7e10fc86430c6effbd4f03376068bd9ccc4
7
+ data.tar.gz: 4371fb4c53dd8ce446b04eea6013527aa5572124763c387792395f54b922f20e01940bf3a8e5ef3cffafbdcc665ab9589889f7766be008465bab9e918046f4bc
data/README.md CHANGED
@@ -174,9 +174,14 @@ when necessary!
174
174
 
175
175
  ## Version history / changelog
176
176
 
177
- * 0.0.1 - Test deploy
178
- * 0.0.2 - Basically code complete
179
- * 0.0.3 - First actual release
177
+ * 0.0.1
178
+ ** Test deploy
179
+ * 0.0.2
180
+ ** Basically code complete
181
+ * 0.0.3
182
+ ** First actual release
180
183
  * 0.0.4
181
184
  ** Implement transaction.passthrough!()
182
185
  ** Fix a bug where numbers would cause a validation error in DNS names
186
+ * 0.0.5
187
+ ** Implement PTR records (reverse lookups)
@@ -24,3 +24,7 @@ result = Nesser::Nesser.query(s: s, hostname: 'google.com', type: Nesser::TYPE_A
24
24
 
25
25
  # Print the result
26
26
  puts result
27
+
28
+ # Perform a reverse query for 8.8.4.4 and print the result
29
+ result = Nesser::Nesser.query(s: s, hostname: '4.4.8.8.in-addr.arpa', type: Nesser::TYPE_PTR)
30
+ puts result
@@ -52,6 +52,8 @@ module Nesser
52
52
  rr = CNAME.unpack(unpacker)
53
53
  when TYPE_SOA
54
54
  rr = SOA.unpack(unpacker)
55
+ when TYPE_PTR
56
+ rr = PTR.unpack(unpacker)
55
57
  when TYPE_MX
56
58
  rr = MX.unpack(unpacker)
57
59
  when TYPE_TXT
@@ -71,6 +71,7 @@ module Nesser
71
71
  TYPE_NS = 0x0002
72
72
  TYPE_CNAME = 0x0005
73
73
  TYPE_SOA = 0x0006
74
+ TYPE_PTR = 0x000c
74
75
  TYPE_MX = 0x000f
75
76
  TYPE_TXT = 0x0010
76
77
  TYPE_AAAA = 0x001c
@@ -80,6 +81,7 @@ module Nesser
80
81
  TYPE_NS => "NS",
81
82
  TYPE_CNAME => "CNAME",
82
83
  TYPE_SOA => "SOA",
84
+ TYPE_PTR => "PTR",
83
85
  TYPE_MX => "MX",
84
86
  TYPE_TXT => "TXT",
85
87
  TYPE_AAAA => "AAAA",
@@ -78,7 +78,7 @@ module Nesser
78
78
  end
79
79
 
80
80
  def self.unpack(unpacker)
81
- # We don't really need the name for anything, so just discard it
81
+ # We don't really need the length for anything, so just discard it
82
82
  unpacker.unpack('n')
83
83
 
84
84
  return self.new(name: unpacker.unpack_name())
@@ -107,7 +107,7 @@ module Nesser
107
107
  end
108
108
 
109
109
  def self.unpack(unpacker)
110
- # We don't really need the name for anything, so just discard it
110
+ # We don't really need the length for anything, so just discard it
111
111
  unpacker.unpack('n')
112
112
 
113
113
  return self.new(name: unpacker.unpack_name())
@@ -177,6 +177,34 @@ module Nesser
177
177
  end
178
178
  end
179
179
 
180
+ ##
181
+ # PTR record - ie, reverse DNS
182
+ ##
183
+ class PTR
184
+ attr_accessor :name
185
+
186
+ def initialize(name:)
187
+ @name = name
188
+ end
189
+
190
+ def self.unpack(unpacker)
191
+ # We don't really need the length for anything, so just discard it
192
+ unpacker.unpack('n')
193
+
194
+ return self.new(name: unpacker.unpack_name())
195
+ end
196
+
197
+ def pack(packer)
198
+ length = packer.pack_name(@name, dry_run: true)
199
+ packer.pack('n', length)
200
+ packer.pack_name(@name)
201
+ end
202
+
203
+ def to_s()
204
+ return "#{@name} [PTR]"
205
+ end
206
+ end
207
+
180
208
  ##
181
209
  # Mail exchange record - eg, 'mail.google.com' 10.
182
210
  ##
@@ -1,3 +1,3 @@
1
1
  module Nesser
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nesser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - iagox86
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-10 00:00:00.000000000 Z
11
+ date: 2017-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler