domain_name 0.6.20260829 → 0.6.20260902

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: 54139ca97fb756008247f18c15859ada1bb8d1c811b2c62be3b25054f22ce310
4
- data.tar.gz: 5434e4081bf12f7465a2506727865b37c26b953a5e4a898691a2c7cf2cdf689d
3
+ metadata.gz: d5d11ea994a88b334145fb6b5fe345482f2b02de62d6b68563d1ec567a0a5790
4
+ data.tar.gz: 6d20356ebf416a4e69dd7a79e51fd423b1d77eff8e8a4af1147b542effeae5c7
5
5
  SHA512:
6
- metadata.gz: 25b010eff5d4ba841cf3b3e793d7f4f939d407322692cceaa37122bc8ca3b969574c5be48187e88bfebf0c29cdfd878b3b4ae7b1cba5c61b33c2e38c2e141324
7
- data.tar.gz: 990b2cfb8da17cae6937f04d98c8a34fbfa3415dd4a46d3f57de0862f3c8ad12eeed6602123053138ff940f629a8c3bcc729818883fb64f568d8e72b845acad7
6
+ metadata.gz: ef143d11ca67f6c1953bded7e3227316f21b0d088f816030010e8ec7d08c55114ba87227ebff3ef6eb9fadcd91e18f3056892e90ece57c81025c8110a4b3c9b7
7
+ data.tar.gz: 5de667e7ff0aa5957014d1e7cb28e5ba22f7b135e9c29d9d22d7c0a410824e8b652f6260358f6afb39edfc52b336e0587d5617ae6bb9cd202648b99e576c2c52
@@ -7,6 +7,7 @@ on:
7
7
  tags:
8
8
  - "v*"
9
9
  pull_request:
10
+ workflow_dispatch:
10
11
 
11
12
  permissions:
12
13
  contents: read
@@ -15,7 +15,8 @@ jobs:
15
15
  if: >-
16
16
  ${{
17
17
  github.event.workflow_run.conclusion == 'success' &&
18
- github.event.workflow_run.event == 'push' &&
18
+ (github.event.workflow_run.event == 'push' ||
19
+ github.event.workflow_run.event == 'workflow_dispatch') &&
19
20
  github.event.workflow_run.head_repository.full_name == github.repository &&
20
21
  startsWith(github.event.workflow_run.head_branch, 'v') &&
21
22
  github.repository == 'knu/ruby-domain_name'
@@ -0,0 +1,161 @@
1
+ name: Update Public Suffix List
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - master
7
+ types:
8
+ - closed
9
+ schedule:
10
+ - cron: "23 0 * * *"
11
+ workflow_dispatch:
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ concurrency:
17
+ group: update-public-suffix-list
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ update:
22
+ if: >-
23
+ ${{
24
+ github.repository == 'knu/ruby-domain_name' &&
25
+ github.event_name != 'pull_request'
26
+ }}
27
+ runs-on: ubuntu-latest
28
+
29
+ permissions:
30
+ actions: write
31
+ contents: write
32
+ pull-requests: write
33
+
34
+ steps:
35
+ - name: Harden Runner
36
+ uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
37
+ with:
38
+ egress-policy: audit
39
+
40
+ - name: Check out
41
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
42
+ with:
43
+ persist-credentials: false
44
+
45
+ - name: Set up Ruby
46
+ uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
47
+ with:
48
+ bundler-cache: true
49
+ ruby-version: ruby
50
+
51
+ - name: Update Public Suffix List
52
+ run: |
53
+ bundle exec rake etld_data etld_data:changelog
54
+
55
+ - name: Check for list changes
56
+ id: changes
57
+ run: |
58
+ if git diff --quiet -- data/public_suffix_list.dat; then
59
+ echo "changed=false" >> "$GITHUB_OUTPUT"
60
+ else
61
+ echo "changed=true" >> "$GITHUB_OUTPUT"
62
+ fi
63
+
64
+ - name: Run tests
65
+ if: steps.changes.outputs.changed == 'true'
66
+ run: |
67
+ bundle exec rake test
68
+
69
+ - name: Read update timestamp
70
+ if: steps.changes.outputs.changed == 'true'
71
+ id: update
72
+ run: |
73
+ timestamp="$(ruby -Ilib -e 'require "domain_name/etld_data"; print DomainName::ETLD_DATA_DATE')"
74
+ echo "timestamp=$timestamp" >> "$GITHUB_OUTPUT"
75
+
76
+ - name: Create pull request
77
+ if: steps.changes.outputs.changed == 'true'
78
+ id: pull-request
79
+ uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
80
+ with:
81
+ add-paths: |
82
+ CHANGELOG.md
83
+ data/public_suffix_list.dat
84
+ lib/domain_name/etld_data.rb
85
+ lib/domain_name/version.rb
86
+ branch: automation/public-suffix-list
87
+ commit-message: Update the eTLD database to ${{ steps.update.outputs.timestamp }}.
88
+ delete-branch: true
89
+ token: ${{ github.token }}
90
+ title: Update the eTLD database to ${{ steps.update.outputs.timestamp }}
91
+ body: |
92
+ Update the bundled Public Suffix List and regenerate the eTLD database.
93
+
94
+ - name: Run CI for update branch
95
+ if: >-
96
+ steps.pull-request.outputs.pull-request-operation == 'created' ||
97
+ steps.pull-request.outputs.pull-request-operation == 'updated'
98
+ env:
99
+ GH_TOKEN: ${{ github.token }}
100
+ run: |
101
+ gh workflow run ci.yml --ref automation/public-suffix-list
102
+
103
+ release:
104
+ if: >-
105
+ ${{
106
+ github.repository == 'knu/ruby-domain_name' &&
107
+ github.event.pull_request.merged == true &&
108
+ github.event.pull_request.head.ref == 'automation/public-suffix-list' &&
109
+ github.event.pull_request.head.repo.full_name == github.repository
110
+ }}
111
+ runs-on: ubuntu-latest
112
+
113
+ permissions:
114
+ actions: write
115
+ contents: write
116
+
117
+ steps:
118
+ - name: Harden Runner
119
+ uses: step-security/harden-runner@05e31511f85b41b11d1cf0ef85d0992719546e2c # v2.21.0
120
+ with:
121
+ egress-policy: audit
122
+
123
+ - name: Check out merged update
124
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
125
+ with:
126
+ fetch-depth: 0
127
+ persist-credentials: false
128
+ ref: ${{ github.event.pull_request.merge_commit_sha }}
129
+
130
+ - name: Read release version
131
+ id: release
132
+ env:
133
+ MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
134
+ run: |
135
+ set -euo pipefail
136
+ test "$(git rev-parse HEAD)" = "$MERGE_SHA"
137
+ version="$(ruby -Ilib -e 'require "domain_name/version"; print DomainName::VERSION')"
138
+ [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]
139
+ echo "tag=v${version}" >> "$GITHUB_OUTPUT"
140
+
141
+ - name: Create release tag
142
+ env:
143
+ GH_TOKEN: ${{ github.token }}
144
+ MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
145
+ TAG: ${{ steps.release.outputs.tag }}
146
+ run: |
147
+ set -euo pipefail
148
+ if tag_sha="$(git rev-parse --verify "${TAG}^{commit}" 2>/dev/null)"; then
149
+ test "$tag_sha" = "$MERGE_SHA"
150
+ else
151
+ gh api --method POST "repos/${GITHUB_REPOSITORY}/git/refs" \
152
+ --raw-field "ref=refs/tags/${TAG}" \
153
+ --raw-field "sha=${MERGE_SHA}"
154
+ fi
155
+
156
+ - name: Run CI for release tag
157
+ env:
158
+ GH_TOKEN: ${{ github.token }}
159
+ TAG: ${{ steps.release.outputs.tag }}
160
+ run: |
161
+ gh workflow run ci.yml --ref "$TAG"
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [v0.6.20260902](https://github.com/knu/ruby-domain_name/tree/v0.6.20260902) (2026-09-03)
4
+ [Full Changelog](https://github.com/knu/ruby-domain_name/compare/v0.6.20260829...v0.6.20260902)
5
+
6
+ - Update the eTLD database to 2026-09-02 06:04:05 UTC
7
+
3
8
  ## [v0.6.20260829](https://github.com/knu/ruby-domain_name/tree/v0.6.20260829) (2026-08-30)
4
9
  [Full Changelog](https://github.com/knu/ruby-domain_name/compare/v0.6.20240107...v0.6.20260829)
5
10
 
data/README.md CHANGED
@@ -48,6 +48,10 @@ Releases use `v`-prefixed version tags. Push the release commit to
48
48
  successful tag CI run publishes the gem through RubyGems trusted
49
49
  publishing and creates the GitHub release.
50
50
 
51
+ Public Suffix List update pull requests from the
52
+ `automation/public-suffix-list` branch are tagged automatically when
53
+ merged. The tag CI run then publishes the release as above.
54
+
51
55
  Before the first automated release, register `knu/ruby-domain_name`,
52
56
  workflow `publish-gem.yml`, and environment `rubygems.org` as a trusted
53
57
  publisher at
data/Rakefile CHANGED
@@ -28,6 +28,10 @@ task :etld_data do
28
28
  rescue LoadError, NameError
29
29
  data = ETLD_DATA_URI.read
30
30
  end
31
+ if File.binread(ETLD_DATA_FILE) == data.b
32
+ puts 'eTLD database is up-to-date.'
33
+ next
34
+ end
31
35
  puts 'eTLD database is modified.'
32
36
  date = data.last_modified
33
37
  File.write(ETLD_DATA_FILE, data)
@@ -51,10 +55,10 @@ task :etld_data do
51
55
  end
52
56
 
53
57
  namespace :etld_data do
54
- task :commit do
58
+ task :changelog do
55
59
  if system('git', 'diff', '--exit-code', '--quiet', ETLD_DATA_FILE)
56
60
  warn "Nothing to commit."
57
- exit
61
+ next
58
62
  end
59
63
 
60
64
  prev = `ruby -e "$(git cat-file -p @:lib/domain_name/version.rb); puts DomainName::VERSION"`.chomp
@@ -73,7 +77,13 @@ namespace :etld_data do
73
77
  f.rewind
74
78
  f.puts lines
75
79
  end
80
+ end
76
81
 
82
+ task :commit => :changelog do
83
+ next if system('git', 'diff', '--exit-code', '--quiet', ETLD_DATA_FILE)
84
+
85
+ curr = `ruby -e "load 'lib/domain_name/version.rb'; puts DomainName::VERSION"`.chomp
86
+ timestamp = File.mtime(ETLD_DATA_FILE).utc
77
87
  sh 'git', 'commit',
78
88
  'CHANGELOG.md',
79
89
  ETLD_DATA_FILE,
@@ -5,8 +5,8 @@
5
5
  // Please pull this list from, and only from https://publicsuffix.org/list/public_suffix_list.dat,
6
6
  // rather than any other VCS sites. Pulling from any other URL is not guaranteed to be supported.
7
7
 
8
- // VERSION: 2026-08-29_12-33-06_UTC
9
- // COMMIT: e8c9a2b2b2856b6449999dd0ec0d118f364ed0cd
8
+ // VERSION: 2026-09-02_06-03-53_UTC
9
+ // COMMIT: 0f1fa47ec45056a19c2fdcd32a08442de9715d12
10
10
 
11
11
  // Instructions on pulling and using this list can be found at https://publicsuffix.org/list/.
12
12
 
@@ -12586,6 +12586,7 @@ cafjs.com
12586
12586
  // Canva Pty Ltd : https://canva.com/
12587
12587
  // Submitted by Joel Aquilina <publicsuffixlist@canva.com>
12588
12588
  canva-apps.cn
12589
+ canva-code.cn
12589
12590
  my.canvasite.cn
12590
12591
  khsj.cn
12591
12592
  canva-apps.com
@@ -14307,8 +14308,6 @@ ryd.wafaicloud.com
14307
14308
  j.scaleforce.com.cy
14308
14309
  jelastic.dogado.eu
14309
14310
  fi.cloudplatform.fi
14310
- demo.datacenter.fi
14311
- paas.datacenter.fi
14312
14311
  jele.host
14313
14312
  mircloud.host
14314
14313
  paas.beebyte.io
@@ -14452,6 +14451,11 @@ laravel.cloud
14452
14451
  on-forge.com
14453
14452
  on-vapor.com
14454
14453
 
14454
+ // Last Mile Labs, Inc : https://eth.limo
14455
+ // Submitted by eth.limo team <security@eth.limo>
14456
+ *.eth.limo
14457
+ *.eth.link
14458
+
14455
14459
  // LCube - Professional hosting e.K. : https://www.lcube-webhosting.de
14456
14460
  // Submitted by Lars Laehn <info@lcube.de>
14457
14461
  git-repos.de
@@ -15468,6 +15472,11 @@ subsc-pay.net
15468
15472
  // Submitted by Jennifer Herting <jchits@rit.edu>
15469
15473
  git-pages.rit.edu
15470
15474
 
15475
+ // Rocket : https://rocket.new
15476
+ // Submitted by Rahul Shingala <support@rocket.new>
15477
+ *.builtwithrocket.new
15478
+ rocketpreview.app
15479
+
15471
15480
  // Rocky Enterprise Software Foundation : https://resf.org
15472
15481
  // Submitted by Neil Hanlon <neil@resf.org>
15473
15482
  rocky.page
@@ -16183,11 +16192,12 @@ val.run
16183
16192
  web.val.run
16184
16193
 
16185
16194
  // Vercel, Inc : https://vercel.com/
16186
- // Submitted by Laurens Duijvesteijn <security@vercel.com>
16195
+ // Submitted by Thibault Miranda de Oliveira <security@vercel.com>
16187
16196
  vercel.app
16188
16197
  v0.build
16189
16198
  vercel.dev
16190
16199
  vusercontent.net
16200
+ tmp.now
16191
16201
  vercel.run
16192
16202
  now.sh
16193
16203
 
@@ -16346,12 +16356,6 @@ grok.me
16346
16356
  *.xenonconnect.de
16347
16357
  half.host
16348
16358
 
16349
- // XnBay Technology : http://www.xnbay.com/
16350
- // Submitted by XnBay Developer <developer.xncloud@gmail.com>
16351
- xnbay.com
16352
- u2.xnbay.com
16353
- u2-local.xnbay.com
16354
-
16355
16359
  // XS4ALL Internet bv : https://www.xs4all.nl/
16356
16360
  // Submitted by Daniel Mostertman <unixbeheer+publicsuffix@xs4all.net>
16357
16361
  cistron.nl
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class DomainName
4
- ETLD_DATA_DATE = '2026-08-29T12:33:17Z'
4
+ ETLD_DATA_DATE = '2026-09-02T06:04:05Z'
5
5
 
6
6
  ETLD_DATA = {
7
7
  "ac" => 0,
@@ -7960,6 +7960,7 @@ class DomainName
7960
7960
  "bwcloud-os-instance.de" => -1,
7961
7961
  "cafjs.com" => 0,
7962
7962
  "canva-apps.cn" => 0,
7963
+ "canva-code.cn" => 0,
7963
7964
  "my.canvasite.cn" => 0,
7964
7965
  "khsj.cn" => 0,
7965
7966
  "canva-apps.com" => 0,
@@ -9117,8 +9118,6 @@ class DomainName
9117
9118
  "j.scaleforce.com.cy" => 0,
9118
9119
  "jelastic.dogado.eu" => 0,
9119
9120
  "fi.cloudplatform.fi" => 0,
9120
- "demo.datacenter.fi" => 0,
9121
- "paas.datacenter.fi" => 0,
9122
9121
  "jele.host" => 0,
9123
9122
  "mircloud.host" => 0,
9124
9123
  "paas.beebyte.io" => 0,
@@ -9200,6 +9199,8 @@ class DomainName
9200
9199
  "laravel.cloud" => 0,
9201
9200
  "on-forge.com" => 0,
9202
9201
  "on-vapor.com" => 0,
9202
+ "eth.limo" => -1,
9203
+ "eth.link" => -1,
9203
9204
  "git-repos.de" => 0,
9204
9205
  "lcube-server.de" => 0,
9205
9206
  "svn-repos.de" => 0,
@@ -9754,6 +9755,8 @@ class DomainName
9754
9755
  "subsc-pay.com" => 0,
9755
9756
  "subsc-pay.net" => 0,
9756
9757
  "git-pages.rit.edu" => 0,
9758
+ "builtwithrocket.new" => -1,
9759
+ "rocketpreview.app" => 0,
9757
9760
  "rocky.page" => 0,
9758
9761
  "rub.de" => 0,
9759
9762
  "ruhr-uni-bochum.de" => 0,
@@ -10157,6 +10160,7 @@ class DomainName
10157
10160
  "v0.build" => 0,
10158
10161
  "vercel.dev" => 0,
10159
10162
  "vusercontent.net" => 0,
10163
+ "tmp.now" => 0,
10160
10164
  "vercel.run" => 0,
10161
10165
  "now.sh" => 0,
10162
10166
  "2038.io" => 0,
@@ -10223,9 +10227,6 @@ class DomainName
10223
10227
  "grok.me" => 0,
10224
10228
  "xenonconnect.de" => -1,
10225
10229
  "half.host" => 0,
10226
- "xnbay.com" => 0,
10227
- "u2.xnbay.com" => 0,
10228
- "u2-local.xnbay.com" => 0,
10229
10230
  "cistron.nl" => 0,
10230
10231
  "demon.nl" => 0,
10231
10232
  "xs4all.space" => 0,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class DomainName
4
- VERSION = '0.6.20260829'
4
+ VERSION = '0.6.20260902'
5
5
  end
data/lib/domain_name.rb CHANGED
@@ -87,8 +87,8 @@ class DomainName
87
87
  @uri_host = @hostname = @ipaddr.to_s
88
88
  @domain = @tld = nil
89
89
  return
90
- when /\A([0-9A-Fa-f:]*:[0-9A-Fa-f:]*:[0-9A-Fa-f:]*)\z/,
91
- /\A\[([0-9A-Fa-f:]*:[0-9A-Fa-f:]*:[0-9A-Fa-f:]*)\]\z/
90
+ when /\A([0-9A-Fa-f:]*:[0-9A-Fa-f:]*:(?:[0-9A-Fa-f:]*|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+))\z/,
91
+ /\A\[([0-9A-Fa-f:]*:[0-9A-Fa-f:]*:(?:[0-9A-Fa-f:]*|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+))\]\z/
92
92
  @ipaddr = IPAddr.new($1)
93
93
  @hostname = @ipaddr.to_s
94
94
  @uri_host = "[#{@hostname}]"
@@ -253,12 +253,7 @@ class DomainName
253
253
  alias idn hostname_idn
254
254
 
255
255
  def domain_idn
256
- @domain_idn ||=
257
- if @ipaddr
258
- @domain
259
- else
260
- DomainName::Punycode.decode_hostname(@domain)
261
- end
256
+ @domain_idn ||= DomainName::Punycode.decode_hostname(@domain) if @domain
262
257
  end
263
258
 
264
259
  def tld_idn
@@ -293,6 +293,27 @@ class TestDomainName < Test::Unit::TestCase
293
293
  }
294
294
  end
295
295
 
296
+ test "parse IPv4-embedded IPv6 addresses" do
297
+ {
298
+ '::ffff:192.0.2.1' => '::ffff:192.0.2.1',
299
+ '[::ffff:192.0.2.1]' => '::ffff:192.0.2.1',
300
+ '2001:db8::192.0.2.1' => '2001:db8::c000:201',
301
+ }.each { |host, normalized|
302
+ dn = DomainName(host)
303
+ assert_equal(normalized, dn.hostname)
304
+ assert_equal("[#{normalized}]", dn.uri_host)
305
+ assert_equal(IPAddr.new(normalized), dn.ipaddr)
306
+ assert_equal(nil, dn.domain)
307
+ assert_equal(nil, dn.tld)
308
+ }
309
+
310
+ assert_raises(IPAddr::InvalidAddressError) do
311
+ DomainName('2001:db8::192.0.2.999')
312
+ end
313
+
314
+ assert_nil(DomainName('2001:192.0.2.1::1').ipaddr)
315
+ end
316
+
296
317
  test "get superdomain" do
297
318
  [
298
319
  %w[www.sub.example.local sub.example.local example.local local],
@@ -318,4 +339,8 @@ class TestDomainName < Test::Unit::TestCase
318
339
  assert_equal "xn--wgv71a", dn.tld
319
340
  assert_equal "日本", dn.tld_idn
320
341
  end
342
+
343
+ test "return nil for an absent IDN domain" do
344
+ assert_nil DomainName.new("com").domain_idn
345
+ end
321
346
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: domain_name
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.20260829
4
+ version: 0.6.20260902
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
@@ -83,6 +83,7 @@ files:
83
83
  - ".github/renovate.json5"
84
84
  - ".github/workflows/ci.yml"
85
85
  - ".github/workflows/publish-gem.yml"
86
+ - ".github/workflows/update-public-suffix-list.yml"
86
87
  - ".gitignore"
87
88
  - CHANGELOG.md
88
89
  - Gemfile