proxy_chain_rb 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +41 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +6 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/proxy_chain_rb.rb +7 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/.bin/portastic +1 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/LICENSE +21 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/README.md +57 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/changelog.md +1 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.js +3824 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.min.js +31 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.js +5666 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.min.js +31 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/any.js +21 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/assert.js +55 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/async.js +165 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/bind.js +67 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/bluebird.js +11 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/call_get.js +123 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/cancel.js +129 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/catch_filter.js +42 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/context.js +69 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/debuggability.js +934 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/direct_resolve.js +46 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/each.js +30 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/errors.js +116 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/es5.js +80 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/filter.js +12 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/finally.js +146 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/generators.js +223 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/join.js +168 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/map.js +168 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/method.js +55 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/nodeback.js +51 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/nodeify.js +58 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/promise.js +789 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/promise_array.js +185 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/promisify.js +314 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/props.js +118 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/queue.js +73 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/race.js +49 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/reduce.js +172 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/schedule.js +62 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/settle.js +43 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/some.js +148 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/synchronous_inspection.js +103 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/thenables.js +86 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/timers.js +93 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/using.js +226 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/js/release/util.js +389 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/bluebird/package.json +102 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/commander/CHANGELOG.md +408 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/commander/LICENSE +22 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/commander/Readme.md +428 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/commander/index.js +1224 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/commander/package.json +70 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/commander/typings/index.d.ts +310 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/.coveralls.yml +1 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/.eslintrc +11 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/.npmignore +9 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/.travis.yml +14 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/CHANGELOG.md +362 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/LICENSE +19 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/Makefile +50 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/README.md +312 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/component.json +19 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/karma.conf.js +70 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/node.js +1 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/package.json +88 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/src/browser.js +185 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/src/debug.js +202 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/src/index.js +10 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/src/inspector-log.js +15 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/debug/src/node.js +248 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/ms/index.js +152 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/ms/license.md +21 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/ms/package.json +69 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/ms/readme.md +51 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/LICENSE +13 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/README.md +148 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/bin/portastic +65 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/history.md +7 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/index.js +4 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/lib/monitor.js +59 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/lib/portastic.js +167 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/LICENSE +21 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/README.md +677 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/changelog.md +1730 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.js +4892 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.min.js +31 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/any.js +21 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/assert.js +55 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/async.js +150 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bind.js +72 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bluebird.js +11 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/call_get.js +123 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/cancel.js +48 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/captured_trace.js +493 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/catch_filter.js +66 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js +38 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/debuggability.js +162 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/direct_resolve.js +63 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/each.js +12 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/errors.js +111 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/es5.js +80 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/filter.js +12 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/finally.js +98 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/generators.js +136 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/join.js +107 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/map.js +133 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/method.js +44 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/nodeify.js +59 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/progress.js +76 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise.js +759 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_array.js +142 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_resolver.js +123 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promisify.js +307 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/props.js +79 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/queue.js +90 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/race.js +47 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/reduce.js +148 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/schedule.js +35 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/settle.js +40 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/some.js +125 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/synchronous_inspection.js +94 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/thenables.js +84 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/timers.js +64 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/using.js +213 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/util.js +321 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/node_modules/bluebird/package.json +103 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/portastic/package.json +69 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/CHANGELOG.md +109 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/LICENSE +201 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/README.md +278 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/anonymize_proxy.js +100 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/handler_base.js +319 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/handler_custom_response.js +96 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/handler_forward.js +173 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_chain.js +132 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_direct.js +89 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_tcp_chain.js +271 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/index.js +26 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/run_locally.js +66 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/server.js +595 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/tcp_tunnel.js +138 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/testing_tcp_service.js +37 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/build/tools.js +220 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/proxy-chain/package.json +104 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/underscore/LICENSE +23 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/underscore/README.md +28 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/underscore/package.json +81 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/underscore/underscore-min.js +5 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/underscore/underscore-min.js.map +1 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/node_modules/underscore/underscore.js +1692 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/package-lock.json +63 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/package.json +15 -0
- data/lib/proxy_chain_rb/node_js/proxy-chain-server/server.js +25 -0
- data/lib/proxy_chain_rb/server.rb +49 -0
- data/lib/proxy_chain_rb/version.rb +3 -0
- data/proxy_chain_rb.gemspec +31 -0
- metadata +266 -0
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# ms
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/zeit/ms)
|
|
4
|
+
[](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`
|
|
@@ -0,0 +1,13 @@
|
|
|
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.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# portastic
|
|
2
|
+
[][0]
|
|
3
|
+
[][1]
|
|
4
|
+
[][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
|
|
@@ -0,0 +1,65 @@
|
|
|
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);
|
|
@@ -0,0 +1,59 @@
|
|
|
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;
|
|
@@ -0,0 +1,167 @@
|
|
|
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
|
+
};
|