Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

  1. var dgram = require("dgram");
  2. var server1 = dgram.createSocket("udp4");
  3. server1.bind(10001);
  4. var server2 = dgram.createSocket("udp4");
  5. server2.bind(10002);
  6. var server3 = dgram.createSocket("udp4");
  7. server3.bind(10003);
  8. var server4 = dgram.createSocket("udp4");
  9. server4.bind(10004);
  10. var server5 = dgram.createSocket("udp4");
  11. server5.bind(10005);
  12. var mapping = {
  13. 28015: server1,
  14. 28016: server2,
  15. 28017: server3,
  16. 28018: server4,
  17. 28019: server5,
  18. 25005: server1,
  19. 25006: server2,
  20. 25007: server3,
  21. 25008: server4,
  22. 25009: server5
  23. };
  24. var server = dgram.createSocket("udp4");
  25. server.on("error", function(err) {
  26. console.log("server error:\n" + err.stack);
  27. });
  28. server.on("message", function(msg, rinfo) {
  29. if (rinfo.port in mapping) {
  30. // eStats server
  31. mapping[rinfo.port].send(msg, 0, msg.length, 33702, "176.31.211.227");
  32. // HLTV server
  33. mapping[rinfo.port].send(msg, 0, msg.length, 30001, "web5.hltv.org");
  34. console.log("Forwaded", rinfo.address + ":" + rinfo.port, msg.toString());
  35. } else {
  36. console.log("NOT FORWARDED, NOT IN MAPPING", rinfo.address + ":" + rinfo.port, msg.toString());
  37. }
  38. });
  39. server.on("listening", function() {
  40. var address = server.address();
  41. console.log("server listening " + address.address + ":" + address.port);
  42. });
  43. server.bind(10000);