stun-client 1.0 → 1.0.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/lib/stun-client/module.rb +1 -1
- data/lib/stun-client/rfc3489/discovery/nat.rb +3 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3a3dc75283f39519208d5be9521167433cb2a74542193cd47f70e8ce0e012dc
|
4
|
+
data.tar.gz: d30d85146266df9e4a6c05deb5aff18754fdfa06ff7197bf763cf77638877303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a357fb2721d222c4661175d5bf9c2da82b18172d249393ae99ee4223cd9f8850981b4574ef605144ba382e0c958babe8d0fcc026c9a7fb89c1bc60dbeaf292c
|
7
|
+
data.tar.gz: 77c64711ef67b299f3c1b4dc4c54914d38d23b066dddc7aa2ec840345d31bdabc0e6f45b7fd93a53958d939e446c48dee0cfcf3002c17317f7c1740631776eb3
|
data/lib/stun-client/module.rb
CHANGED
@@ -28,7 +28,7 @@ module StunClient
|
|
28
28
|
# are `:IPv4` or `:IPv6`.
|
29
29
|
def initialize host = nil, port = nil, protocol = :IPv4
|
30
30
|
raise ArgumentError, 'Host must be a string' if host && (! host.is_a? String)
|
31
|
-
raise ArgumentError, 'Port must be a integer' if port && (!
|
31
|
+
raise ArgumentError, 'Port must be a integer' if port && (! port.is_a? Integer)
|
32
32
|
|
33
33
|
case protocol
|
34
34
|
when :IPv6
|
@@ -114,16 +114,11 @@ module StunClient
|
|
114
114
|
if test2
|
115
115
|
flags << :full_cone_nat
|
116
116
|
else
|
117
|
-
|
118
|
-
# This occurs when the changed port is the same as the port the server responds
|
119
|
-
# with in the change port request. Since you have already punched a hole in the
|
120
|
-
# NAT with the previous request, the response from the STUN server gets through.
|
121
|
-
test3 = do_query @host, @port, change_port: true
|
122
|
-
|
123
|
-
test1v2 = do_query test1v1[:changed_address], test1v1[:changed_port].to_i
|
117
|
+
test1v2 = do_query test1v1[:changed_host], test1v1[:changed_port].to_i
|
124
118
|
if test1v2
|
125
119
|
if test1v1[:host] == test1v2[:host] &&
|
126
120
|
test1v1[:port] == test1v2[:port]
|
121
|
+
test3 = do_query @host, @port, change_port: true
|
127
122
|
if test3
|
128
123
|
flags << :restricted_nat
|
129
124
|
else
|