tuntap2
Version:
a opensource, asynchronized, napi-based, business friendly tuntap device driver addon for nodejs.
50 lines (49 loc) • 1.17 kB
TypeScript
import { Tuntap } from './src/ts/Tuntap';
/**
* Tun interface, a Layer 2 virtual interface.
* @class Tun
* @extends {TuntapB}
*/
declare class Tun extends Tuntap {
constructor();
/**
* setting the mac of a Tun interface is illegal as tun devices is running on layer 3
* @throws 'method not support by a tun device.'
* @memberof Tun
* @since 0.1.0
*/
set mac(mac: string);
}
/**
* Tap interface, a Layer 2 virtual interface.
* The tap device allows
* @class Tap
* @extends {TuntapB}
*/
declare class Tap extends Tuntap {
constructor();
}
/**
* a compatibility Wrapper for module `node-tuntap`
*
* @example
* ```js
* try {
var tt = tuntap({
type: 'tun', // 'tun' or 'tap'
mtu: 1500,
addr: '192.168.123.1',
mask: '255.255.255.192',
up: true,
//name is unacceptable
//dest,persist,ethtype_comp,running is not used
});
} catch(e) {
console.log('Tuntap creation error: ', e);
process.exit(0);
}
tt.pipe(tt);
* ```
*/
declare const tuntap: (options: any) => Tuntap;
export { Tap, Tun, tuntap };