node-portscanner

An asynchronous port scanner for Node.js.

  • 所有者: baalexander/node-portscanner
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

portscanner

npm
JavaScript Style Guide

The portscanner module is
an asynchronous JavaScript port scanner for Node.js.

Portscanner can check a port,
or range of ports,
for 'open' or 'closed' statuses.

Looking for maintainer!

Install

npm install portscanner

Usage

A brief example:

var portscanner = require('portscanner')

// Checks the status of a single port
portscanner.checkPortStatus(3000, '127.0.0.1', function(error, status) {
  // Status is 'open' if currently in use or 'closed' if available
  console.log(status)
})

// Find the first available port. Asynchronously checks, so first port
// determined as available is returned.
portscanner.findAPortNotInUse(3000, 3010, '127.0.0.1', function(error, port) {
  console.log('AVAILABLE PORT AT: ' + port)
})

// Find the first port in use or blocked. Asynchronously checks, so first port
// to respond is returned.
portscanner.findAPortInUse(3000, 3010, '127.0.0.1', function(error, port) {
  console.log('PORT IN USE AT: ' + port)
})

// You can also pass array of ports to check
portscanner.findAPortInUse([3000, 3005, 3006], '127.0.0.1', function(error, port) {
  console.log('PORT IN USE AT: ' + port)
})

// And skip host param. Default is '127.0.0.1'
portscanner.findAPortNotInUse(3000, 4000, function(error, port) {
  console.log('PORT IN USE AT: ' + port)
})

// And use promises
portscanner.findAPortNotInUse(3000, 4000).then(function(port) {
  console.log('PORT IN USE AT: ' + port)
})

The example directory contains a more detailed example.

Test

npm test

Future

Please create issues or pull requests
for port scanning related features
you'd like to see included.

License (MIT)

MIT

主要指標

概覽
名稱與所有者baalexander/node-portscanner
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2011-08-11 22:23:11
推送於2024-09-08 10:10:57
最后一次提交2018-11-28 22:27:54
發布數5
最新版本名稱v1.0.0 (發布於 2014-06-21 20:59:54)
第一版名稱v0.2.0 (發布於 2014-02-05 15:31:18)
用户参与
星數297
關注者數8
派生數47
提交數87
已啟用問題?
問題數34
打開的問題數7
拉請求數16
打開的拉請求數4
關閉的拉請求數11
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?