dns-zonefile 1.1.9 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +7 -0
- data/.github/workflows/ci.yml +31 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +20 -18
- data/lib/dns/zonefile/version.rb +1 -1
- data/lib/dns/zonefile.treetop +56 -14
- metadata +8 -8
- data/.travis.yml +0 -10
- data/circle.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9ce2af524f4611e9802321af562f83cefd8fb248519c4f99fa4e69f97c716f1
|
4
|
+
data.tar.gz: 7b9d23678c4dd551d3dc7a957bb87a74582c9da621f5df591be7653fcc041a5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59a5277698e65091e76c6b776dbcf6097ae0f2ff520fbb74e5fca402fd77269c04b982edeb0157d94ba7062429c679a78f37322dd2358a890fc1c1cbf80a3b6e
|
7
|
+
data.tar.gz: 4c08474f6611f3edce68acaf0c5080a42fbddc63b8185737b7cdc17116d29acb059829030147b336994620f8744ee64b48e5df735e0a87880d17df34b44158a5
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types:
|
6
|
+
- opened
|
7
|
+
- reopened
|
8
|
+
- synchronize
|
9
|
+
- ready_for_review
|
10
|
+
push:
|
11
|
+
branches: [ main ]
|
12
|
+
|
13
|
+
concurrency:
|
14
|
+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
|
15
|
+
cancel-in-progress: true
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
test:
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
matrix:
|
22
|
+
os: [ubuntu-20.04, ubuntu-latest]
|
23
|
+
ruby: ['2.7', '3.0', '3.1', head, jruby, truffleruby]
|
24
|
+
runs-on: ${{ matrix.os }}
|
25
|
+
steps:
|
26
|
+
- uses: actions/checkout@v3
|
27
|
+
- uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
30
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
31
|
+
- run: bundle exec rake
|
data/CONTRIBUTING.md
CHANGED
@@ -33,4 +33,4 @@ Submit unit tests for your changes. You can test your changes on your machine by
|
|
33
33
|
|
34
34
|
## Publishing
|
35
35
|
|
36
|
-
Once a PR is merged into master, bump the version in `lib/dns/zonefile/version.rb` and commit that change. Next, add a new tag with that version number and push the tag to GitHub. Finally, if you are a maintainer with access rights for rubygems.org, run `gem build
|
36
|
+
Once a PR is merged into master, bump the version in `lib/dns/zonefile/version.rb` and commit that change. Next, add a new tag with that version number 'git tag vx.x.x' and push the tag to GitHub 'git push origin vx.x.x'. Finally, if you are a maintainer with access rights for rubygems.org, run `gem build dns-zonefile.gemspec` followed by `gem push dns-zonefile-x.x.x.gem` where x.x.x is the version number you just set.
|
data/README.md
CHANGED
@@ -24,28 +24,32 @@ Okay, you're ready to move onto the examples now.
|
|
24
24
|
Using raw data from the parser. Note that "@" isn't translated in this mode.
|
25
25
|
Nor are inherited TTLs interpreted.
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
```ruby
|
28
|
+
zonefile = "/path/to/file.zone"
|
29
|
+
zone_string = File.read(zonefile)
|
30
|
+
zone = DNS::Zonefile.parse(zone_string)
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
puts zone.soa.origin.to_s
|
33
|
+
puts zone.soa.ns.to_s
|
34
|
+
puts zone.rr[0].to_s
|
35
|
+
```
|
34
36
|
|
35
37
|
Using more structure data. @, TTLs, and empty hostname inheritance are all
|
36
38
|
handled in this mode.
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
```ruby
|
41
|
+
zonefile = "/path/to/file.zone"
|
42
|
+
zone_string = File.read(zonefile)
|
43
|
+
zone = DNS::Zonefile.load(zone_string)
|
44
|
+
# or, if no $origin is in the zone file
|
45
|
+
zone = DNS::Zonefile.load(zone_string, 'example.com.')
|
43
46
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
puts zone.soa.origin
|
48
|
+
puts zone.soa.nameserver
|
49
|
+
puts zone.records[1]
|
50
|
+
# get all MX records
|
51
|
+
puts zone.records_of(DNS::Zonefile::MX)
|
52
|
+
```
|
49
53
|
|
50
54
|
Open the examples in the `./examples` directory to see more examples.
|
51
55
|
|
@@ -64,5 +68,3 @@ Craig R Webster <http://barkingiguana.com/>
|
|
64
68
|
## Contributing
|
65
69
|
|
66
70
|
See the TODO. Read CONTRIBUTING.md for more details on how to contribute to this project.
|
67
|
-
|
68
|
-
[![Build Status](https://secure.travis-ci.org/craigw/dns-zonefile.png)](http://travis-ci.org/craigw/dns-zonefile)
|
data/lib/dns/zonefile/version.rb
CHANGED
data/lib/dns/zonefile.treetop
CHANGED
@@ -43,7 +43,10 @@ grammar Zonefile
|
|
43
43
|
end
|
44
44
|
|
45
45
|
rule soa
|
46
|
-
|
46
|
+
(
|
47
|
+
origin space ttl klass "SOA" space ns space "("? multiline_comment* space_or_break* rp multiline_comment* space_or_break* "("? multiline_comment* space_or_break* serial multiline_comment* space_or_break refresh multiline_comment* space_or_break reretry multiline_comment* space_or_break expiry multiline_comment* space_or_break nxttl multiline_comment* space_or_break* ")"? /
|
48
|
+
origin space klass ttl "SOA" space ns space "("? multiline_comment* space_or_break* rp multiline_comment* space_or_break* "("? multiline_comment* space_or_break* serial multiline_comment* space_or_break refresh multiline_comment* space_or_break reretry multiline_comment* space_or_break expiry multiline_comment* space_or_break nxttl multiline_comment* space_or_break* ")"?
|
49
|
+
) {
|
47
50
|
def to_s
|
48
51
|
"#{origin} #{ttl} #{klass} SOA #{ns} #{rp} (#{serial} #{refresh} #{reretry} #{expiry} #{nxttl})"
|
49
52
|
end
|
@@ -89,7 +92,10 @@ grammar Zonefile
|
|
89
92
|
end
|
90
93
|
|
91
94
|
rule a_record
|
92
|
-
|
95
|
+
(
|
96
|
+
host space ms_age ttl klass "A" space ip_address /
|
97
|
+
host space ms_age klass ttl "A" space ip_address
|
98
|
+
) {
|
93
99
|
def to_s
|
94
100
|
"#{host} #{ms_age} #{ttl} #{klass} A #{ip_address}"
|
95
101
|
end
|
@@ -109,7 +115,10 @@ grammar Zonefile
|
|
109
115
|
end
|
110
116
|
|
111
117
|
rule aaaa_record
|
112
|
-
|
118
|
+
(
|
119
|
+
host space ms_age ttl klass "AAAA" space ip_address:ip6_address /
|
120
|
+
host space ms_age klass ttl "AAAA" space ip_address:ip6_address
|
121
|
+
) {
|
113
122
|
def to_s
|
114
123
|
"#{host} #{ttl} #{klass} AAAA #{ip_address}"
|
115
124
|
end
|
@@ -130,7 +139,8 @@ grammar Zonefile
|
|
130
139
|
|
131
140
|
rule caa_record
|
132
141
|
(
|
133
|
-
host space ms_age ttl klass "CAA" space flags:integer space tag:unquoted_string space value:caa_value
|
142
|
+
host space ms_age ttl klass "CAA" space flags:integer space tag:unquoted_string space value:caa_value /
|
143
|
+
host space ms_age klass ttl "CAA" space flags:integer space tag:unquoted_string space value:caa_value
|
134
144
|
) {
|
135
145
|
def to_s
|
136
146
|
"#{host} #{ttl} #{klass} CAA #{flags} #{tag} #{value}"
|
@@ -168,7 +178,10 @@ grammar Zonefile
|
|
168
178
|
end
|
169
179
|
|
170
180
|
rule mx_record
|
171
|
-
|
181
|
+
(
|
182
|
+
host space ttl klass "MX" space priority:integer space exchanger:host /
|
183
|
+
host space klass ttl "MX" space priority:integer space exchanger:host
|
184
|
+
) {
|
172
185
|
def to_s
|
173
186
|
"#{host} #{ttl} #{klass} MX #{priority} #{exchanger}"
|
174
187
|
end
|
@@ -180,7 +193,10 @@ grammar Zonefile
|
|
180
193
|
end
|
181
194
|
|
182
195
|
rule naptr_record
|
183
|
-
|
196
|
+
(
|
197
|
+
host space ms_age ttl klass "NAPTR" space data /
|
198
|
+
host space ms_age klass ttl "NAPTR" space data
|
199
|
+
) {
|
184
200
|
def to_s
|
185
201
|
"#{host} #{ttl} #{klass} NAPTR #{data}"
|
186
202
|
end
|
@@ -192,7 +208,10 @@ grammar Zonefile
|
|
192
208
|
end
|
193
209
|
|
194
210
|
rule ns_record
|
195
|
-
|
211
|
+
(
|
212
|
+
host space ms_age ttl klass "NS" space nameserver:host /
|
213
|
+
host space ms_age klass ttl "NS" space nameserver:host
|
214
|
+
) {
|
196
215
|
def to_s
|
197
216
|
"#{host} #{ttl} #{klass} NS #{nameserver}"
|
198
217
|
end
|
@@ -204,7 +223,10 @@ grammar Zonefile
|
|
204
223
|
end
|
205
224
|
|
206
225
|
rule ptr_record
|
207
|
-
|
226
|
+
(
|
227
|
+
host space ms_age ttl klass "PTR" space target:host /
|
228
|
+
host space ms_age klass ttl "PTR" space target:host
|
229
|
+
) {
|
208
230
|
def to_s
|
209
231
|
"#{host} #{ttl} #{klass} PTR #{target}"
|
210
232
|
end
|
@@ -216,7 +238,10 @@ grammar Zonefile
|
|
216
238
|
end
|
217
239
|
|
218
240
|
rule soa_record
|
219
|
-
|
241
|
+
(
|
242
|
+
origin space ms_age ttl klass "SOA" space ns space rp space data /
|
243
|
+
origin space ms_age klass ttl "SOA" space ns space rp space data
|
244
|
+
) {
|
220
245
|
def to_s
|
221
246
|
"#{origin} #{ttl} #{klass} SOA #{ns} #{rp} (#{space})"
|
222
247
|
end
|
@@ -245,7 +270,10 @@ grammar Zonefile
|
|
245
270
|
end
|
246
271
|
|
247
272
|
rule spf_record
|
248
|
-
|
273
|
+
(
|
274
|
+
host space ms_age ttl klass "SPF" space data:txt_data /
|
275
|
+
host space ms_age klass ttl "SPF" space data:txt_data
|
276
|
+
) {
|
249
277
|
def to_s
|
250
278
|
"#{host} #{ttl} #{klass} SPF #{data}"
|
251
279
|
end
|
@@ -257,7 +285,10 @@ grammar Zonefile
|
|
257
285
|
end
|
258
286
|
|
259
287
|
rule sshfp_record
|
260
|
-
|
288
|
+
(
|
289
|
+
host space ms_age ttl klass "SSHFP" space alg:integer space fptype:integer space fp:fingerprint /
|
290
|
+
host space ms_age klass ttl "SSHFP" space alg:integer space fptype:integer space fp:fingerprint
|
291
|
+
) {
|
261
292
|
def to_s
|
262
293
|
"#{host} #{ttl} #{klass} SSHFP #{alg} #{fptype} #{fp}"
|
263
294
|
end
|
@@ -269,7 +300,10 @@ grammar Zonefile
|
|
269
300
|
end
|
270
301
|
|
271
302
|
rule txt_record
|
272
|
-
|
303
|
+
(
|
304
|
+
host space ms_age ttl klass "TXT" space data:ms_txt_data /
|
305
|
+
host space ms_age klass ttl "TXT" space data:ms_txt_data
|
306
|
+
) {
|
273
307
|
def to_s
|
274
308
|
"#{host} #{ttl} #{klass} TXT #{data}"
|
275
309
|
end
|
@@ -345,7 +379,15 @@ grammar Zonefile
|
|
345
379
|
end
|
346
380
|
|
347
381
|
rule rp
|
348
|
-
|
382
|
+
rp_value comment* {
|
383
|
+
def to_s
|
384
|
+
"#{rp_value}"
|
385
|
+
end
|
386
|
+
}
|
387
|
+
end
|
388
|
+
|
389
|
+
rule rp_value
|
390
|
+
("." / (("\\." / [a-zA-Z0-9\-)])+ "."?)+) {
|
349
391
|
def to_s
|
350
392
|
text_value
|
351
393
|
end
|
@@ -527,7 +569,7 @@ grammar Zonefile
|
|
527
569
|
end
|
528
570
|
|
529
571
|
rule unquoted_string
|
530
|
-
[a-zA-Z0-9=_]+ {
|
572
|
+
'[a-zA-Z0-9=_\.\-\@\:]+'r {
|
531
573
|
def to_s
|
532
574
|
text_value
|
533
575
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dns-zonefile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig R Webster
|
8
8
|
- Anthony Eden
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: treetop
|
@@ -96,9 +96,10 @@ executables: []
|
|
96
96
|
extensions: []
|
97
97
|
extra_rdoc_files: []
|
98
98
|
files:
|
99
|
+
- ".github/dependabot.yml"
|
100
|
+
- ".github/workflows/ci.yml"
|
99
101
|
- ".gitignore"
|
100
102
|
- ".rspec"
|
101
|
-
- ".travis.yml"
|
102
103
|
- CONTRIBUTING.md
|
103
104
|
- Dockerfile
|
104
105
|
- Gemfile
|
@@ -108,7 +109,6 @@ files:
|
|
108
109
|
- TODO
|
109
110
|
- bin/console
|
110
111
|
- bin/setup
|
111
|
-
- circle.yml
|
112
112
|
- dns-zonefile.gemspec
|
113
113
|
- doc/example.com.zone
|
114
114
|
- doc/example2.com.zone
|
@@ -126,7 +126,7 @@ homepage: https://github.com/craigw/dns-zonefile
|
|
126
126
|
licenses: []
|
127
127
|
metadata:
|
128
128
|
allowed_push_host: https://rubygems.org
|
129
|
-
post_install_message:
|
129
|
+
post_install_message:
|
130
130
|
rdoc_options: []
|
131
131
|
require_paths:
|
132
132
|
- lib
|
@@ -141,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
requirements: []
|
144
|
-
rubygems_version: 3.
|
145
|
-
signing_key:
|
144
|
+
rubygems_version: 3.3.7
|
145
|
+
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Work with zonefiles (RFC 1035 section 5 and RFC 1034 section 3.6.1)
|
148
148
|
test_files: []
|
data/.travis.yml
DELETED