forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wake_on_lan.d.ts
73 lines (60 loc) · 1.9 KB
/
wake_on_lan.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Type definitions for wake_on_lan
// Project: https://github.com/agnat/node_wake_on_lan
// Definitions by: Tobias Kahlert <https://github.com/SrTobi>
// Definitions: https://github.com/SrTobi/DefinitelyTyped
/// <reference path="../node/node.d.ts"/>
declare module wol {
export interface WakeOptions {
/**
* The ip address to which the packet is send (default: 255.255.255.255)
*/
address?:string;
/**
* Number of packets to send (default: 3)
*/
num_packets?:number;
/**
* The interval between packets (default: 100ms)
*/
interval?:number;
/**
* The port to send to (default: 9)
*/
port?:number;
}
type ErrorCallback = (Error:any) => void;
export interface Wol {
/**
* Send a sequence of Wake-on-LAN magic packets to the given MAC address.
*
* @param {string} macAddress the mac address of the target device
*/
wake(macAddress:string):void;
/**
* Send a sequence of Wake-on-LAN magic packets to the given MAC address.
*
* @param {string} macAddress the mac address of the target device
* @param {ErrorCallback} callback is called when all packets have been sent or an error occurs.
*/
wake(macAddress:string, callback:ErrorCallback):void;
/**
* Send a sequence of Wake-on-LAN magic packets to the given MAC address.
*
* @param {string} macAddress the mac address of the target device
* @param {WakeOptions} opts additional options to send the packet
* @param {ErrorCallback} callback is called when all packets have been sent or an error occurs.
*/
wake(macAddress:string, opts:WakeOptions, callback?:Function):void;
/**
* Creates a buffer with a magic packet for the given MAC address.
*
* @param {string} macAddress mac address of the target device
* @return {Buffer} the magic packet
*/
createMagicPacket(macAddress:string):Buffer;
}
}
declare module 'wake_on_lan' {
var wol: wol.Wol;
export = wol;
}