# kr-udp-proxy

> Async UDP Proxy

Latest version **1.0.12** (published 2019-07-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install kr-udp-proxy
pnpm add kr-udp-proxy
yarn add kr-udp-proxy
bun add kr-udp-proxy
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.12 |
| Published | 2019-07-20 |
| First published | 2019-07-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | karikera |

## Links

- npm: https://www.npmjs.com/package/kr-udp-proxy
- Repository: https://github.com/karikera/kr-udp-proxy
- Homepage: https://github.com/karikera/kr-udp-proxy#readme
- Issues: https://github.com/karikera/kr-udp-proxy/issues
- npm.io page: https://npm.io/package/kr-udp-proxy

## Recent versions

- 1.0.12 (latest) — 2019-07-20
- 1.0.11 — 2019-07-20
- 1.0.10 — 2019-07-19
- 1.0.9 — 2019-07-18
- 1.0.8 — 2019-07-18
- 1.0.7 — 2019-07-18
- 1.0.6 — 2019-07-18
- 1.0.5 — 2019-07-18
- 1.0.4 — 2019-07-18
- 1.0.3 — 2019-07-18
- 1.0.2 — 2019-07-18
- 1.0.1 — 2019-07-18
- 1.0.0 — 2019-07-18

## README

### 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  

```ts
// 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); }
});

```

---
_Source: https://npm.io/package/kr-udp-proxy · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
