Commit Graph

19 Commits

Author SHA1 Message Date
Simon Howard 9dca3ddca1 Send hole punch requests when adding servers.
If a server is behind a NAT gateway, we might not get a response when
we send it a query. However, a hole punch request may make it accessible.
After two seconds with no response, try a hole punch request and if we get
a reply, retry the request.

We keep state on which servers require hole punching and only allow hole
punch requests from clients if they are flagged as such.
2019-02-10 00:06:35 -05:00
Simon Howard 4d767457df Add hole punch forwarding to master server.
If a server is behind a NAT gateway or firewall its UDP port may be
accessible to the master server but not to other clients. For some types
of gateway we can work around this by having the servers explicitly send
a packet to the client that is trying to connect to them ("hole punching").
The master server can serve as a trampoline to forward this request from
clients.

This is the initial master server-side part of implementing
chocolate-doom/chocolate-doom#469.
2019-02-09 21:53:56 -05:00
Simon Howard 4c7861b2e0 Make master server work with Python 3.
As part of this, perform the `from __future__` imports so that as much
as possible resembles Python 3 even if we are running with Python 2.
2019-02-09 21:24:40 -05:00
Simon Howard c0975c8f53 Rework blocking.
Log attempts from banned servers and only block adds, not other
requests.
2016-06-12 21:23:05 -04:00
Simon Howard 118c62ba4b Add blocklist functionality. 2016-03-18 00:21:19 +00:00
Simon Howard a7f9439578 Report server age as integer.
This reduces the metadata response size slightly as we no longer need
to return a number of decimal points.
2016-01-21 05:10:02 +00:00
Simon Howard 87b5ff04ba Encode/decode as utf8.
I believe this fixed a bug that was occurring some time back.
2016-01-21 05:08:52 +00:00
Simon Howard 2cc103e783 Include a Message-Type: field so that end messages can only be generated
from start messages. Include millisecond precision in the time fields of
the messages for extra accuracy. Log nonce values and demo hashes.

Subversion-branch: /master
Subversion-revision: 2519
2012-08-04 23:32:17 +00:00
Simon Howard 6f54a0d8c1 Tweak maximum packet sizes.
Subversion-branch: /master
Subversion-revision: 2518
2012-08-04 16:10:03 +00:00
Simon Howard 9cea863e5d Include a copy of the nonce value separately from the GPG signature, so
it isn't necessary for the client to parse it.

Subversion-branch: /master
Subversion-revision: 2517
2012-08-04 02:02:13 +00:00
Simon Howard 6d2987c286 Add GPG signature generation, as the first step towards secure demo
support.

Subversion-branch: /master
Subversion-revision: 2516
2012-08-04 01:25:20 +00:00
Simon Howard da23130736 Fix rare crash with double-delete of timed-out servers.
Subversion-branch: /master
Subversion-revision: 2480
2011-12-01 01:58:06 +00:00
Simon Howard da3ab15169 Split master server configuration options into a separate file, refactor
so that the query socket can be bound to a specific address/port.

Subversion-branch: /master
Subversion-revision: 2229
2010-12-26 21:32:24 +00:00
Simon Howard 2687e6ddb5 Track age of servers. Display age on master server web page and sort by
decreasing age.

Subversion-branch: /master
Subversion-revision: 2219
2010-12-11 01:27:13 +00:00
Simon Howard 5432fd9b0f Periodically force queries of servers that are refreshing themselves, to
keep metadata up to date.

Subversion-branch: /master
Subversion-revision: 2205
2010-12-10 18:21:50 +00:00
Simon Howard 2d40ae549a Decode and save metadata acquired when querying new servers. Add a
metadata request message to retrieve the metadata that was obtained.

Subversion-branch: /master
Subversion-revision: 2194
2010-12-05 00:46:17 +00:00
Simon Howard 071f2aeffa Oops.
Subversion-branch: /master
Subversion-revision: 2189
2010-12-04 17:30:22 +00:00
Simon Howard 34b974d0f0 Verify servers that add themselves to the master by sending a query from
a different socket before accepting their request.  This blocks servers
that are behind NAT gateways and not globally accessible.

Subversion-branch: /master
Subversion-revision: 2188
2010-12-04 17:17:13 +00:00
Simon Howard 12d3df6db9 Add initial master server code.
Subversion-branch: /master
Subversion-revision: 2183
2010-12-02 19:28:06 +00:00