How/where is NAT traversal implemented?
Moderator: Moderators
How/where is NAT traversal implemented?
Been looking through files in rts/System/ and rts/System/Net but not seeing anything related to hole punching or nat traversal. Does that mean it's handled by the lobbies? Also does LuaLobby support NAT traversal?
Last edited by SpliFF on 03 Dec 2012, 06:47, edited 1 time in total.
Re: How/where is NAT traversal implemented?
exactly:
http://springrts.com/dl/LobbyProtocol/P ... NED:server
https://github.com/spring/SpringLS/blob ... nching.txt
and maybe: https://github.com/lunixbochs/uberserve ... l.py#L1297
http://springrts.com/dl/LobbyProtocol/P ... NED:server
https://github.com/spring/SpringLS/blob ... nching.txt
and maybe: https://github.com/lunixbochs/uberserve ... l.py#L1297
Last edited by abma on 03 Dec 2012, 06:53, edited 1 time in total.
Re: How/where is NAT traversal implemented?
Thanks, how about LuaLobby? I added that after you answered.
Re: How/where is NAT traversal implemented?
hehe, edited my answer, too..
lualobby will be removed in the next release, superseded by LuaSocket
and no, it didn't support nat transversal (afaik)
to implement hole-punching you've just to regulary send an udp packet to the game host+port... HolePunching.txt should answer all questions i think
lualobby will be removed in the next release, superseded by LuaSocket
and no, it didn't support nat transversal (afaik)
to implement hole-punching you've just to regulary send an udp packet to the game host+port... HolePunching.txt should answer all questions i think
Re: How/where is NAT traversal implemented?
Thanks, I did mean LuaSocket.
My understanding is that for LuaSocket or other connections not already tunnelled by the lobby server I would need a STUN server or TURN server (symmetric NAT) or UPnP implementation.
I'll be running at least one public server so I have the basic requirements except for the actual code.
Note, your UDP example assumes the server is public, I'm talking about a server hosted behind a NAT. The server would need to discover it's own public IP using a public server and that is basically what STUN does. I'm guessing Spring lobbies do the same thing but using the lobby protocol instead of STUN.
My understanding is that for LuaSocket or other connections not already tunnelled by the lobby server I would need a STUN server or TURN server (symmetric NAT) or UPnP implementation.
I'll be running at least one public server so I have the basic requirements except for the actual code.
Note, your UDP example assumes the server is public, I'm talking about a server hosted behind a NAT. The server would need to discover it's own public IP using a public server and that is basically what STUN does. I'm guessing Spring lobbies do the same thing but using the lobby protocol instead of STUN.
Re: How/where is NAT traversal implemented?
What do you want to do?
If i understood hole-punching right it works like this:
- lobby client S (spring server?!) connects with tcp to lobby.springrts.com:8200
- client S creates a battle saying i'm hole punching
- client X join
- lobby server sends ip/ports of X to client S
- client S sends udp packets to the known ip/ports
-> X should be able to connect to S...
what do you mean with tunnelled? afaik there is no tunnel? (tunnel in my understanding is to "tunnel" some connectiong trough a foreign / different protocol, like a tcp connection over a ssh session)
If i understood hole-punching right it works like this:
- lobby client S (spring server?!) connects with tcp to lobby.springrts.com:8200
- client S creates a battle saying i'm hole punching
- client X join
- lobby server sends ip/ports of X to client S
- client S sends udp packets to the known ip/ports
-> X should be able to connect to S...
what do you mean with tunnelled? afaik there is no tunnel? (tunnel in my understanding is to "tunnel" some connectiong trough a foreign / different protocol, like a tcp connection over a ssh session)
Re: How/where is NAT traversal implemented?
Host has local ip, behind the NAT that has external ip. TASServer should report in command BATTLEOPENED external ip. But when I create nat traversal battle in spring lobby, TASServer report local ip in BATTLEOPENED ( 192.168.x.x ). Thus hole punching failed.
Am I right, or hole punching work in other way?
Am I right, or hole punching work in other way?