Config for UDP connection request port (#221)
This commit is contained in:
1 parent
84e79bda9e
commit
6338f9f07c
3 files changed
+20
-7
No files matched your search
@@ -46,7 +46,13 @@ udpConReq = (address, un, key, callback) ->
|
||||
|
||||
message = Buffer.from("GET #{uri} HTTP/1.1\r\nHost: #{address}\r\n\r\n")
|
||||
|
||||
client = dgram.createSocket('udp4')
|
||||
client = dgram.createSocket({type: 'udp4', reuseAddr: true})
|
||||
UDP_CONNECTION_REQUEST_PORT = config.get('UDP_CONNECTION_REQUEST_PORT')
|
||||
if UDP_CONNECTION_REQUEST_PORT
|
||||
# When a device is NAT'ed, the UDP Connection Request must originate from the same address and port used by the STUN server, in order to traverse the firewall.
|
||||
# This does require that the Genieacs NBI and STUN server are allowed to bind to the same address and port.
|
||||
# The STUN server needs to open its UDP port with the SO_REUSEADDR option, allowing the NBI to also bind to the same port.
|
||||
client.bind({port: UDP_CONNECTION_REQUEST_PORT, exclusive: true})
|
||||
|
||||
count = 3
|
||||
client.send(message, 0, message.length, port, host, f = (err) ->
|
||||
|
||||
Reference in new issue
Block a user