Server Query Cache

In response to my servers being attacked by a exploit of Source Dedicated Server (srcds, the platform Team Fortress 2 instances run on), I developed SQC, which caches server responses to packets.

SQC has traffic transparently redirected to it which is either forwarded to the real game server to get a response, or the cached response is sent back to the client with forged IP/UDP headers.

SQC is threaded using pthreads, using a thread for each packet received. This avoids socket timeouts and errors.

SQC reduces latency, and drastically speeds up server search times in the browser and nullifies the effects of the exploit.

To develop it, packets had to be captured, inspected, and then crafted byte by byte to identify each request and the structure of its response. Using iptables TPROXY, it supports all game server instances on a machine and stores cache in memory.