resolv 0.3.0 → 0.4.0

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
  SHA256:
3
- metadata.gz: d76dc1156c60da694ce1f0a96165e6d5a7e29d662ad7140b443e9aa735082f31
4
- data.tar.gz: 7b532fc449aff2e5a63cb6a31892a45da5b41b6090d454f94d3c3e5165c94271
3
+ metadata.gz: 56680c64e918a60193f43e3ca4a7093db20bbe66f516da79a159d9a3c05860d8
4
+ data.tar.gz: f017a2c89fbcdf946b69ce57d41a67537b73f54ec6e99d18cc62865fd6ec1633
5
5
  SHA512:
6
- metadata.gz: 685ce620cc9c83f1d5827de0a374d71f98fbff7629256d2ab7ed65d66eee062a5bc081a869caba31aeb67b4c292ca6dfc53fa4d71180ce15dd82f39d6fb5992b
7
- data.tar.gz: 9897929fbfc67bc3a8133d3d9b2f99e7c9350802cf86d4cc0d8f061f397393f91308d6d1d6d35e46d497a3beb7fcf6424dc47ae92d5f7f39e572ac04b2677409
6
+ metadata.gz: d57f866a30bc2b8da6dbcdb8c65d0a5db4630af4ec0244aa490e37370ba7b27c3031e153e76055e7f4f63114bd477944326b05dbb7319f97bf59478f8518d76a
7
+ data.tar.gz: f07e85287b3bb9973c90900c1fbdc272e193d91493e63b407e696cc9f52de29fc0716f2ec11aba56d37d89a12b6d3fec55d21bd8ce756f02d56577940c454b06
@@ -15,7 +15,10 @@ jobs:
15
15
  strategy:
16
16
  matrix:
17
17
  ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
18
- os: [ ubuntu-latest, macos-latest ]
18
+ os: [ ubuntu-latest, macos-latest, windows-latest ]
19
+ include:
20
+ - ruby: mswin
21
+ os: windows-latest
19
22
  runs-on: ${{ matrix.os }}
20
23
  steps:
21
24
  - uses: actions/checkout@v4
data/lib/resolv.rb CHANGED
@@ -37,7 +37,7 @@ end
37
37
 
38
38
  class Resolv
39
39
 
40
- VERSION = "0.3.0"
40
+ VERSION = "0.4.0"
41
41
 
42
42
  ##
43
43
  # Looks up the first IP address for +name+.
@@ -194,17 +194,10 @@ class Resolv
194
194
  File.open(@filename, 'rb') {|f|
195
195
  f.each {|line|
196
196
  line.sub!(/#.*/, '')
197
- addr, hostname, *aliases = line.split(/\s+/)
197
+ addr, *hostnames = line.split(/\s+/)
198
198
  next unless addr
199
- @addr2name[addr] = [] unless @addr2name.include? addr
200
- @addr2name[addr] << hostname
201
- @addr2name[addr].concat(aliases)
202
- @name2addr[hostname] = [] unless @name2addr.include? hostname
203
- @name2addr[hostname] << addr
204
- aliases.each {|n|
205
- @name2addr[n] = [] unless @name2addr.include? n
206
- @name2addr[n] << addr
207
- }
199
+ (@addr2name[addr] ||= []).concat(hostnames)
200
+ hostnames.each {|hostname| (@name2addr[hostname] ||= []) << addr}
208
201
  }
209
202
  }
210
203
  @name2addr.each {|name, arr| arr.reverse!}
@@ -2544,8 +2537,70 @@ class Resolv
2544
2537
  TypeValue = 255 # :nodoc:
2545
2538
  end
2546
2539
 
2540
+ ##
2541
+ # CAA resource record defined in RFC 8659
2542
+ #
2543
+ # These records identify certificate authority allowed to issue
2544
+ # certificates for the given domain.
2545
+
2546
+ class CAA < Resource
2547
+ TypeValue = 257
2548
+
2549
+ ##
2550
+ # Creates a new CAA for +flags+, +tag+ and +value+.
2551
+
2552
+ def initialize(flags, tag, value)
2553
+ unless (0..255) === flags
2554
+ raise ArgumentError.new('flags must be an Integer between 0 and 255')
2555
+ end
2556
+ unless (1..15) === tag.bytesize
2557
+ raise ArgumentError.new('length of tag must be between 1 and 15')
2558
+ end
2559
+
2560
+ @flags = flags
2561
+ @tag = tag
2562
+ @value = value
2563
+ end
2564
+
2565
+ ##
2566
+ # Flags for this proprty:
2567
+ # - Bit 0 : 0 = not critical, 1 = critical
2568
+
2569
+ attr_reader :flags
2570
+
2571
+ ##
2572
+ # Property tag ("issue", "issuewild", "iodef"...).
2573
+
2574
+ attr_reader :tag
2575
+
2576
+ ##
2577
+ # Property value.
2578
+
2579
+ attr_reader :value
2580
+
2581
+ ##
2582
+ # Whether the critical flag is set on this property.
2583
+
2584
+ def critical?
2585
+ flags & 0x80 != 0
2586
+ end
2587
+
2588
+ def encode_rdata(msg) # :nodoc:
2589
+ msg.put_pack('C', @flags)
2590
+ msg.put_string(@tag)
2591
+ msg.put_bytes(@value)
2592
+ end
2593
+
2594
+ def self.decode_rdata(msg) # :nodoc:
2595
+ flags, = msg.get_unpack('C')
2596
+ tag = msg.get_string
2597
+ value = msg.get_bytes
2598
+ self.new flags, tag, value
2599
+ end
2600
+ end
2601
+
2547
2602
  ClassInsensitiveTypes = [ # :nodoc:
2548
- NS, CNAME, SOA, PTR, HINFO, MINFO, MX, TXT, LOC, ANY
2603
+ NS, CNAME, SOA, PTR, HINFO, MINFO, MX, TXT, LOC, ANY, CAA
2549
2604
  ]
2550
2605
 
2551
2606
  ##
@@ -2771,7 +2826,7 @@ class Resolv
2771
2826
  attr_reader :target
2772
2827
 
2773
2828
  ##
2774
- # The service paramters for the target host.
2829
+ # The service parameters for the target host.
2775
2830
 
2776
2831
  attr_reader :params
2777
2832
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resolv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanaka Akira
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-12-13 00:00:00.000000000 Z
10
+ date: 2024-03-19 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Thread-aware DNS resolver library in Ruby.
14
13
  email:
@@ -35,7 +34,6 @@ licenses:
35
34
  metadata:
36
35
  homepage_uri: https://github.com/ruby/resolv
37
36
  source_code_uri: https://github.com/ruby/resolv
38
- post_install_message:
39
37
  rdoc_options: []
40
38
  require_paths:
41
39
  - lib
@@ -50,8 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
48
  - !ruby/object:Gem::Version
51
49
  version: '0'
52
50
  requirements: []
53
- rubygems_version: 3.5.0.dev
54
- signing_key:
51
+ rubygems_version: 3.6.0.dev
55
52
  specification_version: 4
56
53
  summary: Thread-aware DNS resolver library in Ruby.
57
54
  test_files: []