Thinkofname / steven-go

Go Minecraft Client
http://steven.thinkofdeath.uk/
Apache License 2.0
303 stars 26 forks source link

Check if SRV is online #65

Closed suedadam closed 9 years ago

suedadam commented 9 years ago

Check if the SRV information is online, allow a form of failover possibly for DDoS protection?

suedadam commented 9 years ago

Warning: I didn't test this.

Thinkofname commented 9 years ago

Look like you leak that connection (you never close it) also in what cases can this happen? Have you got an example server that does this

suedadam commented 9 years ago

Fixed, closes the connection now, sorry about that.

A lot of large servers do this as they mask it in front of a DDoS protection provider and use SRV records as most attackers don't really check SRV records.

Here is one example: -:~ suedadam$ dig +short pvp.desteria.com desteriaservice.ipv4.scrubbing.center. 31.220.13.50 -:~ suedadam$ dig +short srv minecraft pvp.desteria.com 131.153.3.250 131.153.4.2 131.153.3.218 -:~ suedadam$

Thinkofname commented 9 years ago

But if the srv record is provided minecraft uses it too and doesn't fallback on to the host/port combo on failure (last I checked?).

Also the second connection may trigger a throttle for some servers.

I just don't see how this could ever be used

suedadam commented 9 years ago

Minecraft's normal client doesn't check to see if it's online and failover, you're correct; however, why not make this client do it?

The first connection is just to see if it's online or not, it's not intended to be used and then instantly failover but to check if the SRV record is there, check if it's online and then join accordingly.

My example was just of servers that use SRV records, if this MC client becomes popular then people could in fact use this feature as a DDoS protection mechanic as putting one set of IPs under a SRV record and another set as a backend to a 3rd party DDoS protection service (IE: Staminus, InAbate, ProxyPipe, CeaseDDoS, etc.)

Thinkofname commented 9 years ago

https://github.com/thinkofdeath/steven/commit/b05c5dc520495f4bab153d196237326d8b34eb99