Guest User

Untitled

a guest
Aug 10th, 2022
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main(arg) {
  2.     const server = http.createServer();
  3.     const wss = new WebSocket.Server({ server });
  4.     server.listen(4444);
  5.  
  6.     wss.on("connection", function connection(wss) {
  7.       const ws = new WebSocket(
  8.         "wss://server.example.com",
  9.         {
  10.           agent: arg ? new SocksProxyAgent("socks://" + arg) : false, // socket5 proxy
  11.           headers: {
  12.             "User-Agent":
  13.               "Firefox/102.0",
  14.           },
  15.           origin: "https://example.com", // origin
  16.         }
  17.       );
  18.  
  19.       ws.on("message", function incoming(data) {
  20.         wss.send(data.toString());
  21.       });
  22.  
  23.       wss.on("message", function incoming(data) {
  24.         ws.send(data.toString());
  25.       });
  26.      
  27.     });
  28.   }
Advertisement
Add Comment
Please, Sign In to add comment