Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 1.06 KB

File metadata and controls

46 lines (36 loc) · 1.06 KB

EaglerRelayJS

Eaglercraft relay server implementation written in TypeScript

Note

Most of the code was ported directly from the original java implementation, so there will probably be some bugs I missed.

Features:

  • Base relay server
  • IP forwarding
  • Origin whitelist
  • Join code customization
  • STUN / TURN server support
  • Rate limiting

Usage:

Standalone

$ npm install -g github:WebMCDevelopment/EaglerRelayJS
$ mkdir -p relay
$ cd relay
$ eaglerrelayjs --port 8080

Existing App

import http from 'http';
import express from 'express';
import { EaglerSPRelay } from 'eaglerrelayjs';

const app = express();
const server = http.createServer(app);
const relay = new EaglerSPRelay({ debug: true });

app.use((_req, res) => {
  res.set('Content-Type', 'text/plain');
  res.status(426).end('Upgrade Required');
});

server.on('upgrade', (req, socket, head) => relay.handleUpgrade(req, socket, head));
server.listen(8080);

Contributing:

Contributions are welcome, but please keep the code style consistent.