ovh_dnsup 0.1.0 → 0.2.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 +7 -0
- data/lib/ovh_dnsup/cli.rb +9 -2
- data/lib/ovh_dnsup/domain_manager.rb +2 -0
- data/lib/ovh_dnsup/ovh_api.rb +10 -0
- data/lib/ovh_dnsup/version.rb +1 -1
- data/ovh_dnsup.gemspec +4 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06b3967e54f0a66f9e3b42c8e804208e15302401ee338e7d253d484bb58f0a9c
|
4
|
+
data.tar.gz: 4242c9feb329b3511d27bbe25bfd026ba0ef6269246d01d9a5990b79147f69a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6ff5d8c42407bd84d36d2e779d8410beec9153c6fbee6fa175efdf7e72c680ad8e3831c00c75c718d1cf49aeef7ff6a48843bb8a0532baaf45d1293dd135a48
|
7
|
+
data.tar.gz: e46c823e842d3b1e525f47def025f42668abda6f908fe1284d408329d1b83d9acdf07b94dfc622d9845bca9595d5db8d392aaa12cd349938ea3102458f3035fc
|
data/CHANGELOG.md
ADDED
data/lib/ovh_dnsup/cli.rb
CHANGED
@@ -17,7 +17,10 @@ require 'socket'
|
|
17
17
|
require_relative 'domain_manager'
|
18
18
|
|
19
19
|
module OvhDnsup
|
20
|
+
# The command-line interface.
|
20
21
|
module Cli
|
22
|
+
|
23
|
+
# Run the command-line interface.
|
21
24
|
def self.run
|
22
25
|
|
23
26
|
@conf_fn = File.join(Dir.home, '.ovh_dnsup.conf')
|
@@ -323,7 +326,10 @@ module OvhDnsup
|
|
323
326
|
end
|
324
327
|
end
|
325
328
|
|
326
|
-
#
|
329
|
+
# Get the IP address of an interface
|
330
|
+
#
|
331
|
+
# @param interface The interface name.
|
332
|
+
# @param version The IP version, either 4 or 6.
|
327
333
|
def self.get_interface_address(interface:, version: nil)
|
328
334
|
ipv4 = []
|
329
335
|
ipv6 = []
|
@@ -339,7 +345,7 @@ module OvhDnsup
|
|
339
345
|
end
|
340
346
|
|
341
347
|
# filter local addresses
|
342
|
-
ipv6.select { |addr|
|
348
|
+
ipv6.select! { |addr| !(/^(fc|fd|fe8|fe9|fea|feb)/ =~ addr) }
|
343
349
|
|
344
350
|
if !ipv6.empty? && (version == nil || version == 6)
|
345
351
|
return ipv6[0]
|
@@ -350,6 +356,7 @@ module OvhDnsup
|
|
350
356
|
end
|
351
357
|
end
|
352
358
|
|
359
|
+
# Lists all local interfaces and their IP addresses.
|
353
360
|
def self.interfaces
|
354
361
|
parser = OptionParser.new do |opts|
|
355
362
|
opts.banner = 'Usage: ovh_dnsup interfaces'
|
@@ -16,6 +16,7 @@ require_relative 'ovh_api'
|
|
16
16
|
|
17
17
|
module OvhDnsup
|
18
18
|
|
19
|
+
# Allows managing a DNS zone.
|
19
20
|
class DomainManager
|
20
21
|
def initialize(args)
|
21
22
|
@api = OvhApi.new(args)
|
@@ -145,6 +146,7 @@ module OvhDnsup
|
|
145
146
|
end
|
146
147
|
end
|
147
148
|
|
149
|
+
# Once authorized, can be used to change a DNS zone entry.
|
148
150
|
class DomainUpdater
|
149
151
|
def initialize(endpoint: nil, application_key: nil, application_secret: nil, state: nil)
|
150
152
|
if state
|
data/lib/ovh_dnsup/ovh_api.rb
CHANGED
@@ -29,6 +29,8 @@ module OvhDnsup
|
|
29
29
|
'soyoustart-ca' => 'https://ca.api.soyoustart.com/',
|
30
30
|
}
|
31
31
|
|
32
|
+
# Access to the OVH rest API. This class manages authentication and
|
33
|
+
# signage of API requests.
|
32
34
|
class OvhApi
|
33
35
|
attr_reader :endpoint, :application_key, :application_secret, :consumer_key
|
34
36
|
|
@@ -40,6 +42,13 @@ module OvhDnsup
|
|
40
42
|
ENDPOINTS[endpoint]
|
41
43
|
end
|
42
44
|
|
45
|
+
# You have either to provide endpoint, application_key, and
|
46
|
+
# application_secret or provide a state.
|
47
|
+
#
|
48
|
+
# @param endpoint
|
49
|
+
# @param application_key
|
50
|
+
# @param application_secret
|
51
|
+
# @param state
|
43
52
|
def initialize(endpoint: nil, application_key: nil, application_secret: nil, state: nil)
|
44
53
|
if state
|
45
54
|
self.state = state
|
@@ -55,6 +64,7 @@ module OvhDnsup
|
|
55
64
|
end
|
56
65
|
end
|
57
66
|
|
67
|
+
# The state which can be saved and later restored.
|
58
68
|
def state
|
59
69
|
{ 'endpoint' => @endpoint,
|
60
70
|
'application_key' => @application_key,
|
data/lib/ovh_dnsup/version.rb
CHANGED
data/ovh_dnsup.gemspec
CHANGED
@@ -11,6 +11,10 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.homepage = "https://github.com/hrittich/ovh_dnsup"
|
12
12
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
13
|
|
14
|
+
spec.metadata = {
|
15
|
+
'homepage_uri' => 'https://github.com/hrittich/ovh_dnsup/blob/main/CHANGELOG.md'
|
16
|
+
}
|
17
|
+
|
14
18
|
# Specify which files should be added to the gem when it is released.
|
15
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
16
20
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ovh_dnsup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hannah Rittich
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01-
|
11
|
+
date: 2021-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -39,6 +39,7 @@ extensions: []
|
|
39
39
|
extra_rdoc_files: []
|
40
40
|
files:
|
41
41
|
- ".gitignore"
|
42
|
+
- CHANGELOG.md
|
42
43
|
- Gemfile
|
43
44
|
- LICENSE
|
44
45
|
- README.md
|
@@ -54,7 +55,8 @@ files:
|
|
54
55
|
homepage: https://github.com/hrittich/ovh_dnsup
|
55
56
|
licenses:
|
56
57
|
- Apache-2.0
|
57
|
-
metadata:
|
58
|
+
metadata:
|
59
|
+
homepage_uri: https://github.com/hrittich/ovh_dnsup/blob/main/CHANGELOG.md
|
58
60
|
post_install_message:
|
59
61
|
rdoc_options: []
|
60
62
|
require_paths:
|