Skip to content

Commit 0c47428

Browse files
committed
Update dns and dgram modules
1 parent d82e7f7 commit 0c47428

File tree

4 files changed

+172
-22
lines changed

4 files changed

+172
-22
lines changed

0.10/node.d.ts

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,31 @@ declare module "dns" {
10041004
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
10051005
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
10061006
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[];
1007+
1008+
export const NODATA: 'ENODATA';
1009+
export const FORMERR: 'EFORMERR';
1010+
export const SERVFAIL: 'ESERVFAIL';
1011+
export const NOTFOUND: 'ENOTFOUND';
1012+
export const NOTIMP: 'ENOTIMP';
1013+
export const REFUSED: 'EREFUSED';
1014+
export const BADQUERY: 'EBADQUERY';
1015+
export const BADNAME: 'EBADNAME';
1016+
export const BADFAMILY: 'EBADFAMILY';
1017+
export const BADRESP: 'EBADRESP';
1018+
export const CONNREFUSED: 'ECONNREFUSED';
1019+
export const TIMEOUT: 'ETIMEOUT';
1020+
export const EOF: 'EOF';
1021+
export const FILE: 'EFILE';
1022+
export const NOMEM: 'ENOMEM';
1023+
export const DESTRUCTION: 'EDESTRUCTION';
1024+
export const BADSTR: 'EBADSTR';
1025+
export const BADFLAGS: 'EBADFLAGS';
1026+
export const NONAME: 'ENONAME';
1027+
export const BADHINTS: 'EBADHINTS';
1028+
export const NOTINITIALIZED: 'ENOTINITIALIZED';
1029+
export const LOADIPHLPAPI: 'ELOADIPHLPAPI';
1030+
export const ADDRGETNETWORKPARAMS: 'EADDRGETNETWORKPARAMS';
1031+
export const CANCELLED: 'ECANCELLED';
10071032
}
10081033

10091034
declare module "net" {
@@ -1071,32 +1096,36 @@ declare module "net" {
10711096
}
10721097

10731098
declare module "dgram" {
1074-
import events = require("events");
1099+
import * as events from "events";
10751100

1076-
interface RemoteInfo {
1101+
export interface RemoteInfo {
10771102
address: string;
10781103
port: number;
10791104
size: number;
10801105
}
10811106

1082-
interface AddressInfo {
1107+
export interface AddressInfo {
10831108
address: string;
10841109
family: string;
10851110
port: number;
10861111
}
10871112

10881113
export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
10891114

1090-
interface Socket extends events.EventEmitter {
1091-
send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
1115+
export class Socket extends events.EventEmitter {
1116+
send(msg: Buffer | string | Array<Buffer | string>, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
1117+
send(msg: Buffer | string | Array<Buffer | string>, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
10921118
bind(port: number, address?: string, callback?: () => void): void;
1093-
close(): void;
1119+
close(callback?: () => void): void;
1120+
setTTL(ttl: number): void;
10941121
address(): AddressInfo;
10951122
setBroadcast(flag: boolean): void;
10961123
setMulticastTTL(ttl: number): void;
10971124
setMulticastLoopback(flag: boolean): void;
10981125
addMembership(multicastAddress: string, multicastInterface?: string): void;
10991126
dropMembership(multicastAddress: string, multicastInterface?: string): void;
1127+
ref(): void;
1128+
unref(): void;
11001129
}
11011130
}
11021131

0.12/node.d.ts

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,31 @@ declare module "dns" {
12621262
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
12631263
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
12641264
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[];
1265+
1266+
export const NODATA: 'ENODATA';
1267+
export const FORMERR: 'EFORMERR';
1268+
export const SERVFAIL: 'ESERVFAIL';
1269+
export const NOTFOUND: 'ENOTFOUND';
1270+
export const NOTIMP: 'ENOTIMP';
1271+
export const REFUSED: 'EREFUSED';
1272+
export const BADQUERY: 'EBADQUERY';
1273+
export const BADNAME: 'EBADNAME';
1274+
export const BADFAMILY: 'EBADFAMILY';
1275+
export const BADRESP: 'EBADRESP';
1276+
export const CONNREFUSED: 'ECONNREFUSED';
1277+
export const TIMEOUT: 'ETIMEOUT';
1278+
export const EOF: 'EOF';
1279+
export const FILE: 'EFILE';
1280+
export const NOMEM: 'ENOMEM';
1281+
export const DESTRUCTION: 'EDESTRUCTION';
1282+
export const BADSTR: 'EBADSTR';
1283+
export const BADFLAGS: 'EBADFLAGS';
1284+
export const NONAME: 'ENONAME';
1285+
export const BADHINTS: 'EBADHINTS';
1286+
export const NOTINITIALIZED: 'ENOTINITIALIZED';
1287+
export const LOADIPHLPAPI: 'ELOADIPHLPAPI';
1288+
export const ADDRGETNETWORKPARAMS: 'EADDRGETNETWORKPARAMS';
1289+
export const CANCELLED: 'ECANCELLED';
12651290
}
12661291

12671292
declare module "net" {
@@ -1331,30 +1356,46 @@ declare module "net" {
13311356
declare module "dgram" {
13321357
import * as events from "events";
13331358

1334-
interface RemoteInfo {
1359+
export interface RemoteInfo {
13351360
address: string;
13361361
port: number;
13371362
size: number;
13381363
}
13391364

1340-
interface AddressInfo {
1365+
export interface AddressInfo {
13411366
address: string;
13421367
family: string;
13431368
port: number;
13441369
}
13451370

1346-
export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
1371+
export interface BindOptions {
1372+
port: number;
1373+
address?: string;
1374+
exclusive?: boolean;
1375+
}
1376+
1377+
export interface SocketOptions {
1378+
type: string;
1379+
reuseAddr?: boolean;
1380+
}
13471381

1348-
interface Socket extends events.EventEmitter {
1349-
send(buf: Buffer, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
1382+
export function createSocket(type: string | SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
1383+
1384+
export class Socket extends events.EventEmitter {
1385+
send(msg: Buffer | string | Array<Buffer | string>, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
1386+
send(msg: Buffer | string | Array<Buffer | string>, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
13501387
bind(port: number, address?: string, callback?: () => void): void;
1351-
close(): void;
1388+
bind(options: BindOptions, callback?: () => void): void;
1389+
close(callback?: () => void): void;
1390+
setTTL(ttl: number): void;
13521391
address(): AddressInfo;
13531392
setBroadcast(flag: boolean): void;
13541393
setMulticastTTL(ttl: number): void;
13551394
setMulticastLoopback(flag: boolean): void;
13561395
addMembership(multicastAddress: string, multicastInterface?: string): void;
13571396
dropMembership(multicastAddress: string, multicastInterface?: string): void;
1397+
ref(): void;
1398+
unref(): void;
13581399
}
13591400
}
13601401

4.0/node.d.ts

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,31 @@ declare module "dns" {
14601460
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
14611461
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
14621462
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[];
1463+
1464+
export const NODATA: 'ENODATA';
1465+
export const FORMERR: 'EFORMERR';
1466+
export const SERVFAIL: 'ESERVFAIL';
1467+
export const NOTFOUND: 'ENOTFOUND';
1468+
export const NOTIMP: 'ENOTIMP';
1469+
export const REFUSED: 'EREFUSED';
1470+
export const BADQUERY: 'EBADQUERY';
1471+
export const BADNAME: 'EBADNAME';
1472+
export const BADFAMILY: 'EBADFAMILY';
1473+
export const BADRESP: 'EBADRESP';
1474+
export const CONNREFUSED: 'ECONNREFUSED';
1475+
export const TIMEOUT: 'ETIMEOUT';
1476+
export const EOF: 'EOF';
1477+
export const FILE: 'EFILE';
1478+
export const NOMEM: 'ENOMEM';
1479+
export const DESTRUCTION: 'EDESTRUCTION';
1480+
export const BADSTR: 'EBADSTR';
1481+
export const BADFLAGS: 'EBADFLAGS';
1482+
export const NONAME: 'ENONAME';
1483+
export const BADHINTS: 'EBADHINTS';
1484+
export const NOTINITIALIZED: 'ENOTINITIALIZED';
1485+
export const LOADIPHLPAPI: 'ELOADIPHLPAPI';
1486+
export const ADDRGETNETWORKPARAMS: 'EADDRGETNETWORKPARAMS';
1487+
export const CANCELLED: 'ECANCELLED';
14631488
}
14641489

14651490
declare module "net" {
@@ -1546,31 +1571,46 @@ declare module "net" {
15461571
declare module "dgram" {
15471572
import * as events from "events";
15481573

1549-
interface RemoteInfo {
1574+
export interface RemoteInfo {
15501575
address: string;
15511576
port: number;
15521577
size: number;
15531578
}
15541579

1555-
interface AddressInfo {
1580+
export interface AddressInfo {
15561581
address: string;
15571582
family: string;
15581583
port: number;
15591584
}
15601585

1561-
export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
1586+
export interface BindOptions {
1587+
port: number;
1588+
address?: string;
1589+
exclusive?: boolean;
1590+
}
1591+
1592+
export interface SocketOptions {
1593+
type: string;
1594+
reuseAddr?: boolean;
1595+
}
1596+
1597+
export function createSocket(type: string | SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
15621598

1563-
interface Socket extends events.EventEmitter {
1599+
export class Socket extends events.EventEmitter {
15641600
send(msg: Buffer | string | Array<Buffer | string>, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
15651601
send(msg: Buffer | string | Array<Buffer | string>, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
15661602
bind(port: number, address?: string, callback?: () => void): void;
1567-
close(): void;
1603+
bind(options: BindOptions, callback?: () => void): void;
1604+
close(callback?: () => void): void;
1605+
setTTL(ttl: number): void;
15681606
address(): AddressInfo;
15691607
setBroadcast(flag: boolean): void;
15701608
setMulticastTTL(ttl: number): void;
15711609
setMulticastLoopback(flag: boolean): void;
15721610
addMembership(multicastAddress: string, multicastInterface?: string): void;
15731611
dropMembership(multicastAddress: string, multicastInterface?: string): void;
1612+
ref(): void;
1613+
unref(): void;
15741614
}
15751615
}
15761616

6.0/node.d.ts

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,6 +1503,31 @@ declare module "dns" {
15031503
export function resolveNs(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
15041504
export function resolveCname(domain: string, callback: (err: Error, addresses: string[]) => void): string[];
15051505
export function reverse(ip: string, callback: (err: Error, domains: string[]) => void): string[];
1506+
1507+
export const NODATA: 'ENODATA';
1508+
export const FORMERR: 'EFORMERR';
1509+
export const SERVFAIL: 'ESERVFAIL';
1510+
export const NOTFOUND: 'ENOTFOUND';
1511+
export const NOTIMP: 'ENOTIMP';
1512+
export const REFUSED: 'EREFUSED';
1513+
export const BADQUERY: 'EBADQUERY';
1514+
export const BADNAME: 'EBADNAME';
1515+
export const BADFAMILY: 'EBADFAMILY';
1516+
export const BADRESP: 'EBADRESP';
1517+
export const CONNREFUSED: 'ECONNREFUSED';
1518+
export const TIMEOUT: 'ETIMEOUT';
1519+
export const EOF: 'EOF';
1520+
export const FILE: 'EFILE';
1521+
export const NOMEM: 'ENOMEM';
1522+
export const DESTRUCTION: 'EDESTRUCTION';
1523+
export const BADSTR: 'EBADSTR';
1524+
export const BADFLAGS: 'EBADFLAGS';
1525+
export const NONAME: 'ENONAME';
1526+
export const BADHINTS: 'EBADHINTS';
1527+
export const NOTINITIALIZED: 'ENOTINITIALIZED';
1528+
export const LOADIPHLPAPI: 'ELOADIPHLPAPI';
1529+
export const ADDRGETNETWORKPARAMS: 'EADDRGETNETWORKPARAMS';
1530+
export const CANCELLED: 'ECANCELLED';
15061531
}
15071532

15081533
declare module "net" {
@@ -1589,31 +1614,46 @@ declare module "net" {
15891614
declare module "dgram" {
15901615
import * as events from "events";
15911616

1592-
interface RemoteInfo {
1617+
export interface RemoteInfo {
15931618
address: string;
15941619
port: number;
15951620
size: number;
15961621
}
15971622

1598-
interface AddressInfo {
1623+
export interface AddressInfo {
15991624
address: string;
16001625
family: string;
16011626
port: number;
16021627
}
16031628

1604-
export function createSocket(type: string, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
1629+
export interface BindOptions {
1630+
port: number;
1631+
address?: string;
1632+
exclusive?: boolean;
1633+
}
1634+
1635+
export interface SocketOptions {
1636+
type: string;
1637+
reuseAddr?: boolean;
1638+
}
1639+
1640+
export function createSocket(type: string | SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket;
16051641

1606-
interface Socket extends events.EventEmitter {
1642+
export class Socket extends events.EventEmitter {
16071643
send(msg: Buffer | string | Array<Buffer | string>, offset: number, length: number, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
16081644
send(msg: Buffer | string | Array<Buffer | string>, port: number, address: string, callback?: (error: Error, bytes: number) => void): void;
16091645
bind(port: number, address?: string, callback?: () => void): void;
1610-
close(): void;
1646+
bind(options: BindOptions, callback?: () => void): void;
1647+
close(callback?: () => void): void;
1648+
setTTL(ttl: number): void;
16111649
address(): AddressInfo;
16121650
setBroadcast(flag: boolean): void;
16131651
setMulticastTTL(ttl: number): void;
16141652
setMulticastLoopback(flag: boolean): void;
16151653
addMembership(multicastAddress: string, multicastInterface?: string): void;
16161654
dropMembership(multicastAddress: string, multicastInterface?: string): void;
1655+
ref(): void;
1656+
unref(): void;
16171657
}
16181658
}
16191659

0 commit comments

Comments
 (0)