natpmp 0.9 → 0.9.1
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/.gemtest +0 -0
- data/Gemfile +3 -0
- data/LICENSE +20 -0
- data/Rakefile +11 -0
- data/bin/natpmp +8 -12
- data/lib/natpmp.rb +1 -1
- data/lib/natpmp/version.rb +1 -1
- metadata +55 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5bc342344a2e984433de34dc071d77204fc8db69
|
|
4
|
+
data.tar.gz: 9ad73d6773aefc8f9d4efc287dd4f46928cdc0cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3861511a4c3176715aa8cba2884f93fb92a2e2a134fe72451a911aee39d82177d08320a5e83fd8022c9de97bcc52a6f8357447f7f86efa609e2734a3235556f
|
|
7
|
+
data.tar.gz: e7dc90a16aa49b2db6758857cdcf283e53072f45e15297de7548507491a386628b12c76eecf576c789aae4d1cad077997230d304fb0c9138fa9aeec1ef8fbcb8
|
data/.gemtest
ADDED
|
File without changes
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Nick Townsend
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/bin/natpmp
CHANGED
|
@@ -10,13 +10,9 @@ types = [:tcp, :udp]
|
|
|
10
10
|
opts = OpenStruct.new(port: nil, type: :tcp, verbose: false, public: 0, ttl: 7200)
|
|
11
11
|
|
|
12
12
|
OptionParser.new do |o|
|
|
13
|
-
o.banner = "usage: #{o.program_name} [options] [command]"
|
|
14
|
-
o.separator "Open a port on a NAT-PMP gateway. Options:"
|
|
13
|
+
o.banner = "usage: #{o.program_name} [options] [--] [command]"
|
|
14
|
+
o.separator "Open a port on a NAT-PMP gateway (v#{NATPMP::Version}). Options:"
|
|
15
15
|
|
|
16
|
-
o.on_tail( '-?', '--help', 'Display this screen' ) do
|
|
17
|
-
puts o
|
|
18
|
-
exit
|
|
19
|
-
end
|
|
20
16
|
o.on('-t', '--type TYPE', types, "Type: #{types.join(', ')} (default: #{opts.type})") do |t|
|
|
21
17
|
opts.type = t
|
|
22
18
|
end
|
|
@@ -32,17 +28,17 @@ OptionParser.new do |o|
|
|
|
32
28
|
o.on('-v', '--verbose', "Verbose") do
|
|
33
29
|
opts.verbose = true
|
|
34
30
|
end
|
|
35
|
-
o.on('--
|
|
36
|
-
|
|
37
|
-
exit
|
|
31
|
+
o.on( '-?', '--help', 'Display this screen' ) do
|
|
32
|
+
puts o
|
|
33
|
+
exit
|
|
38
34
|
end
|
|
39
|
-
o.separator "
|
|
35
|
+
o.separator "If a command string is used the following substitutions will be made:"
|
|
40
36
|
o.separator " %p the local port"
|
|
41
37
|
o.separator " %h the local IP address"
|
|
42
38
|
o.separator " %P the gateway port"
|
|
43
39
|
o.separator " %H the gateway IP address"
|
|
44
|
-
o.separator "
|
|
45
|
-
o.separator "
|
|
40
|
+
o.separator " %% to % (to avoid this)"
|
|
41
|
+
o.separator "When the command terminates the mapping will be removed"
|
|
46
42
|
o.parse! rescue (STDERR.puts "#{o.program_name}: #{$!}\n#{o.to_s}"; exit)
|
|
47
43
|
end
|
|
48
44
|
|
data/lib/natpmp.rb
CHANGED
|
@@ -107,7 +107,7 @@ class NATPMP
|
|
|
107
107
|
rsp = NATPMP.send [0, OPCODE[@type], 0, @priv, @pub, @maxlife||DEFAULT_LIFETIME].pack("CCnnnN")
|
|
108
108
|
(sssoe, priv, @mapped, @life) = rsp.unpack("x4NnnN")
|
|
109
109
|
raise "Port mismatch: requested #{@priv} received #{priv}" if @priv != priv
|
|
110
|
-
STDERR.puts "Mapped (at #{sssoe}) #{inspect}"
|
|
110
|
+
STDERR.puts "Mapped (at #{sssoe}) #{inspect}"
|
|
111
111
|
schedule_renew! if @maxlife.nil?
|
|
112
112
|
end
|
|
113
113
|
|
data/lib/natpmp/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,16 +1,56 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: natpmp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Townsend
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
13
|
-
|
|
11
|
+
date: 2014-03-03 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: minitest
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '4.3'
|
|
20
|
+
- - ">="
|
|
21
|
+
- !ruby/object:Gem::Version
|
|
22
|
+
version: 4.3.2
|
|
23
|
+
type: :development
|
|
24
|
+
prerelease: false
|
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
26
|
+
requirements:
|
|
27
|
+
- - "~>"
|
|
28
|
+
- !ruby/object:Gem::Version
|
|
29
|
+
version: '4.3'
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 4.3.2
|
|
33
|
+
- !ruby/object:Gem::Dependency
|
|
34
|
+
name: rake-compiler
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '0.9'
|
|
40
|
+
- - ">="
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: 0.9.2
|
|
43
|
+
type: :development
|
|
44
|
+
prerelease: false
|
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - "~>"
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '0.9'
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: 0.9.2
|
|
53
|
+
description: Client Interface to NAT Port Mapping Protocol
|
|
14
54
|
email:
|
|
15
55
|
- nick.townsend@mac.com
|
|
16
56
|
executables:
|
|
@@ -18,12 +58,16 @@ executables:
|
|
|
18
58
|
extensions: []
|
|
19
59
|
extra_rdoc_files: []
|
|
20
60
|
files:
|
|
61
|
+
- ".gemtest"
|
|
62
|
+
- Gemfile
|
|
63
|
+
- LICENSE
|
|
21
64
|
- README.md
|
|
22
|
-
-
|
|
65
|
+
- Rakefile
|
|
23
66
|
- bin/natpmp
|
|
67
|
+
- lib/natpmp.rb
|
|
24
68
|
- lib/natpmp/version.rb
|
|
25
69
|
- test/test_natpmp.rb
|
|
26
|
-
homepage: https://github.com/townsen/
|
|
70
|
+
homepage: https://github.com/townsen/natpmp
|
|
27
71
|
licenses:
|
|
28
72
|
- MIT
|
|
29
73
|
metadata: {}
|
|
@@ -33,19 +77,18 @@ require_paths:
|
|
|
33
77
|
- lib
|
|
34
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
35
79
|
requirements:
|
|
36
|
-
- -
|
|
80
|
+
- - ">="
|
|
37
81
|
- !ruby/object:Gem::Version
|
|
38
82
|
version: 1.9.2
|
|
39
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
40
84
|
requirements:
|
|
41
|
-
- -
|
|
85
|
+
- - ">="
|
|
42
86
|
- !ruby/object:Gem::Version
|
|
43
87
|
version: '0'
|
|
44
88
|
requirements: []
|
|
45
89
|
rubyforge_project:
|
|
46
|
-
rubygems_version: 2.
|
|
90
|
+
rubygems_version: 2.2.2
|
|
47
91
|
signing_key:
|
|
48
92
|
specification_version: 4
|
|
49
|
-
summary:
|
|
50
|
-
test_files:
|
|
51
|
-
- test/test_natpmp.rb
|
|
93
|
+
summary: Client NAT-PMP protocol
|
|
94
|
+
test_files: []
|