webrtcxirsys

How to get closest Xirsys STUN/TURN servers for a user's region when proxying the request through our server


Xirsys docs say that for security you should always proxy requests for a list of STUN/TURN servers through your web server, rather than making the request to Xirsys directly from the client. This makes sense. But they also state that "In order to really benefit from all the global locations, you can use the global.xirsys.net path in your calls. The global.xirsys.net path will auto detect the user's location and return the closest available geographic region so the user gets the fastest responses possible."

However, our web server is hosted in one region. And our web server is making the request to global.xirsys.net. So xirsys always returns the closest region to our server, not to the user.

Can I somehow modify the request to Xirsys to provide the user's IP address? (presumably that's how it figures out the user's region...) or is there some other approach that would work other than doing the IP > region lookup ourselves and sending our request to the nearest Xirsys region's server?

References:


Solution

  • the xirsys-examples-v3 (https://github.com/xirsys/xirsys-examples-v3) now supports geolocation via maxmind (https://github.com/runk/node-maxmind). By default, the xirsys-examples-v3 app uses the free databases found in geolite2 (https://github.com/runk/node-geolite2) but we strongly recommend "Using GeoIP Update"(https://dev.maxmind.com/geoip/geoipupdate/#Using_GeoIP_Update) then overriding the maxmind db path found in the default.json config file.