cloudflare-dns-update 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84fada8eb1262bb18ed4a1e7d0392f958abe2a311f9fcba6a1703d6cea946634
4
- data.tar.gz: b51bd44936abe2811def5ddbc0d9afcc5c74e2c447d4c36d2185904e1f8365b3
3
+ metadata.gz: 4982b2556e18e8c0fb49c3b1d7b26306dbdc64f9ad91d6de9b465695767bd439
4
+ data.tar.gz: ceca59ae2c70245c192af5cc3ca9b6c84f18cb9a4b927a6130e94c416e78c057
5
5
  SHA512:
6
- metadata.gz: 1df9331da1630b9eacf84167a68b893dd2002496e70cb03e2d55d731deb91b1eeeea66441cbf2ac29adeb2853edd962d544715a9cfb4965cf79db48ad352bd87
7
- data.tar.gz: a0d4cfadca21c79211029fd65731f54739c0ba45b45f587ed7b746cf3d8b8c5d8a5c98725656efcd62441968e21adab3e9b1966ba94dad48eeaf995c6733a00c
6
+ metadata.gz: eee9fcf2ed240275a86b9d06985f489293a7d35684f759979fcbca07a8e99481caa307ab5f82d93781ba2c36d869b045a4a5ee4f6f9d739a2437fbfcf6a12c96
7
+ data.tar.gz: 96fa2a93b373a29ae466b1bda6f3e88b926b2f946b7b5a10e8e5024293eff6204f67985ee53f56597ac428af6803e623613aa8c92d5bc267580ed6a1177f0200
checksums.yaml.gz.sig ADDED
Binary file
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
5
  #
@@ -20,13 +21,13 @@
20
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
22
  # THE SOFTWARE.
22
23
 
23
- require_relative '../lib/cloudflare/dns/update/command'
24
+ require_relative "../lib/cloudflare/dns/update/command"
24
25
 
25
26
  begin
26
27
  Cloudflare::DNS::Update::Command.call
27
28
  rescue Interrupt
28
29
  # Ignore.
29
30
  rescue => error
30
- Async.logger.error(Falcon::Command) {error}
31
+ Console.error(Cloudflare::DNS::Update::Command, error)
31
32
  exit! 1
32
33
  end
@@ -1,32 +1,18 @@
1
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
20
2
 
21
- require 'samovar'
22
- require 'yaml/store'
23
- require 'tty/prompt'
3
+ # Released under the MIT License.
4
+ # Copyright, 2017-2024, by Samuel Williams.
5
+ # Copyright, 2023, by John Labovitz.
24
6
 
25
- require 'open3'
26
- require 'json'
7
+ require "samovar"
8
+ require "yaml/store"
9
+ require "tty/prompt"
27
10
 
28
- require 'cloudflare'
29
- require_relative 'version'
11
+ require "open3"
12
+ require "json"
13
+
14
+ require "cloudflare"
15
+ require_relative "version"
30
16
 
31
17
  module Cloudflare::DNS::Update
32
18
  module Command
@@ -39,13 +25,9 @@ module Cloudflare::DNS::Update
39
25
  self.description = "Update remote DNS records according to locally run commands."
40
26
 
41
27
  options do
42
- option '-c/--configuration <path>', "Use the specified configuration file.", default: 'dns.conf'
43
- option '-f/--force', "Force push updates to cloudflare even if content hasn't changed.", default: false
44
- option '-v/--version', "Print out the application version."
45
- end
46
-
47
- def logger
48
- @logger ||= Async.logger
28
+ option "-c/--configuration <path>", "Use the specified configuration file.", default: "dns.conf"
29
+ option "-f/--force", "Force push updates to cloudflare even if content hasn't changed.", default: false
30
+ option "-v/--version", "Print out the application version."
49
31
  end
50
32
 
51
33
  def prompt
@@ -109,34 +91,34 @@ module Cloudflare::DNS::Update
109
91
  def initialize_command
110
92
  configuration_store.transaction do |configuration|
111
93
  unless configuration[:content_command]
112
- configuration[:content_command] = prompt.ask("What command to get content for record?", default: 'curl -s ipinfo.io/ip')
94
+ configuration[:content_command] = prompt.ask("What command to get content for record?", default: "curl -s ipinfo.io/ip")
113
95
  end
114
96
  end
115
97
  end
116
98
 
117
99
  def update_domain(zone, record, content)
118
100
  if content != record[:content] || @options[:force]
119
- logger.info "Content changed #{content.inspect}, updating records..."
101
+ Console.info "Content changed #{content.inspect}, updating records..."
120
102
 
121
103
  domain = zone.dns_records.find_by_id(record[:id])
122
104
 
123
105
  begin
124
106
  domain.update_content(content)
125
107
 
126
- logger.info "Updated domain: #{record[:name]} #{record[:type]} #{content}"
108
+ Console.info "Updated domain: #{record[:name]} #{record[:type]} #{content}"
127
109
  record[:content] = content
128
110
  rescue => error
129
- logger.warn("Failed to update domain: #{record[:name]} #{record[:type]} #{content}") {error}
111
+ Console.warn("Failed to update domain: #{record[:name]} #{record[:type]} #{content}", error)
130
112
  end
131
113
  else
132
- logger.debug "Content hasn't changed: #{record[:name]} #{record[:type]} #{content}"
114
+ Console.debug "Content hasn't changed: #{record[:name]} #{record[:type]} #{content}"
133
115
  end
134
116
  end
135
117
 
136
118
  def update_domains(content = nil)
137
119
  configuration_store.transaction do |configuration|
138
120
  unless content
139
- logger.debug "Executing content command: #{configuration[:content_command]}"
121
+ Console.debug "Executing content command: #{configuration[:content_command]}"
140
122
  content, status = Open3.capture2(configuration[:content_command])
141
123
 
142
124
  unless status.success?
@@ -1,28 +1,12 @@
1
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
20
2
 
3
+ # Released under the MIT License.
4
+ # Copyright, 2013-2024, by Samuel Williams.
21
5
 
22
6
  module Cloudflare
23
7
  module DNS
24
8
  module Update
25
- VERSION = "3.0.0"
9
+ VERSION = "3.1.0"
26
10
  end
27
11
  end
28
12
  end
@@ -1,22 +1,7 @@
1
- # Copyright, 2013, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
- #
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
- #
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
- #
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
1
+ # frozen_string_literal: true
2
+
3
+ # Released under the MIT License.
4
+ # Copyright, 2013-2024, by Samuel Williams.
20
5
 
21
6
  require "cloudflare/dns/update/version"
22
7
 
data/license.md ADDED
@@ -0,0 +1,24 @@
1
+ # MIT License
2
+
3
+ Copyright, 2013-2024, by Samuel Williams.
4
+ Copyright, 2014, by Hirofumi Wakasugi.
5
+ Copyright, 2020, by Olle Jonsson.
6
+ Copyright, 2023, by John Labovitz.
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in all
16
+ copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
data/readme.md ADDED
@@ -0,0 +1,37 @@
1
+ # Cloudflare::DNS::Update
2
+
3
+ This gem provides a simple executable tool for managing Cloudflare records to provide dynamic DNS like functionality. You need to add it to whatever `cron` system your host system uses.
4
+
5
+ [![Development Status](https://github.com/socketry/cloudflare-dns-update/workflows/Test/badge.svg)](https://github.com/socketry/cloudflare-dns-update/actions?workflow=Test)
6
+
7
+ ## Features
8
+
9
+ - Token based authorization to minimise risk.
10
+ - Handles both IPv4 and IPv6 with custom commands.
11
+ - Can update any record type with any command output.
12
+
13
+ ## Usage
14
+
15
+ Please see the [project documentation](https://socketry.github.io/cloudflare-dns-update).
16
+
17
+ ## Contributing
18
+
19
+ We welcome contributions to this project.
20
+
21
+ 1. Fork it.
22
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
23
+ 3. Commit your changes (`git commit -am 'Add some feature'`).
24
+ 4. Push to the branch (`git push origin my-new-feature`).
25
+ 5. Create new Pull Request.
26
+
27
+ ### Developer Certificate of Origin
28
+
29
+ In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
30
+
31
+ ### Community Guidelines
32
+
33
+ This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
34
+
35
+ ## See Also
36
+
37
+ - [cloudflare](https://github.com/ioquatix/cloudflare) – Provides access to Cloudflare.
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudflare-dns-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
+ - Hirofumi Wakasugi
9
+ - John Labovitz
10
+ - Olle Jonsson
8
11
  autorequire:
9
12
  bindir: bin
10
- cert_chain: []
11
- date: 2020-07-19 00:00:00.000000000 Z
13
+ cert_chain:
14
+ - |
15
+ -----BEGIN CERTIFICATE-----
16
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
17
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
18
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
19
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
20
+ MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
21
+ bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
22
+ igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
23
+ 9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
24
+ sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
25
+ e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
26
+ XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/x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----
43
+ date: 2024-11-17 00:00:00.000000000 Z
12
44
  dependencies:
13
45
  - !ruby/object:Gem::Dependency
14
46
  name: cloudflare
@@ -52,76 +84,6 @@ dependencies:
52
84
  - - "~>"
53
85
  - !ruby/object:Gem::Version
54
86
  version: '0.21'
55
- - !ruby/object:Gem::Dependency
56
- name: async-rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: bundler
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: covered
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rake
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rspec
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '3.6'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '3.6'
125
87
  description:
126
88
  email:
127
89
  executables:
@@ -130,14 +92,17 @@ extensions: []
130
92
  extra_rdoc_files: []
131
93
  files:
132
94
  - bin/cloudflare-dns-update
133
- - lib/.DS_Store
134
95
  - lib/cloudflare/dns/update.rb
135
96
  - lib/cloudflare/dns/update/command.rb
136
97
  - lib/cloudflare/dns/update/version.rb
98
+ - license.md
99
+ - readme.md
137
100
  homepage:
138
101
  licenses:
139
102
  - MIT
140
- metadata: {}
103
+ metadata:
104
+ documentation_uri: https://socketry.github.io/cloudflare-dns-update
105
+ source_code_uri: https://github.com/socketry/cloudflare-dns-update
141
106
  post_install_message:
142
107
  rdoc_options: []
143
108
  require_paths:
@@ -146,14 +111,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
146
111
  requirements:
147
112
  - - ">="
148
113
  - !ruby/object:Gem::Version
149
- version: '2.5'
114
+ version: '3.1'
150
115
  required_rubygems_version: !ruby/object:Gem::Requirement
151
116
  requirements:
152
117
  - - ">="
153
118
  - !ruby/object:Gem::Version
154
119
  version: '0'
155
120
  requirements: []
156
- rubygems_version: 3.1.2
121
+ rubygems_version: 3.5.22
157
122
  signing_key:
158
123
  specification_version: 4
159
124
  summary: A dyndns client for Cloudflare.
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ ��Dh�$�>,6��+A R��8TU�W�f�r��{4��^F-�|��yp�~'6|�С�(�z�z_1n�Jb�����8�03��}��ώ�(�U��o� Qk��$� n2��F�P�̿ɗ�4�� ���x%:JN���ݙ�� p�g�Ә&��%��~K�����,��_��x�'���T<L��8� )�~3I�`,�
data/lib/.DS_Store DELETED
Binary file