mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
net‑keepalive: Provides its own types (#45704)
This commit is contained in:
parent
2ce8388594
commit
d1564b4f31
@ -2994,6 +2994,12 @@
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/negative-zero",
|
||||
"asOfVersion": "3.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "net-keepalive",
|
||||
"typingsPackageName": "net-keepalive",
|
||||
"sourceRepoURL": "https://github.com/hertzg/node-net-keepalive",
|
||||
"asOfVersion": "1.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "new-github-issue-url",
|
||||
"typingsPackageName": "new-github-issue-url",
|
||||
|
||||
10
types/net-keepalive/index.d.ts
vendored
10
types/net-keepalive/index.d.ts
vendored
@ -1,10 +0,0 @@
|
||||
// Type definitions for net-keepalive 0.4
|
||||
// Project: https://github.com/hertzg/node-net-keepalive
|
||||
// Definitions by: George Kotchlamazashvili <https://github.com/hertzg>
|
||||
// Definitions: https://github.com/hertzg/node-net-keepalive
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export type NodeJSSocketWithFileDescriptor = NodeJS.Socket | { _handle: { _fd: number } }
|
||||
export function setKeepAliveProbes(socket: NodeJSSocketWithFileDescriptor, cnt: number): number
|
||||
export function setKeepAliveInterval(socket: NodeJSSocketWithFileDescriptor, intvl: number): number
|
||||
@ -1,21 +0,0 @@
|
||||
import NetKeepAlive = require('net-keepalive')
|
||||
import * as Net from 'net'
|
||||
|
||||
const server = Net.createServer((socket) => {
|
||||
socket.setKeepAlive(true, 1000)
|
||||
NetKeepAlive.setKeepAliveInterval(socket, 1000)
|
||||
NetKeepAlive.setKeepAliveProbes(socket, 1)
|
||||
socket.on('end', () => server.close())
|
||||
})
|
||||
|
||||
server.listen(1337, '127.0.0.1', () => {
|
||||
const {port, address} = server.address() as Net.AddressInfo
|
||||
const clientSocket = Net.createConnection({
|
||||
port, host: address
|
||||
}, () => {
|
||||
clientSocket.setKeepAlive(true, 1000)
|
||||
NetKeepAlive.setKeepAliveInterval(clientSocket, 1000)
|
||||
NetKeepAlive.setKeepAliveProbes(clientSocket, 1)
|
||||
clientSocket.end()
|
||||
})
|
||||
})
|
||||
@ -1,23 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"net-keepalive-tests.ts"
|
||||
]
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"eofline": false,
|
||||
"indent": [
|
||||
true,
|
||||
"spaces",
|
||||
4
|
||||
],
|
||||
"semicolon": false
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user