browsed 0.3.0 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -27
- data/browsed.gemspec +2 -3
- data/lib/browsed.rb +1 -1
- data/lib/browsed/chrome.rb +2 -2
- data/lib/browsed/client.rb +2 -2
- data/lib/browsed/firefox.rb +2 -2
- data/lib/browsed/version.rb +1 -1
- metadata +11 -164
- data/lib/browsed/proxies/proxy-chain-server/node_modules/.bin/portastic +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/LICENSE +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/README.md +0 -57
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/changelog.md +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.js +0 -3824
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.js +0 -5666
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/any.js +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/assert.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/async.js +0 -165
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bind.js +0 -67
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bluebird.js +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/call_get.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/cancel.js +0 -129
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/catch_filter.js +0 -42
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/context.js +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/debuggability.js +0 -934
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/direct_resolve.js +0 -46
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/each.js +0 -30
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/errors.js +0 -116
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/es5.js +0 -80
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/filter.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/finally.js +0 -146
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/generators.js +0 -223
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/join.js +0 -168
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/map.js +0 -168
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/method.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeback.js +0 -51
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeify.js +0 -58
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise.js +0 -789
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise_array.js +0 -185
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promisify.js +0 -314
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/props.js +0 -118
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/queue.js +0 -73
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/race.js +0 -49
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/reduce.js +0 -172
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/schedule.js +0 -62
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/settle.js +0 -43
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/some.js +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/synchronous_inspection.js +0 -103
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/thenables.js +0 -86
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/timers.js +0 -93
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/using.js +0 -226
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/util.js +0 -389
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/package.json +0 -102
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/CHANGELOG.md +0 -408
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/LICENSE +0 -22
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/Readme.md +0 -428
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/index.js +0 -1224
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/package.json +0 -70
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/typings/index.d.ts +0 -310
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.coveralls.yml +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.eslintrc +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.npmignore +0 -9
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.travis.yml +0 -14
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/CHANGELOG.md +0 -362
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/LICENSE +0 -19
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/Makefile +0 -50
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/README.md +0 -312
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/component.json +0 -19
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/karma.conf.js +0 -70
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/node.js +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/package.json +0 -88
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/browser.js +0 -185
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/debug.js +0 -202
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/index.js +0 -10
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/inspector-log.js +0 -15
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/node.js +0 -248
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/index.js +0 -152
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/license.md +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/package.json +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/readme.md +0 -51
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/LICENSE +0 -13
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/README.md +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic +0 -65
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/history.md +0 -7
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/index.js +0 -4
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/monitor.js +0 -59
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/portastic.js +0 -167
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/LICENSE +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/README.md +0 -677
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/changelog.md +0 -1730
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.js +0 -4892
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/any.js +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/assert.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/async.js +0 -150
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bind.js +0 -72
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bluebird.js +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/call_get.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/cancel.js +0 -48
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/captured_trace.js +0 -493
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/catch_filter.js +0 -66
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js +0 -38
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/debuggability.js +0 -162
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/direct_resolve.js +0 -63
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/each.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/errors.js +0 -111
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/es5.js +0 -80
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/filter.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/finally.js +0 -98
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/generators.js +0 -136
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/join.js +0 -107
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/map.js +0 -133
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/method.js +0 -44
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/nodeify.js +0 -59
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/progress.js +0 -76
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise.js +0 -759
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_array.js +0 -142
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_resolver.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promisify.js +0 -307
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/props.js +0 -79
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/queue.js +0 -90
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/race.js +0 -47
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/reduce.js +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/schedule.js +0 -35
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/settle.js +0 -40
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/some.js +0 -125
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/synchronous_inspection.js +0 -94
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/thenables.js +0 -84
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/timers.js +0 -64
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/using.js +0 -213
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/util.js +0 -321
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/package.json +0 -103
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/package.json +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/CHANGELOG.md +0 -109
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/LICENSE +0 -201
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/README.md +0 -278
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/anonymize_proxy.js +0 -100
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_base.js +0 -319
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_custom_response.js +0 -96
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_forward.js +0 -173
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_chain.js +0 -132
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_direct.js +0 -89
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_tcp_chain.js +0 -271
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/index.js +0 -26
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/run_locally.js +0 -66
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/server.js +0 -595
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tcp_tunnel.js +0 -138
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/testing_tcp_service.js +0 -37
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tools.js +0 -220
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/package.json +0 -104
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/LICENSE +0 -23
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/README.md +0 -28
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/package.json +0 -81
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js +0 -5
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js.map +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore.js +0 -1692
- data/lib/browsed/proxies/proxy-chain-server/package-lock.json +0 -63
- data/lib/browsed/proxies/proxy-chain-server/package.json +0 -15
- data/lib/browsed/proxies/proxy-chain-server/server.js +0 -25
- data/lib/browsed/proxies/proxy_chain.rb +0 -46
@@ -1,69 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_from": "ms@2.0.0",
|
3
|
-
"_id": "ms@2.0.0",
|
4
|
-
"_inBundle": false,
|
5
|
-
"_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
|
6
|
-
"_location": "/ms",
|
7
|
-
"_phantomChildren": {},
|
8
|
-
"_requested": {
|
9
|
-
"type": "version",
|
10
|
-
"registry": true,
|
11
|
-
"raw": "ms@2.0.0",
|
12
|
-
"name": "ms",
|
13
|
-
"escapedName": "ms",
|
14
|
-
"rawSpec": "2.0.0",
|
15
|
-
"saveSpec": null,
|
16
|
-
"fetchSpec": "2.0.0"
|
17
|
-
},
|
18
|
-
"_requiredBy": [
|
19
|
-
"/debug"
|
20
|
-
],
|
21
|
-
"_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
22
|
-
"_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8",
|
23
|
-
"_spec": "ms@2.0.0",
|
24
|
-
"_where": "/Users/sebastianjohnsson/Programming/Javascript/proxy-chain-server/node_modules/debug",
|
25
|
-
"bugs": {
|
26
|
-
"url": "https://github.com/zeit/ms/issues"
|
27
|
-
},
|
28
|
-
"bundleDependencies": false,
|
29
|
-
"deprecated": false,
|
30
|
-
"description": "Tiny milisecond conversion utility",
|
31
|
-
"devDependencies": {
|
32
|
-
"eslint": "3.19.0",
|
33
|
-
"expect.js": "0.3.1",
|
34
|
-
"husky": "0.13.3",
|
35
|
-
"lint-staged": "3.4.1",
|
36
|
-
"mocha": "3.4.1"
|
37
|
-
},
|
38
|
-
"eslintConfig": {
|
39
|
-
"extends": "eslint:recommended",
|
40
|
-
"env": {
|
41
|
-
"node": true,
|
42
|
-
"es6": true
|
43
|
-
}
|
44
|
-
},
|
45
|
-
"files": [
|
46
|
-
"index.js"
|
47
|
-
],
|
48
|
-
"homepage": "https://github.com/zeit/ms#readme",
|
49
|
-
"license": "MIT",
|
50
|
-
"lint-staged": {
|
51
|
-
"*.js": [
|
52
|
-
"npm run lint",
|
53
|
-
"prettier --single-quote --write",
|
54
|
-
"git add"
|
55
|
-
]
|
56
|
-
},
|
57
|
-
"main": "./index",
|
58
|
-
"name": "ms",
|
59
|
-
"repository": {
|
60
|
-
"type": "git",
|
61
|
-
"url": "git+https://github.com/zeit/ms.git"
|
62
|
-
},
|
63
|
-
"scripts": {
|
64
|
-
"lint": "eslint lib/* bin/*",
|
65
|
-
"precommit": "lint-staged",
|
66
|
-
"test": "mocha tests.js"
|
67
|
-
},
|
68
|
-
"version": "2.0.0"
|
69
|
-
}
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# ms
|
2
|
-
|
3
|
-
[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
|
4
|
-
[![Slack Channel](http://zeit-slackin.now.sh/badge.svg)](https://zeit.chat/)
|
5
|
-
|
6
|
-
Use this package to easily convert various time formats to milliseconds.
|
7
|
-
|
8
|
-
## Examples
|
9
|
-
|
10
|
-
```js
|
11
|
-
ms('2 days') // 172800000
|
12
|
-
ms('1d') // 86400000
|
13
|
-
ms('10h') // 36000000
|
14
|
-
ms('2.5 hrs') // 9000000
|
15
|
-
ms('2h') // 7200000
|
16
|
-
ms('1m') // 60000
|
17
|
-
ms('5s') // 5000
|
18
|
-
ms('1y') // 31557600000
|
19
|
-
ms('100') // 100
|
20
|
-
```
|
21
|
-
|
22
|
-
### Convert from milliseconds
|
23
|
-
|
24
|
-
```js
|
25
|
-
ms(60000) // "1m"
|
26
|
-
ms(2 * 60000) // "2m"
|
27
|
-
ms(ms('10 hours')) // "10h"
|
28
|
-
```
|
29
|
-
|
30
|
-
### Time format written-out
|
31
|
-
|
32
|
-
```js
|
33
|
-
ms(60000, { long: true }) // "1 minute"
|
34
|
-
ms(2 * 60000, { long: true }) // "2 minutes"
|
35
|
-
ms(ms('10 hours'), { long: true }) // "10 hours"
|
36
|
-
```
|
37
|
-
|
38
|
-
## Features
|
39
|
-
|
40
|
-
- Works both in [node](https://nodejs.org) and in the browser.
|
41
|
-
- If a number is supplied to `ms`, a string with a unit is returned.
|
42
|
-
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).
|
43
|
-
- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.
|
44
|
-
|
45
|
-
## Caught a bug?
|
46
|
-
|
47
|
-
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
48
|
-
2. Link the package to the global module directory: `npm link`
|
49
|
-
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, node will now use your clone of ms!
|
50
|
-
|
51
|
-
As always, you can run the tests using: `npm test`
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Copyright (c) 2015, Alan Hoffmeister <alanhoffmeister@gmail.com>
|
2
|
-
|
3
|
-
Permission to use, copy, modify, and distribute this software for any
|
4
|
-
purpose with or without fee is hereby granted, provided that the above
|
5
|
-
copyright notice and this permission notice appear in all copies.
|
6
|
-
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
8
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
9
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
10
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
11
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
12
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
13
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
@@ -1,148 +0,0 @@
|
|
1
|
-
# portastic
|
2
|
-
[![Coverage Status](https://coveralls.io/repos/alanhoff/node-portastic/badge.svg?branch=master)][0]
|
3
|
-
[![Travis](https://travis-ci.org/alanhoff/node-portastic.svg)][1]
|
4
|
-
[![Dependencies](https://david-dm.org/alanhoff/node-portastic.svg)][2]
|
5
|
-
|
6
|
-
Pure javascript swiss knife for port management. Find open ports, monitor ports
|
7
|
-
and other port relates things.
|
8
|
-
|
9
|
-
### API
|
10
|
-
|
11
|
-
* `portastic.test(port, [interface , [callback]])`
|
12
|
-
|
13
|
-
Test if a port is open. If a callback
|
14
|
-
is provided it will be called with an `error` parameter and a second parameter
|
15
|
-
with a `boolean` that tells if the port is open or not. If a callback is not
|
16
|
-
provided the return value will be a promise that will be fullfied with the
|
17
|
-
result.
|
18
|
-
|
19
|
-
```javascript
|
20
|
-
var portastic = require('portastic');
|
21
|
-
|
22
|
-
portastic.test(8080)
|
23
|
-
.then(function(isOpen){
|
24
|
-
console.log('Port 8080 is %s', isOpen ? 'open' : 'closed');
|
25
|
-
});
|
26
|
-
```
|
27
|
-
|
28
|
-
* `portastic.find(options, [interface, [callback]])`
|
29
|
-
|
30
|
-
Retrieve a list of open ports between `min` and `max`, if a callback is not
|
31
|
-
provided this method will resolve a promise with the results. Options can be:
|
32
|
-
|
33
|
-
* `min` The minimum port number to start with
|
34
|
-
* `max` The maximum port number to scan
|
35
|
-
* `retrieve` How many ports to collect
|
36
|
-
|
37
|
-
```javascript
|
38
|
-
var portastic = require('portastic');
|
39
|
-
|
40
|
-
portastic.find({
|
41
|
-
min: 8000,
|
42
|
-
max: 8080
|
43
|
-
})
|
44
|
-
.then(function(ports){
|
45
|
-
console.log('Ports available between 8000 and 8080 are: %s',
|
46
|
-
ports.join(', '));
|
47
|
-
});
|
48
|
-
```
|
49
|
-
|
50
|
-
* `portastic.filter(ports..., [interface, [callback]])`
|
51
|
-
|
52
|
-
Test a list of ports and return the open ones. If a callback is not provided
|
53
|
-
this method will resolve a promise with the results
|
54
|
-
|
55
|
-
```javascript
|
56
|
-
var portastic = require('portastic');
|
57
|
-
|
58
|
-
portastic.filter([8080, 8081, 8082])
|
59
|
-
.then(function(ports){
|
60
|
-
console.log('The available ports are: %s', ports.join(', '));
|
61
|
-
});
|
62
|
-
```
|
63
|
-
|
64
|
-
* `portastic.Monitor(ports...)`
|
65
|
-
|
66
|
-
Monitor is an `EventEmitter` that emits `open` when a monitored port is
|
67
|
-
available and `close` when the port has closed.
|
68
|
-
|
69
|
-
```javascript
|
70
|
-
var portastic = require('portastic');
|
71
|
-
var monitor = new portastic.Monitor([8080, 8081, 8082]);
|
72
|
-
|
73
|
-
monitor.on('open', function(port){
|
74
|
-
console.log('Port %s is open', port);
|
75
|
-
});
|
76
|
-
|
77
|
-
monitor.on('close', function(port){
|
78
|
-
console.log('Port %s is closed', port);
|
79
|
-
});
|
80
|
-
|
81
|
-
setTimeout(function(){
|
82
|
-
monitor.stop(); // Stops the monitoring after 5 seconds
|
83
|
-
}, 5000);
|
84
|
-
```
|
85
|
-
|
86
|
-
### Command line
|
87
|
-
|
88
|
-
It's also possible to use `portastic` as a command line utility, you just need
|
89
|
-
to install it globally with `npm install -g portastic`. Here is the help command
|
90
|
-
output.
|
91
|
-
|
92
|
-
```
|
93
|
-
|
94
|
-
Usage: portastic [options] [command]
|
95
|
-
|
96
|
-
|
97
|
-
Commands:
|
98
|
-
|
99
|
-
test|t <port> Test if a port is closed or open
|
100
|
-
find|f [options] <min> <max> Find ports that are available to use
|
101
|
-
filter|i <ports...> Find ports that are open whithin a list of ports
|
102
|
-
monitor|m <ports...> Monitor a list of ports and logs to the terminal when port state had changed
|
103
|
-
|
104
|
-
Options:
|
105
|
-
|
106
|
-
-h, --help output usage information
|
107
|
-
-V, --version output the version number
|
108
|
-
|
109
|
-
```
|
110
|
-
|
111
|
-
### Testing
|
112
|
-
|
113
|
-
```bash
|
114
|
-
git clone git@github.com:alanhoff/node-portastic.git
|
115
|
-
cd node-portastic
|
116
|
-
npm install && npm test
|
117
|
-
```
|
118
|
-
|
119
|
-
### Debugging
|
120
|
-
|
121
|
-
To see debug messages you must set your enviroment variable `DEBUG` to `*` or
|
122
|
-
`portastic:*`, example:
|
123
|
-
|
124
|
-
```bash
|
125
|
-
DEBUG=portastic:\* npm test
|
126
|
-
```
|
127
|
-
|
128
|
-
### License (ISC)
|
129
|
-
|
130
|
-
```
|
131
|
-
Copyright (c) 2015, Alan Hoffmeister <alanhoffmeister@gmail.com>
|
132
|
-
|
133
|
-
Permission to use, copy, modify, and distribute this software for any
|
134
|
-
purpose with or without fee is hereby granted, provided that the above
|
135
|
-
copyright notice and this permission notice appear in all copies.
|
136
|
-
|
137
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
138
|
-
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
139
|
-
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
140
|
-
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
141
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
142
|
-
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
143
|
-
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
144
|
-
```
|
145
|
-
|
146
|
-
[0]: https://coveralls.io/github/alanhoff/node-portastic
|
147
|
-
[1]: https://travis-ci.org/alanhoff/node-portastic
|
148
|
-
[2]: https://david-dm.org/alanhoff/node-portastic
|
@@ -1,65 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
|
3
|
-
var portastic = require('../');
|
4
|
-
var commander = require('commander');
|
5
|
-
var package = require('../package.json');
|
6
|
-
commander.version(package.version);
|
7
|
-
|
8
|
-
// Test if a port is closed
|
9
|
-
commander
|
10
|
-
.command('test <port>')
|
11
|
-
.alias('t')
|
12
|
-
.description('Test if a port is closed or open')
|
13
|
-
.action(function(port) {
|
14
|
-
portastic.test(port)
|
15
|
-
.then(function(result) {
|
16
|
-
console.log('Port %s is %s', port, result ? 'open' : 'closed');
|
17
|
-
});
|
18
|
-
});
|
19
|
-
|
20
|
-
// Find available ports
|
21
|
-
commander
|
22
|
-
.command('find <min> <max>')
|
23
|
-
.alias('f')
|
24
|
-
.description('Find ports that are available to use')
|
25
|
-
.option('-r, --retrieve', 'How many ports to retrieve')
|
26
|
-
.action(function(min, max, options) {
|
27
|
-
portastic.find({
|
28
|
-
min: min,
|
29
|
-
max: max,
|
30
|
-
retrieve: options.retrieve
|
31
|
-
})
|
32
|
-
.then(function(ports) {
|
33
|
-
console.log('Ports available to use: %s', ports.join(', '));
|
34
|
-
});
|
35
|
-
});
|
36
|
-
|
37
|
-
// Filter a list of ports
|
38
|
-
commander
|
39
|
-
.command('filter <ports...>')
|
40
|
-
.alias('i')
|
41
|
-
.description('Find ports that are open whithin a list of ports')
|
42
|
-
.action(function(ports) {
|
43
|
-
portastic.filter(ports)
|
44
|
-
.then(function() {
|
45
|
-
console.log('Ports available to use: %s', ports.join(', '));
|
46
|
-
});
|
47
|
-
});
|
48
|
-
|
49
|
-
// Monitor ports
|
50
|
-
commander
|
51
|
-
.command('monitor <ports...>')
|
52
|
-
.alias('m')
|
53
|
-
.description('Monitor a list of ports and logs to the terminal when port state had changed')
|
54
|
-
.action(function(ports) {
|
55
|
-
var monitor = new portastic.Monitor(ports);
|
56
|
-
monitor.on('open', function(port) {
|
57
|
-
console.log('Port %s is open', port);
|
58
|
-
});
|
59
|
-
|
60
|
-
monitor.on('close', function(port) {
|
61
|
-
console.log('Port %s is closed', port);
|
62
|
-
});
|
63
|
-
});
|
64
|
-
|
65
|
-
commander.parse(process.argv);
|
@@ -1,59 +0,0 @@
|
|
1
|
-
var portastic = require('./portastic');
|
2
|
-
var events = require('events');
|
3
|
-
var util = require('util');
|
4
|
-
|
5
|
-
var Monitor = function(ports, options) {
|
6
|
-
this._ports = ports;
|
7
|
-
this._options = options || {};
|
8
|
-
this._watchers = [];
|
9
|
-
|
10
|
-
if (this._options.autostart === false)
|
11
|
-
return;
|
12
|
-
|
13
|
-
this.start();
|
14
|
-
};
|
15
|
-
util.inherits(Monitor, events.EventEmitter);
|
16
|
-
|
17
|
-
Monitor.prototype.start = function() {
|
18
|
-
if (this._watchers.length)
|
19
|
-
return this.emit('error', new Error('Monitor already started'));
|
20
|
-
|
21
|
-
var that = this;
|
22
|
-
this._ports.forEach(function(port) {
|
23
|
-
that._watchers.push(that._watcher(port));
|
24
|
-
});
|
25
|
-
};
|
26
|
-
|
27
|
-
Monitor.prototype.stop = function() {
|
28
|
-
this._watchers.forEach(function(watcher) {
|
29
|
-
clearInterval(watcher.intervar);
|
30
|
-
});
|
31
|
-
|
32
|
-
this._watchers = [];
|
33
|
-
};
|
34
|
-
|
35
|
-
Monitor.prototype._watcher = function(port) {
|
36
|
-
var that = this;
|
37
|
-
var setup = {
|
38
|
-
state: null,
|
39
|
-
interval: setInterval(function() {
|
40
|
-
portastic.test(port)
|
41
|
-
.then(function(open) {
|
42
|
-
if (setup.state === open)
|
43
|
-
return;
|
44
|
-
|
45
|
-
that.emit(open ? 'open' : 'close', port);
|
46
|
-
setup.state = open;
|
47
|
-
})
|
48
|
-
.catch(function(err) {
|
49
|
-
process.nextTick(function() {
|
50
|
-
that.emit('error', err);
|
51
|
-
});
|
52
|
-
});
|
53
|
-
}, that._options.interval || 100)
|
54
|
-
};
|
55
|
-
|
56
|
-
return setup;
|
57
|
-
};
|
58
|
-
|
59
|
-
module.exports = Monitor;
|
@@ -1,167 +0,0 @@
|
|
1
|
-
var bluebird = require('bluebird');
|
2
|
-
var net = require('net');
|
3
|
-
var debug = require('debug');
|
4
|
-
|
5
|
-
module.exports = {
|
6
|
-
|
7
|
-
// Returns a promise that will be resolved with an array of open ports
|
8
|
-
test: bluebird.method(function(port, iface, callback) {
|
9
|
-
var that = this;
|
10
|
-
var log = debug('portastic:test');
|
11
|
-
var def = bluebird.defer();
|
12
|
-
|
13
|
-
// Callback handling
|
14
|
-
def.promise
|
15
|
-
.then(function(ports) {
|
16
|
-
if (!that._callback(callback, [ports]))
|
17
|
-
return ports;
|
18
|
-
})
|
19
|
-
.catch(function(err) {
|
20
|
-
if (!that._callback(callback, [err]))
|
21
|
-
throw err;
|
22
|
-
});
|
23
|
-
|
24
|
-
if (typeof iface !== 'string' && !callback) {
|
25
|
-
callback = iface;
|
26
|
-
iface = null;
|
27
|
-
}
|
28
|
-
|
29
|
-
var server = net.createServer();
|
30
|
-
|
31
|
-
server.on('error', function(err) {
|
32
|
-
if (err.code === 'EADDRINUSE') {
|
33
|
-
log('Port %s was in use', port);
|
34
|
-
return def.resolve(false);
|
35
|
-
}
|
36
|
-
|
37
|
-
def.reject(err);
|
38
|
-
});
|
39
|
-
|
40
|
-
server.on('close', function() {
|
41
|
-
log('TCP server on port %s closed', port);
|
42
|
-
def.resolve(true);
|
43
|
-
});
|
44
|
-
|
45
|
-
log('Trying to test port %s', port);
|
46
|
-
server.listen(port, iface, function(err) {
|
47
|
-
if (err && err.code === 'EADDRINUSE') {
|
48
|
-
log('Port %s was in use', port);
|
49
|
-
return def.resolve(false);
|
50
|
-
}
|
51
|
-
|
52
|
-
if (err)
|
53
|
-
return def.reject(err);
|
54
|
-
|
55
|
-
server.close(function(err) {
|
56
|
-
if (err)
|
57
|
-
return def.reject(err);
|
58
|
-
|
59
|
-
log('Port %s was free', port);
|
60
|
-
});
|
61
|
-
});
|
62
|
-
|
63
|
-
return def.promise;
|
64
|
-
}),
|
65
|
-
|
66
|
-
// Filter ports that are in use
|
67
|
-
filter: bluebird.method(function(ports, iface, callback) {
|
68
|
-
var that = this;
|
69
|
-
var log = debug('portastic:filter');
|
70
|
-
var def = bluebird.defer();
|
71
|
-
|
72
|
-
// Callback handling
|
73
|
-
def.promise
|
74
|
-
.then(function(ports) {
|
75
|
-
if (!that._callback(callback, [ports]))
|
76
|
-
return ports;
|
77
|
-
})
|
78
|
-
.catch(function(err) {
|
79
|
-
if (!that._callback(callback, [err]))
|
80
|
-
throw err;
|
81
|
-
});
|
82
|
-
|
83
|
-
if (typeof iface !== 'string' && !callback) {
|
84
|
-
callback = iface;
|
85
|
-
iface = null;
|
86
|
-
}
|
87
|
-
|
88
|
-
bluebird.all(ports)
|
89
|
-
.filter(function(port) {
|
90
|
-
log('Filtering port %s', port);
|
91
|
-
return that.test(port, iface);
|
92
|
-
})
|
93
|
-
.then(function(free) {
|
94
|
-
def.resolve(free);
|
95
|
-
})
|
96
|
-
.catch(function(err) {
|
97
|
-
def.reject(err);
|
98
|
-
});
|
99
|
-
|
100
|
-
return def.promise;
|
101
|
-
}),
|
102
|
-
|
103
|
-
// Find open ports in a range
|
104
|
-
find: bluebird.method(function(options, iface, callback) {
|
105
|
-
var log = debug('portastic:find');
|
106
|
-
var that = this;
|
107
|
-
var ports = [];
|
108
|
-
var result = [];
|
109
|
-
|
110
|
-
if (typeof iface !== 'string' && !callback) {
|
111
|
-
callback = iface;
|
112
|
-
iface = null;
|
113
|
-
}
|
114
|
-
|
115
|
-
for (var i = options.min; i <= options.max; i++)
|
116
|
-
ports.push(i);
|
117
|
-
|
118
|
-
log('Trying to find open ports between range %s and %s', options.min,
|
119
|
-
options.max);
|
120
|
-
|
121
|
-
var promise = bluebird.resolve(ports)
|
122
|
-
.each(function(port) {
|
123
|
-
return that.test(port, iface)
|
124
|
-
.then(function(open) {
|
125
|
-
if (options.retrieve && result.length >= options.retrieve) {
|
126
|
-
log('Result reached the maximum of %s ports, returning...',
|
127
|
-
options.retrieve);
|
128
|
-
return promise.cancel();
|
129
|
-
}
|
130
|
-
|
131
|
-
if (open) {
|
132
|
-
log('Port %s was open, adding it to the result list', port);
|
133
|
-
log('Pushing port %s to the result list', port);
|
134
|
-
return result.push(port);
|
135
|
-
} else
|
136
|
-
log('Port %s was not open', port);
|
137
|
-
});
|
138
|
-
})
|
139
|
-
.cancellable()
|
140
|
-
.catch(bluebird.CancellationError, function() {
|
141
|
-
return;
|
142
|
-
})
|
143
|
-
.then(function() {
|
144
|
-
if (!that._callback(callback, [ports]))
|
145
|
-
return result;
|
146
|
-
})
|
147
|
-
.catch(function(err) {
|
148
|
-
if (!that._callback(callback, [err]))
|
149
|
-
throw err;
|
150
|
-
});
|
151
|
-
|
152
|
-
return promise;
|
153
|
-
}),
|
154
|
-
|
155
|
-
// Handles callbacks
|
156
|
-
_callback: function(cb, args) {
|
157
|
-
if (cb) {
|
158
|
-
// This will bypass promises errors catching
|
159
|
-
process.nextTick(function() {
|
160
|
-
cb.apply(cb, args);
|
161
|
-
});
|
162
|
-
}
|
163
|
-
|
164
|
-
return !!cb;
|
165
|
-
}
|
166
|
-
|
167
|
-
};
|