dmarcator 0.10.0 → 0.11.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 +4 -4
- data/ChangeLog.md +6 -0
- data/README.md +25 -0
- data/lib/dmarcator/config.rb +66 -0
- data/lib/dmarcator/query.rb +11 -2
- data/lib/dmarcator/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 689cd037f395f7803f4157fd148305f1d9d6c3dbb19fd42b61311b8e37d57124
|
|
4
|
+
data.tar.gz: 80518a23a140cb7102cb4d20a5fa896852ca8b104a3047939bcf4ba018e89699
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3b5f59702e05d0ffeeec17c9c3e7f8c1bd078448ba029fd4cf6bc8e6cbd8107dbda2e3633c228d1706f09832023a8a64b9806d6ee843b1fe13d449b19379e0c
|
|
7
|
+
data.tar.gz: de98c5111a0eb8023fa10807c7227d18bead12e17f2f43d084d8c5e3d27a2b1a4e86212c0c075fa2e75a97e5710e738de2baad45b833c31249d54a1abec80bb2
|
data/ChangeLog.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
### 0.11.0 / 2026-10-29
|
|
2
|
+
|
|
3
|
+
* Add `DMARCator.configure` for process-wide defaults, so a resolver can be set from code instead of only through the `DMARCATOR_DNS` environment variables. A configured resolver takes precedence over the environment, and `DMARCator.reset_configuration!` discards it.
|
|
4
|
+
* A configured resolver may be a callable, in which case it is invoked for each lookup. This lets threaded applications use one resolver per lookup instead of sharing a `Resolv::DNS`, which does not serialise concurrent lookups.
|
|
5
|
+
* Run CI on macOS 15 as well as Ubuntu 24.04, covering the Socket/OpenSSL and Net::HTTP paths used by the DoT and DoH transports.
|
|
6
|
+
|
|
1
7
|
### 0.10.0 / 2026-10-29
|
|
2
8
|
|
|
3
9
|
Breaking changes, taken before 1.0 so the release does not carry them:
|
data/README.md
CHANGED
|
@@ -193,6 +193,31 @@ helper returning "the" record would hide exactly those conditions. DKIM is also
|
|
|
193
193
|
per-selector and selectors cannot be enumerated, so any convenience method would
|
|
194
194
|
have to take a selector and would only build the name above.
|
|
195
195
|
|
|
196
|
+
## Configuration
|
|
197
|
+
|
|
198
|
+
Process-wide defaults can be set from code, and take precedence over the
|
|
199
|
+
`DMARCATOR_DNS` environment variables:
|
|
200
|
+
|
|
201
|
+
```ruby
|
|
202
|
+
DMARCator.configure do |config|
|
|
203
|
+
config.resolver = DMARCator::Resolver::DoH.new(url: "https://dns.example/dns-query")
|
|
204
|
+
end
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
A resolver object is shared by every thread, and `Resolv::DNS` does not
|
|
208
|
+
serialise concurrent lookups, so threaded applications should configure a
|
|
209
|
+
factory instead:
|
|
210
|
+
|
|
211
|
+
```ruby
|
|
212
|
+
DMARCator.configure do |config|
|
|
213
|
+
config.resolver = -> { Resolv::DNS.new }
|
|
214
|
+
end
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`DMARCator.reset_configuration!` discards configured values, which is useful in
|
|
218
|
+
tests. Passing `resolver:` to a lookup still overrides both the configured
|
|
219
|
+
default and the environment.
|
|
220
|
+
|
|
196
221
|
## Strict parsing
|
|
197
222
|
|
|
198
223
|
By default, unknown tags and tags with invalid values are ignored. Pass
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module DMARCator
|
|
4
|
+
#
|
|
5
|
+
# Process-wide defaults.
|
|
6
|
+
#
|
|
7
|
+
# @since 0.11.0
|
|
8
|
+
#
|
|
9
|
+
class Config
|
|
10
|
+
#
|
|
11
|
+
# The default resolver used when a lookup is not given one.
|
|
12
|
+
#
|
|
13
|
+
# Either a resolver ({Resolv::DNS}, {Resolver::DoH}, {Resolver::DoT}) or a
|
|
14
|
+
# callable returning one. Prefer a callable in threaded applications: a
|
|
15
|
+
# resolver object is shared by every thread, and `Resolv::DNS` does not
|
|
16
|
+
# serialise concurrent lookups.
|
|
17
|
+
#
|
|
18
|
+
# @return [Object, #call, nil]
|
|
19
|
+
#
|
|
20
|
+
attr_accessor :resolver
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#
|
|
24
|
+
# The process-wide configuration.
|
|
25
|
+
#
|
|
26
|
+
# @return [Config]
|
|
27
|
+
#
|
|
28
|
+
# @since 0.11.0
|
|
29
|
+
#
|
|
30
|
+
def self.config
|
|
31
|
+
@config ||= Config.new
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
#
|
|
35
|
+
# Configures process-wide defaults.
|
|
36
|
+
#
|
|
37
|
+
# DMARCator.configure do |config|
|
|
38
|
+
# config.resolver = -> { Resolv::DNS.new }
|
|
39
|
+
# end
|
|
40
|
+
#
|
|
41
|
+
# When set, a configured resolver takes precedence over `DMARCATOR_DNS` and
|
|
42
|
+
# is used by {txt}, {txt_records}, {dmarc} and {Record.lookup} whenever no
|
|
43
|
+
# resolver is passed explicitly.
|
|
44
|
+
#
|
|
45
|
+
# @yieldparam [Config] config
|
|
46
|
+
#
|
|
47
|
+
# @return [Config]
|
|
48
|
+
#
|
|
49
|
+
# @since 0.11.0
|
|
50
|
+
#
|
|
51
|
+
def self.configure
|
|
52
|
+
yield config if block_given?
|
|
53
|
+
config
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
#
|
|
57
|
+
# Discards any configured defaults.
|
|
58
|
+
#
|
|
59
|
+
# @return [Config]
|
|
60
|
+
#
|
|
61
|
+
# @since 0.11.0
|
|
62
|
+
#
|
|
63
|
+
def self.reset_configuration!
|
|
64
|
+
@config = Config.new
|
|
65
|
+
end
|
|
66
|
+
end
|
data/lib/dmarcator/query.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'resolv'
|
|
4
4
|
require 'rubygems'
|
|
5
5
|
|
|
6
|
+
require_relative 'config'
|
|
6
7
|
require_relative 'resolver'
|
|
7
8
|
|
|
8
9
|
module DMARCator
|
|
@@ -125,7 +126,11 @@ module DMARCator
|
|
|
125
126
|
end
|
|
126
127
|
|
|
127
128
|
#
|
|
128
|
-
#
|
|
129
|
+
# The default resolver: a {configure}d one, or one built from the
|
|
130
|
+
# environment.
|
|
131
|
+
#
|
|
132
|
+
# A configured resolver may be an object or a callable; a callable is called
|
|
133
|
+
# for each lookup, which is what threaded applications should use.
|
|
129
134
|
#
|
|
130
135
|
# @return [Resolv::DNS, Resolver::DoH, Resolver::DoT]
|
|
131
136
|
#
|
|
@@ -135,7 +140,11 @@ module DMARCator
|
|
|
135
140
|
# @since 0.6.0
|
|
136
141
|
#
|
|
137
142
|
def self.default_resolver
|
|
138
|
-
|
|
143
|
+
configured = config.resolver
|
|
144
|
+
|
|
145
|
+
return configured.call if configured.respond_to?(:call)
|
|
146
|
+
|
|
147
|
+
configured || Resolver.build
|
|
139
148
|
end
|
|
140
149
|
|
|
141
150
|
#
|
data/lib/dmarcator/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dmarcator
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Noah Berman
|
|
@@ -69,6 +69,7 @@ files:
|
|
|
69
69
|
- LICENSE.txt
|
|
70
70
|
- README.md
|
|
71
71
|
- lib/dmarcator.rb
|
|
72
|
+
- lib/dmarcator/config.rb
|
|
72
73
|
- lib/dmarcator/exceptions.rb
|
|
73
74
|
- lib/dmarcator/parser.rb
|
|
74
75
|
- lib/dmarcator/query.rb
|