🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

kr-udp-proxy

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kr-udp-proxy

Async UDP Proxy

latest
Source
npmnpm
Version
1.0.12
Version published
Maintainers
1
Created
Source

What is This?

UDP proxy server library with Worker-Thread
Worker-Thread opens server and dupplicates message to Main Thread
So.. It cannot modifies data but Asynchronous!
It ONLY supports IPv4
It will keeps same port during 10secs

// TypeScript

import udpproxy = require('kr-udp-proxy');

class Client implements udpproxy.Client
{
    clientId:number; // undefined in constructor
    address:string; // undefined in constructor
    port:number; // undefined in constructor

    connected()
    {
    }

    message(origin:udpproxy.Origin, msg:Buffer)
    {
        /*
        // if sync option is true
        return null; // remove packet
        return Buffer.alloc(1); // modify packet
        */
    
        switch (origin)
        {
        case udpproxy.Origin.Server:
            console.log(`Server to ${this.address}:${this.port}> ${msg.toString('utf-8')}`);
            break;
        case udpproxy.Origin.Client:
            console.log(`${this.address}:${this.port} to Server> ${msg.toString('utf-8')}`);
            break;
        }
    }


    disconnected()
    {
    }
}

udpproxy.bind(()=>new Client, {
    // fromAddress: '0.0.0.0', 
    fromPort: 19134, 
    toAddress: '127.0.0.1', 
    toPort: 19132,
    // keepPortTimeout: 10000,
    // sync: false,
    // onError: err=>{ console.error(err); }
});

FAQs

Package last updated on 20 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts