-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
47 lines (41 loc) · 1.37 KB
/
index.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
/// <reference types="node" />
import type { Buffer } from 'node:buffer'
import type { Readable, Writable, ReadableOptions, WritableOptions} from 'node:stream'
import type * as dgram from 'node:dgram'
export const DEFAULT_PORT: number
export interface MessageHead extends dgram.RemoteInfo {
body?: Buffer
}
export type UDPSocketOptions = ReadableOptions & dgram.SocketOptions & {
type?: dgram.SocketType
port?: number
address?: string,
pushMeta?: boolean
} | undefined
export class UDPSocket extends Readable {
constructor (options?: UDPSocketOptions)
push (chunk: Buffer | MessageHead | any, encoding: BufferEncoding): boolean
get origin (): dgram.Socket
get address (): string
get port (): number
get family (): string
get allowPush (): boolean
get pushMetaMode (): boolean
handleMessage (body: Buffer | any, head?: MessageHead | undefined): boolean
}
export type UDPClientOptions = WritableOptions & dgram.SocketOptions & {
type?: dgram.SocketType
port?: number
address?: string,
bindOptions?: dgram.BindOptions
} | undefined
export class UDPClient extends Writable {
constructor (options?: UDPClientOptions)
get origin (): dgram.Socket
get address (): string
get port (): number
get family (): string
get allowWrite (): boolean
get targetAddress (): string
get targetPort (): number
}