Path: blob/main/third_party/closure-compiler/node-externs/net.js
6174 views
/*1* Copyright 2012 The Closure Compiler Authors.2*3* Licensed under the Apache License, Version 2.0 (the "License");4* you may not use this file except in compliance with the License.5* You may obtain a copy of the License at6*7* http://www.apache.org/licenses/LICENSE-2.08*9* Unless required by applicable law or agreed to in writing, software10* distributed under the License is distributed on an "AS IS" BASIS,11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12* See the License for the specific language governing permissions and13* limitations under the License.14*/1516/**17* @fileoverview Definitions for node's net module. Depends on the events and buffer modules.18* @see http://nodejs.org/api/net.html19* @see https://github.com/joyent/node/blob/master/lib/net.js20* @externs21* @author Daniel Wirtz <[email protected]>22*/2324/**25BEGIN_NODE_INCLUDE26var net = require('net');27END_NODE_INCLUDE28*/2930/**31* @type {Object.<string,*>}32*/33var net = {};3435/**36* @typedef {{allowHalfOpen: ?boolean}}37*/38net.CreateOptions;3940/**41* @param {(net.CreateOptions|function(...))=} options42* @param {function(...)=} connectionListener43* @return {net.Server}44*/45net.createServer = function(options, connectionListener) {};4647/**48* @typedef {{port: ?number, host: ?string, localAddress: ?string, path: ?string, allowHalfOpen: ?boolean}}49*/50net.ConnectOptions;5152/**53* @param {net.ConnectOptions|number|string} arg154* @param {(function(...)|string)=} arg255* @param {function(...)=} arg356*/57net.connect = function(arg1, arg2, arg3) {};5859/**60* @param {net.ConnectOptions|number|string} arg161* @param {(function(...)|string)=} arg262* @param {function(...)=} arg363*/64net.createConnection = function(arg1, arg2, arg3) {};6566/**67* @constructor68* @extends events.EventEmitter69*/70net.Server = function() {};7172/**73*74* @param {number|*} port75* @param {(string|number|function(...))=} host76* @param {(number|function(...))=} backlog77* @param {function(...)=} callback78*/79net.Server.prototype.listen = function(port, host, backlog, callback) {};8081/**82* @param {function(...)=} callback83*/84net.Server.prototype.close = function(callback) {};8586/**87* @return {{port: number, family: string, address: string}}88*/89net.Server.prototype.address = function() {};9091/**92* @type {number}93*/94net.Server.prototype.maxConnectinos;9596/**97* @type {number}98*/99net.Server.prototype.connections;100101/**102* @constructor103* @param {{fd: ?*, type: ?string, allowHalfOpen: ?boolean}=} options104* @extends events.EventEmitter105*/106net.Socket = function(options) {};107108/**109* @param {number|string|function(...)} port110* @param {(string|function(...))=} host111* @param {function(...)=} connectListener112*/113net.Socket.prototype.connect = function(port, host, connectListener) {};114115/**116* @type {number}117*/118net.Socket.prototype.bufferSize;119120/**121* @param {?string=} encoding122*/123net.Socket.prototype.setEncoding = function(encoding) {};124125/**126* @param {string|nodeBuffer.Buffer} data127* @param {(string|function(...))=}encoding128* @param {function(...)=} callback129*/130net.Socket.prototype.write = function(data, encoding, callback) {};131132/**133* @param {(string|nodeBuffer.Buffer)=}data134* @param {string=} encoding135*/136net.Socket.prototype.end = function(data, encoding) {};137138/**139*/140net.Socket.prototype.destroy = function() {};141142/**143*/144net.Socket.prototype.pause = function() {};145146/**147*/148net.Socket.prototype.resume = function() {};149150/**151* @param {number} timeout152* @param {function(...)=} callback153*/154net.Socket.prototype.setTimeout = function(timeout, callback) {};155156/**157* @param {boolean=} noDelay158*/159net.Socket.prototype.setNoDelay = function(noDelay) {};160161/**162* @param {(boolean|number)=} enable163* @param {number=} initialDelay164*/165net.Socket.prototype.setKeepAlive = function(enable, initialDelay) {};166167/**168* @return {string}169*/170net.Socket.prototype.address = function() {};171172/**173* @type {?string}174*/175net.Socket.prototype.remoteAddress;176177/**178* @type {?number}179*/180net.Socket.prototype.remotePort;181182/**183* @type {number}184*/185net.Socket.prototype.bytesRead;186187/**188* @type {number}189*/190net.Socket.prototype.bytesWritten;191192/**193* @param {*} input194* @return {number}195*/196net.isIP = function(input) {};197198/**199* @param {*} input200* @return {boolean}201*/202net.isIPv4 = function(input) {};203204/**205* @param {*} input206* @return {boolean}207*/208net.isIPv6 = function(input) {};209210211