←back to thread

980 points nkcmr | 3 comments | | HN request time: 0s | source
1. mjsir911 ◴[] No.27416049[source]
This kind of service is exactly what STUN servers are made for. Designed to be used with webrtc, but it works perfectly alright by itself.

There are a plethora of unauthenticated STUN servers around, and while there's still room for abuse, the protocol is a bit more lightweight than full-blown http requests, and faster, too!

I've dabbled with doing this on my own, but I've found `myip` to do the job nicely and without hassle:

https://github.com/Snawoot/myip

replies(1): >>27416400 #
2. politelemon ◴[] No.27416400[source]
Can this be done using the stun command directly?

http://manpages.ubuntu.com/manpages/bionic/man1/stun.1.html

replies(1): >>27416743 #
3. Snawoot ◴[] No.27416743[source]
It is, but utility above queries multiple public STUN servers concurrently. As soon as quorum of servers replied with matching addresses, result is returned. This way it's more reliable and offers decent latency guarantees.