Skip to content

Commit

Permalink
Adds README and MIT license.
Browse files Browse the repository at this point in the history
  • Loading branch information
baalexander committed Aug 11, 2011
1 parent e232efc commit 3a78761
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (c) 2011 Brandon Ace Alexander

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

## The What

The portscanner module is a pure JavaScript port scanner for node.js.

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

## The How

### To Install

NPM package coming soon. Needs more testing and features first. For now, require
the lib/portscanner.js file.

### To Use

A brief example:

```javascript
var portscanner = require('portscanner')

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

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

// Find the first available port. Asynchronously checks, so first port
// determined as available is returned.
portscanner.findAClosedPort(3000, 3010, 'localhost', function(error, port) {
console.log('CLOSED PORT AT ' + port)
})
```

Also check the example directory for more examples.

### To Test

Bleh. I am a fan of testing, but currently looking into an easier way to test
HTTP connections. If any ideas, please message me.

## The License (MIT)

Released under the MIT license. See the LICENSE file for the complete wording.

2 changes: 1 addition & 1 deletion example/portscan.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var portscanner = require('../lib/portscanner.js')

portscanner.checkPortStatus('3000', 'localhost', function(error, status) {
portscanner.checkPortStatus(3000, 'localhost', function(error, status) {
console.log(status)
})

Expand Down

0 comments on commit 3a78761

Please sign in to comment.