ddnsupdate 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +2 -0
- data/README.md +2 -1
- data/bin/ddnsupdate +2 -1
- data/lib/ddnsupdate.rb +3 -3
- metadata +51 -34
data/HISTORY
CHANGED
data/README.md
CHANGED
@@ -38,6 +38,7 @@ ddnsupdate <command> [options]
|
|
38
38
|
--host, -h <s>: Hostname to update
|
39
39
|
--remote, -r: Use remote IP (default: local ip)
|
40
40
|
--wild, -w: Add a wildcard on the same IP (i.e. *.host IN A ip)
|
41
|
+
--soa, -s: Specify soa/server to update instead of trying to autodetect
|
41
42
|
|
42
43
|
**Generate options:**
|
43
44
|
|
@@ -61,7 +62,7 @@ use.
|
|
61
62
|
|
62
63
|
After your setup is complete, periodicaly run:
|
63
64
|
|
64
|
-
ddnsupdate up -h <hostname> -k <
|
65
|
+
ddnsupdate up -h <hostname> -k <key>
|
65
66
|
|
66
67
|
This will update <hostname> with your local ip (usefull for testing on a
|
67
68
|
local network). If you want it to be your remote IP simply add `-r`.
|
data/bin/ddnsupdate
CHANGED
@@ -35,13 +35,14 @@ EOS
|
|
35
35
|
opt :host, "Hostname to update", :short => "-h", :type => :string
|
36
36
|
opt :remote, "Use remote IP (default: local ip)", :short => "-r"
|
37
37
|
opt :wild, "Add a wildcard on the same IP (i.e. *.host IN A ip)", :short => "-w"
|
38
|
+
opt :soa, "Use soa instead of trying to detect it", :short => "-s", :type => :string
|
38
39
|
end
|
39
40
|
Trollop::die "missing host" if cmd_opts[:host].nil?
|
40
41
|
Trollop::die "missing key" if cmd_opts[:key].nil?
|
41
42
|
|
42
43
|
ip = (cmd_opts[:remote] && determine_remote_ip) || determine_local_ip
|
43
44
|
|
44
|
-
puts "Host updated with ip #{ip}" if update(cmd_opts[:host], ip, cmd_opts[:key], cmd_opts[:wild])
|
45
|
+
puts "Host updated with ip #{ip}" if update(cmd_opts[:host], ip, cmd_opts[:key], cmd_opts[:wild], cmd_opts[:soa])
|
45
46
|
when "gen"
|
46
47
|
cmd_opts = Trollop::options do
|
47
48
|
banner <<-EOS
|
data/lib/ddnsupdate.rb
CHANGED
@@ -15,7 +15,7 @@ module DDNSUpdate
|
|
15
15
|
def self.determine_soa(zone)
|
16
16
|
current = zone.gsub(/\.$/, "")
|
17
17
|
soa = nil
|
18
|
-
while soa.nil? and
|
18
|
+
while soa.nil? and not current.match /\.*\..*/
|
19
19
|
soa = %x{dig -t SOA #{current} +noquestion +nostats +nocmd +noqr +nocomments +noadditional +nottlid}
|
20
20
|
if not soa.nil?
|
21
21
|
#Split lines into an array, filtering out comments and blanks
|
@@ -54,8 +54,8 @@ module DDNSUpdate
|
|
54
54
|
Net::HTTP.get(URI.parse('http://www.whatismyip.org/'))
|
55
55
|
end
|
56
56
|
|
57
|
-
def self.update(zone, ip, key, wild = false)
|
58
|
-
soa = determine_soa(zone)
|
57
|
+
def self.update(zone, ip, key, wild = false, soa = nil)
|
58
|
+
soa = determine_soa(zone) if soa.nil?
|
59
59
|
raise UpdateError, "can't find SOA for #{zone}" if soa.nil?
|
60
60
|
curip = determine_current_ip(zone, soa)
|
61
61
|
|
metadata
CHANGED
@@ -1,65 +1,82 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddnsupdate
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 2
|
8
|
+
- 0
|
9
|
+
version: 0.2.0
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Hugues Lismonde
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2011-09-09 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: trollop
|
16
|
-
|
17
|
-
|
18
|
-
requirements:
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
19
25
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 13
|
30
|
+
version: "1.13"
|
22
31
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
updates
|
32
|
+
version_requirements: *id001
|
33
|
+
description: |
|
34
|
+
DDNSUpdate is a wrapper around nsupdate to facilitate dynamic dns updates
|
27
35
|
|
28
|
-
'
|
29
36
|
email: hugues@epic.net
|
30
|
-
executables:
|
37
|
+
executables:
|
31
38
|
- ddnsupdate
|
32
39
|
extensions: []
|
40
|
+
|
33
41
|
extra_rdoc_files: []
|
34
|
-
|
42
|
+
|
43
|
+
files:
|
35
44
|
- HISTORY
|
36
45
|
- LICENSE
|
37
46
|
- README.md
|
38
47
|
- bin/ddnsupdate
|
39
48
|
- lib/ddnsupdate.rb
|
49
|
+
has_rdoc: true
|
40
50
|
homepage: https://github.com/epicagency/ddnsupdate/
|
41
51
|
licenses: []
|
52
|
+
|
42
53
|
post_install_message:
|
43
54
|
rdoc_options: []
|
44
|
-
|
55
|
+
|
56
|
+
require_paths:
|
45
57
|
- lib
|
46
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
segments:
|
63
|
+
- 1
|
64
|
+
- 8
|
65
|
+
- 6
|
51
66
|
version: 1.8.6
|
52
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
requirements:
|
59
75
|
- nsupdate, dig
|
60
76
|
rubyforge_project:
|
61
|
-
rubygems_version: 1.
|
77
|
+
rubygems_version: 1.3.6
|
62
78
|
signing_key:
|
63
79
|
specification_version: 3
|
64
80
|
summary: Performs dynamic dns updates
|
65
81
|
test_files: []
|
82
|
+
|