├── .dockerignore ├── .gitignore ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE.md ├── README.md ├── package-lock.json ├── package.json ├── storm_modules ├── custom │ └── .gitignore └── system │ ├── README.md │ ├── hostinfo.js │ ├── hostmonitoring.js │ ├── plugin_install.js │ ├── plugin_remove.js │ ├── plugins_list.js │ ├── stormnodeupdate.js │ ├── stormnodeuptime.js │ └── stormnodeversion.js ├── stormnode.js └── stormnode.json.example /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dockerignore 3 | .git 4 | .gitignore 5 | CONTRIBUTING.md 6 | Dockerfile 7 | LICENSE.md 8 | README.md 9 | stormnode.json 10 | stormnode.json.example 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | stormnode.json 2 | /node_modules 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via issue, 4 | email, or any other method with the owners of this repository before making a change. 5 | 6 | Please note we have a code of conduct, please follow it in all your interactions with the project. 7 | 8 | ## Pull Request Process 9 | 10 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a 11 | build. 12 | 2. Update the README.md with details of changes to the interface, this includes new environment 13 | variables, exposed ports, useful file locations and container parameters. 14 | 3. Increase the version numbers in any examples files and the README.md to the new version that this 15 | Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). 16 | 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you 17 | do not have permission to do that, you may request the second reviewer to merge it for you. 18 | 19 | ## Code of Conduct 20 | 21 | ### Our Pledge 22 | 23 | In the interest of fostering an open and welcoming environment, we as 24 | contributors and maintainers pledge to making participation in our project and 25 | our community a harassment-free experience for everyone, regardless of age, body 26 | size, disability, ethnicity, gender identity and expression, level of experience, 27 | nationality, personal appearance, race, religion, or sexual identity and 28 | orientation. 29 | 30 | ### Our Standards 31 | 32 | Examples of behavior that contributes to creating a positive environment 33 | include: 34 | 35 | * Using welcoming and inclusive language 36 | * Being respectful of differing viewpoints and experiences 37 | * Gracefully accepting constructive criticism 38 | * Focusing on what is best for the community 39 | * Showing empathy towards other community members 40 | 41 | Examples of unacceptable behavior by participants include: 42 | 43 | * The use of sexualized language or imagery and unwelcome sexual attention or 44 | advances 45 | * Trolling, insulting/derogatory comments, and personal or political attacks 46 | * Public or private harassment 47 | * Publishing others' private information, such as a physical or electronic 48 | address, without explicit permission 49 | * Other conduct which could reasonably be considered inappropriate in a 50 | professional setting 51 | 52 | ### Our Responsibilities 53 | 54 | Project maintainers are responsible for clarifying the standards of acceptable 55 | behavior and are expected to take appropriate and fair corrective action in 56 | response to any instances of unacceptable behavior. 57 | 58 | Project maintainers have the right and responsibility to remove, edit, or 59 | reject comments, commits, code, wiki edits, issues, and other contributions 60 | that are not aligned to this Code of Conduct, or to ban temporarily or 61 | permanently any contributor for other behaviors that they deem inappropriate, 62 | threatening, offensive, or harmful. 63 | 64 | ### Scope 65 | 66 | This Code of Conduct applies both within project spaces and in public spaces 67 | when an individual is representing the project or its community. Examples of 68 | representing a project or community include using an official project e-mail 69 | address, posting via an official social media account, or acting as an appointed 70 | representative at an online or offline event. Representation of a project may be 71 | further defined and clarified by project maintainers. 72 | 73 | ### Enforcement 74 | 75 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 76 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All 77 | complaints will be reviewed and investigated and will result in a response that 78 | is deemed necessary and appropriate to the circumstances. The project team is 79 | obligated to maintain confidentiality with regard to the reporter of an incident. 80 | Further details of specific enforcement policies may be posted separately. 81 | 82 | Project maintainers who do not follow or enforce the Code of Conduct in good 83 | faith may face temporary or permanent repercussions as determined by other 84 | members of the project's leadership. 85 | 86 | ### Attribution 87 | 88 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 89 | available at [http://contributor-covenant.org/version/1/4][version] 90 | 91 | [homepage]: http://contributor-covenant.org 92 | [version]: http://contributor-covenant.org/version/1/4/ 93 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:lts-alpine 2 | RUN mkdir -p /home/node/stormnode/node_modules && chown -R node:node /home/node/stormnode 3 | WORKDIR /home/node/stormnode 4 | USER node 5 | COPY --chown=node:node package*.json ./ 6 | RUN npm install 7 | COPY --chown=node:node storm_modules storm_modules 8 | COPY --chown=node:node stormnode.js stormnode.js 9 | ENTRYPOINT [ "./stormnode.js" ] 10 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Matthew Lavine 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | # Stormnode 4 | ![Version](https://img.shields.io/github/package-json/v/stormdotdev/stormnode) ![License](https://img.shields.io/github/license/stormdotdev/stormnode) [![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.png?v=103)](https://github.com/ellerbrock/open-source-badges/) 5 | ![Size](https://img.shields.io/github/size/stormdotdev/stormnode/stormnode.js) 6 | 7 | NodeJs node for storm.dev node net 8 | 9 | 10 | ### What Is StormNode? 11 | Storm is an open network of virtual users to monitor and stress test your web applications and monitor your servers. Add your node to the network to earn free credits to contribute to the system. 12 | 13 | ## Contributing 14 | 15 | Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us. 16 | 17 | ## Versioning 18 | 19 | We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/stormdotdev/stormnode/tags). 20 | 21 | ## Authors 22 | 23 | * **storm.dev** - [storm.dev](https://storm.dev) 24 | 25 | See also the list of [contributors](https://github.com/stormdotdev/stormnode/contributors) who participated in this project. 26 | 27 | ## License 28 | 29 | This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details 30 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stormclient", 3 | "version": "0.1.57", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "@types/color-name": { 8 | "version": "1.1.1", 9 | "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", 10 | "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==" 11 | }, 12 | "ansi-regex": { 13 | "version": "5.0.0", 14 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", 15 | "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==" 16 | }, 17 | "ansi-styles": { 18 | "version": "4.2.1", 19 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", 20 | "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", 21 | "requires": { 22 | "@types/color-name": "^1.1.1", 23 | "color-convert": "^2.0.1" 24 | } 25 | }, 26 | "asn1": { 27 | "version": "0.2.4", 28 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", 29 | "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", 30 | "requires": { 31 | "safer-buffer": "~2.1.0" 32 | } 33 | }, 34 | "async-limiter": { 35 | "version": "1.0.1", 36 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", 37 | "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" 38 | }, 39 | "balanced-match": { 40 | "version": "1.0.0", 41 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 42 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 43 | }, 44 | "base64-js": { 45 | "version": "1.3.1", 46 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", 47 | "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" 48 | }, 49 | "bl": { 50 | "version": "1.2.2", 51 | "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", 52 | "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", 53 | "requires": { 54 | "readable-stream": "^2.3.5", 55 | "safe-buffer": "^5.1.1" 56 | } 57 | }, 58 | "brace-expansion": { 59 | "version": "1.1.11", 60 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 61 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 62 | "requires": { 63 | "balanced-match": "^1.0.0", 64 | "concat-map": "0.0.1" 65 | } 66 | }, 67 | "buffer-from": { 68 | "version": "1.1.1", 69 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", 70 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" 71 | }, 72 | "callback-stream": { 73 | "version": "1.1.0", 74 | "resolved": "https://registry.npmjs.org/callback-stream/-/callback-stream-1.1.0.tgz", 75 | "integrity": "sha1-RwGlEmbwbgbqpx/BcjOCLYdfSQg=", 76 | "requires": { 77 | "inherits": "^2.0.1", 78 | "readable-stream": "> 1.0.0 < 3.0.0" 79 | } 80 | }, 81 | "camelcase": { 82 | "version": "5.3.1", 83 | "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", 84 | "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==" 85 | }, 86 | "cliui": { 87 | "version": "6.0.0", 88 | "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", 89 | "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", 90 | "requires": { 91 | "string-width": "^4.2.0", 92 | "strip-ansi": "^6.0.0", 93 | "wrap-ansi": "^6.2.0" 94 | } 95 | }, 96 | "color-convert": { 97 | "version": "2.0.1", 98 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 99 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 100 | "requires": { 101 | "color-name": "~1.1.4" 102 | } 103 | }, 104 | "color-name": { 105 | "version": "1.1.4", 106 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 107 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" 108 | }, 109 | "commist": { 110 | "version": "1.1.0", 111 | "resolved": "https://registry.npmjs.org/commist/-/commist-1.1.0.tgz", 112 | "integrity": "sha512-rraC8NXWOEjhADbZe9QBNzLAN5Q3fsTPQtBV+fEVj6xKIgDgNiEVE6ZNfHpZOqfQ21YUzfVNUXLOEZquYvQPPg==", 113 | "requires": { 114 | "leven": "^2.1.0", 115 | "minimist": "^1.1.0" 116 | } 117 | }, 118 | "concat-map": { 119 | "version": "0.0.1", 120 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 121 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 122 | }, 123 | "concat-stream": { 124 | "version": "1.6.2", 125 | "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", 126 | "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", 127 | "requires": { 128 | "buffer-from": "^1.0.0", 129 | "inherits": "^2.0.3", 130 | "readable-stream": "^2.2.2", 131 | "typedarray": "^0.0.6" 132 | } 133 | }, 134 | "core-util-is": { 135 | "version": "1.0.2", 136 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 137 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 138 | }, 139 | "d": { 140 | "version": "1.0.1", 141 | "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", 142 | "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", 143 | "requires": { 144 | "es5-ext": "^0.10.50", 145 | "type": "^1.0.1" 146 | } 147 | }, 148 | "debug": { 149 | "version": "4.1.1", 150 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", 151 | "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", 152 | "requires": { 153 | "ms": "^2.1.1" 154 | } 155 | }, 156 | "decamelize": { 157 | "version": "1.2.0", 158 | "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", 159 | "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" 160 | }, 161 | "duplexify": { 162 | "version": "3.7.1", 163 | "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", 164 | "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", 165 | "requires": { 166 | "end-of-stream": "^1.0.0", 167 | "inherits": "^2.0.1", 168 | "readable-stream": "^2.0.0", 169 | "stream-shift": "^1.0.0" 170 | } 171 | }, 172 | "emoji-regex": { 173 | "version": "8.0.0", 174 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 175 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" 176 | }, 177 | "end-of-stream": { 178 | "version": "1.4.4", 179 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", 180 | "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", 181 | "requires": { 182 | "once": "^1.4.0" 183 | } 184 | }, 185 | "es5-ext": { 186 | "version": "0.10.53", 187 | "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz", 188 | "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==", 189 | "requires": { 190 | "es6-iterator": "~2.0.3", 191 | "es6-symbol": "~3.1.3", 192 | "next-tick": "~1.0.0" 193 | } 194 | }, 195 | "es6-iterator": { 196 | "version": "2.0.3", 197 | "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", 198 | "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", 199 | "requires": { 200 | "d": "1", 201 | "es5-ext": "^0.10.35", 202 | "es6-symbol": "^3.1.1" 203 | } 204 | }, 205 | "es6-map": { 206 | "version": "0.1.5", 207 | "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", 208 | "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", 209 | "requires": { 210 | "d": "1", 211 | "es5-ext": "~0.10.14", 212 | "es6-iterator": "~2.0.1", 213 | "es6-set": "~0.1.5", 214 | "es6-symbol": "~3.1.1", 215 | "event-emitter": "~0.3.5" 216 | } 217 | }, 218 | "es6-set": { 219 | "version": "0.1.5", 220 | "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", 221 | "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", 222 | "requires": { 223 | "d": "1", 224 | "es5-ext": "~0.10.14", 225 | "es6-iterator": "~2.0.1", 226 | "es6-symbol": "3.1.1", 227 | "event-emitter": "~0.3.5" 228 | }, 229 | "dependencies": { 230 | "es6-symbol": { 231 | "version": "3.1.1", 232 | "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", 233 | "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", 234 | "requires": { 235 | "d": "1", 236 | "es5-ext": "~0.10.14" 237 | } 238 | } 239 | } 240 | }, 241 | "es6-symbol": { 242 | "version": "3.1.3", 243 | "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", 244 | "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", 245 | "requires": { 246 | "d": "^1.0.1", 247 | "ext": "^1.1.2" 248 | } 249 | }, 250 | "event-emitter": { 251 | "version": "0.3.5", 252 | "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", 253 | "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", 254 | "requires": { 255 | "d": "1", 256 | "es5-ext": "~0.10.14" 257 | } 258 | }, 259 | "ext": { 260 | "version": "1.4.0", 261 | "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", 262 | "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==", 263 | "requires": { 264 | "type": "^2.0.0" 265 | }, 266 | "dependencies": { 267 | "type": { 268 | "version": "2.0.0", 269 | "resolved": "https://registry.npmjs.org/type/-/type-2.0.0.tgz", 270 | "integrity": "sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow==" 271 | } 272 | } 273 | }, 274 | "extend": { 275 | "version": "3.0.2", 276 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 277 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 278 | }, 279 | "find-up": { 280 | "version": "4.1.0", 281 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", 282 | "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", 283 | "requires": { 284 | "locate-path": "^5.0.0", 285 | "path-exists": "^4.0.0" 286 | } 287 | }, 288 | "fs.realpath": { 289 | "version": "1.0.0", 290 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 291 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 292 | }, 293 | "get-caller-file": { 294 | "version": "2.0.5", 295 | "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", 296 | "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" 297 | }, 298 | "glob": { 299 | "version": "7.1.6", 300 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", 301 | "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", 302 | "requires": { 303 | "fs.realpath": "^1.0.0", 304 | "inflight": "^1.0.4", 305 | "inherits": "2", 306 | "minimatch": "^3.0.4", 307 | "once": "^1.3.0", 308 | "path-is-absolute": "^1.0.0" 309 | } 310 | }, 311 | "glob-parent": { 312 | "version": "3.1.0", 313 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", 314 | "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", 315 | "requires": { 316 | "is-glob": "^3.1.0", 317 | "path-dirname": "^1.0.0" 318 | } 319 | }, 320 | "glob-stream": { 321 | "version": "6.1.0", 322 | "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", 323 | "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", 324 | "requires": { 325 | "extend": "^3.0.0", 326 | "glob": "^7.1.1", 327 | "glob-parent": "^3.1.0", 328 | "is-negated-glob": "^1.0.0", 329 | "ordered-read-streams": "^1.0.0", 330 | "pumpify": "^1.3.5", 331 | "readable-stream": "^2.1.5", 332 | "remove-trailing-separator": "^1.0.1", 333 | "to-absolute-glob": "^2.0.0", 334 | "unique-stream": "^2.0.2" 335 | } 336 | }, 337 | "help-me": { 338 | "version": "1.1.0", 339 | "resolved": "https://registry.npmjs.org/help-me/-/help-me-1.1.0.tgz", 340 | "integrity": "sha1-jy1QjQYAtKRW2i8IZVbn5cBWo8Y=", 341 | "requires": { 342 | "callback-stream": "^1.0.2", 343 | "glob-stream": "^6.1.0", 344 | "through2": "^2.0.1", 345 | "xtend": "^4.0.0" 346 | } 347 | }, 348 | "inflight": { 349 | "version": "1.0.6", 350 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 351 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 352 | "requires": { 353 | "once": "^1.3.0", 354 | "wrappy": "1" 355 | } 356 | }, 357 | "inherits": { 358 | "version": "2.0.4", 359 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 360 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 361 | }, 362 | "is-absolute": { 363 | "version": "1.0.0", 364 | "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", 365 | "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", 366 | "requires": { 367 | "is-relative": "^1.0.0", 368 | "is-windows": "^1.0.1" 369 | } 370 | }, 371 | "is-extglob": { 372 | "version": "2.1.1", 373 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 374 | "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" 375 | }, 376 | "is-fullwidth-code-point": { 377 | "version": "3.0.0", 378 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 379 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" 380 | }, 381 | "is-glob": { 382 | "version": "3.1.0", 383 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", 384 | "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", 385 | "requires": { 386 | "is-extglob": "^2.1.0" 387 | } 388 | }, 389 | "is-negated-glob": { 390 | "version": "1.0.0", 391 | "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", 392 | "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=" 393 | }, 394 | "is-relative": { 395 | "version": "1.0.0", 396 | "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", 397 | "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", 398 | "requires": { 399 | "is-unc-path": "^1.0.0" 400 | } 401 | }, 402 | "is-unc-path": { 403 | "version": "1.0.0", 404 | "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", 405 | "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", 406 | "requires": { 407 | "unc-path-regex": "^0.1.2" 408 | } 409 | }, 410 | "is-windows": { 411 | "version": "1.0.2", 412 | "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", 413 | "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" 414 | }, 415 | "isarray": { 416 | "version": "1.0.0", 417 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 418 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 419 | }, 420 | "json-stable-stringify-without-jsonify": { 421 | "version": "1.0.1", 422 | "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", 423 | "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" 424 | }, 425 | "leven": { 426 | "version": "2.1.0", 427 | "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", 428 | "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=" 429 | }, 430 | "locate-path": { 431 | "version": "5.0.0", 432 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", 433 | "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", 434 | "requires": { 435 | "p-locate": "^4.1.0" 436 | } 437 | }, 438 | "minimatch": { 439 | "version": "3.0.4", 440 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 441 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 442 | "requires": { 443 | "brace-expansion": "^1.1.7" 444 | } 445 | }, 446 | "minimist": { 447 | "version": "1.2.5", 448 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", 449 | "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" 450 | }, 451 | "mqtt": { 452 | "version": "4.1.0", 453 | "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-4.1.0.tgz", 454 | "integrity": "sha512-dBihVZzaB8p9G/2ktSfamiaHmMnpCpP2du08317ZuEX1kBAbZOG9aMJQ11EChXnOX3GKUeiZYaSITueceQKT2A==", 455 | "requires": { 456 | "base64-js": "^1.3.0", 457 | "commist": "^1.0.0", 458 | "concat-stream": "^1.6.2", 459 | "debug": "^4.1.1", 460 | "end-of-stream": "^1.4.1", 461 | "es6-map": "^0.1.5", 462 | "help-me": "^1.0.1", 463 | "inherits": "^2.0.3", 464 | "minimist": "^1.2.0", 465 | "mqtt-packet": "^6.0.0", 466 | "pump": "^3.0.0", 467 | "readable-stream": "^2.3.6", 468 | "reinterval": "^1.1.0", 469 | "split2": "^3.1.0", 470 | "websocket-stream": "^5.1.2", 471 | "xtend": "^4.0.1" 472 | } 473 | }, 474 | "mqtt-packet": { 475 | "version": "6.3.2", 476 | "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-6.3.2.tgz", 477 | "integrity": "sha512-i56+2kN6F57KInGtjjfUXSl4xG8u/zOvfaXFLKFAbBXzWkXOmwcmjaSCBPayf2IQCkQU0+h+S2DizCo3CF6gQA==", 478 | "requires": { 479 | "bl": "^1.2.2", 480 | "debug": "^4.1.1", 481 | "inherits": "^2.0.3", 482 | "process-nextick-args": "^2.0.0", 483 | "safe-buffer": "^5.1.2" 484 | } 485 | }, 486 | "ms": { 487 | "version": "2.1.2", 488 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 489 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 490 | }, 491 | "next-tick": { 492 | "version": "1.0.0", 493 | "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", 494 | "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" 495 | }, 496 | "node-rsa": { 497 | "version": "1.1.1", 498 | "resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-1.1.1.tgz", 499 | "integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", 500 | "requires": { 501 | "asn1": "^0.2.4" 502 | } 503 | }, 504 | "once": { 505 | "version": "1.4.0", 506 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 507 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 508 | "requires": { 509 | "wrappy": "1" 510 | } 511 | }, 512 | "ordered-read-streams": { 513 | "version": "1.0.1", 514 | "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", 515 | "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", 516 | "requires": { 517 | "readable-stream": "^2.0.1" 518 | } 519 | }, 520 | "p-limit": { 521 | "version": "2.3.0", 522 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", 523 | "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", 524 | "requires": { 525 | "p-try": "^2.0.0" 526 | } 527 | }, 528 | "p-locate": { 529 | "version": "4.1.0", 530 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", 531 | "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", 532 | "requires": { 533 | "p-limit": "^2.2.0" 534 | } 535 | }, 536 | "p-try": { 537 | "version": "2.2.0", 538 | "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", 539 | "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" 540 | }, 541 | "path-dirname": { 542 | "version": "1.0.2", 543 | "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", 544 | "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" 545 | }, 546 | "path-exists": { 547 | "version": "4.0.0", 548 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", 549 | "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" 550 | }, 551 | "path-is-absolute": { 552 | "version": "1.0.1", 553 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 554 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 555 | }, 556 | "process-nextick-args": { 557 | "version": "2.0.1", 558 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 559 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 560 | }, 561 | "pump": { 562 | "version": "3.0.0", 563 | "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", 564 | "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", 565 | "requires": { 566 | "end-of-stream": "^1.1.0", 567 | "once": "^1.3.1" 568 | } 569 | }, 570 | "pumpify": { 571 | "version": "1.5.1", 572 | "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", 573 | "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", 574 | "requires": { 575 | "duplexify": "^3.6.0", 576 | "inherits": "^2.0.3", 577 | "pump": "^2.0.0" 578 | }, 579 | "dependencies": { 580 | "pump": { 581 | "version": "2.0.1", 582 | "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", 583 | "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", 584 | "requires": { 585 | "end-of-stream": "^1.1.0", 586 | "once": "^1.3.1" 587 | } 588 | } 589 | } 590 | }, 591 | "readable-stream": { 592 | "version": "2.3.7", 593 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", 594 | "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", 595 | "requires": { 596 | "core-util-is": "~1.0.0", 597 | "inherits": "~2.0.3", 598 | "isarray": "~1.0.0", 599 | "process-nextick-args": "~2.0.0", 600 | "safe-buffer": "~5.1.1", 601 | "string_decoder": "~1.1.1", 602 | "util-deprecate": "~1.0.1" 603 | } 604 | }, 605 | "reinterval": { 606 | "version": "1.1.0", 607 | "resolved": "https://registry.npmjs.org/reinterval/-/reinterval-1.1.0.tgz", 608 | "integrity": "sha1-M2Hs+jymwYKDOA3Qu5VG85D17Oc=" 609 | }, 610 | "remove-trailing-separator": { 611 | "version": "1.1.0", 612 | "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", 613 | "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" 614 | }, 615 | "require-directory": { 616 | "version": "2.1.1", 617 | "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 618 | "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=" 619 | }, 620 | "require-main-filename": { 621 | "version": "2.0.0", 622 | "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", 623 | "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==" 624 | }, 625 | "safe-buffer": { 626 | "version": "5.1.2", 627 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 628 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 629 | }, 630 | "safer-buffer": { 631 | "version": "2.1.2", 632 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 633 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 634 | }, 635 | "set-blocking": { 636 | "version": "2.0.0", 637 | "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", 638 | "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" 639 | }, 640 | "split2": { 641 | "version": "3.1.1", 642 | "resolved": "https://registry.npmjs.org/split2/-/split2-3.1.1.tgz", 643 | "integrity": "sha512-emNzr1s7ruq4N+1993yht631/JH+jaj0NYBosuKmLcq+JkGQ9MmTw1RB1fGaTCzUuseRIClrlSLHRNYGwWQ58Q==", 644 | "requires": { 645 | "readable-stream": "^3.0.0" 646 | }, 647 | "dependencies": { 648 | "readable-stream": { 649 | "version": "3.6.0", 650 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", 651 | "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", 652 | "requires": { 653 | "inherits": "^2.0.3", 654 | "string_decoder": "^1.1.1", 655 | "util-deprecate": "^1.0.1" 656 | } 657 | } 658 | } 659 | }, 660 | "stream-shift": { 661 | "version": "1.0.1", 662 | "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", 663 | "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==" 664 | }, 665 | "string-width": { 666 | "version": "4.2.0", 667 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", 668 | "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==", 669 | "requires": { 670 | "emoji-regex": "^8.0.0", 671 | "is-fullwidth-code-point": "^3.0.0", 672 | "strip-ansi": "^6.0.0" 673 | } 674 | }, 675 | "string_decoder": { 676 | "version": "1.1.1", 677 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 678 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 679 | "requires": { 680 | "safe-buffer": "~5.1.0" 681 | } 682 | }, 683 | "strip-ansi": { 684 | "version": "6.0.0", 685 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", 686 | "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", 687 | "requires": { 688 | "ansi-regex": "^5.0.0" 689 | } 690 | }, 691 | "systeminformation": { 692 | "version": "4.26.10", 693 | "resolved": "https://registry.npmjs.org/systeminformation/-/systeminformation-4.26.10.tgz", 694 | "integrity": "sha512-bO4FIzrjESAfh4KHwkUJym3jvKtJ4oJ2PG0BBQGBmKa0pF2oanpkB7CF4ZsSX7vfp3+GKaLzioVwpV/3Tyk+lQ==" 695 | }, 696 | "through2": { 697 | "version": "2.0.5", 698 | "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", 699 | "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", 700 | "requires": { 701 | "readable-stream": "~2.3.6", 702 | "xtend": "~4.0.1" 703 | } 704 | }, 705 | "through2-filter": { 706 | "version": "3.0.0", 707 | "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz", 708 | "integrity": "sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==", 709 | "requires": { 710 | "through2": "~2.0.0", 711 | "xtend": "~4.0.0" 712 | } 713 | }, 714 | "to-absolute-glob": { 715 | "version": "2.0.2", 716 | "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", 717 | "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", 718 | "requires": { 719 | "is-absolute": "^1.0.0", 720 | "is-negated-glob": "^1.0.0" 721 | } 722 | }, 723 | "type": { 724 | "version": "1.2.0", 725 | "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", 726 | "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" 727 | }, 728 | "typedarray": { 729 | "version": "0.0.6", 730 | "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 731 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" 732 | }, 733 | "ultron": { 734 | "version": "1.1.1", 735 | "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", 736 | "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" 737 | }, 738 | "unc-path-regex": { 739 | "version": "0.1.2", 740 | "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", 741 | "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" 742 | }, 743 | "unique-stream": { 744 | "version": "2.3.1", 745 | "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz", 746 | "integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==", 747 | "requires": { 748 | "json-stable-stringify-without-jsonify": "^1.0.1", 749 | "through2-filter": "^3.0.0" 750 | } 751 | }, 752 | "util-deprecate": { 753 | "version": "1.0.2", 754 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 755 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 756 | }, 757 | "websocket-stream": { 758 | "version": "5.5.2", 759 | "resolved": "https://registry.npmjs.org/websocket-stream/-/websocket-stream-5.5.2.tgz", 760 | "integrity": "sha512-8z49MKIHbGk3C4HtuHWDtYX8mYej1wWabjthC/RupM9ngeukU4IWoM46dgth1UOS/T4/IqgEdCDJuMe2039OQQ==", 761 | "requires": { 762 | "duplexify": "^3.5.1", 763 | "inherits": "^2.0.1", 764 | "readable-stream": "^2.3.3", 765 | "safe-buffer": "^5.1.2", 766 | "ws": "^3.2.0", 767 | "xtend": "^4.0.0" 768 | } 769 | }, 770 | "which-module": { 771 | "version": "2.0.0", 772 | "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", 773 | "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=" 774 | }, 775 | "wrap-ansi": { 776 | "version": "6.2.0", 777 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", 778 | "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", 779 | "requires": { 780 | "ansi-styles": "^4.0.0", 781 | "string-width": "^4.1.0", 782 | "strip-ansi": "^6.0.0" 783 | } 784 | }, 785 | "wrappy": { 786 | "version": "1.0.2", 787 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 788 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 789 | }, 790 | "ws": { 791 | "version": "3.3.3", 792 | "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", 793 | "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", 794 | "requires": { 795 | "async-limiter": "~1.0.0", 796 | "safe-buffer": "~5.1.0", 797 | "ultron": "~1.1.0" 798 | } 799 | }, 800 | "xtend": { 801 | "version": "4.0.2", 802 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", 803 | "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" 804 | }, 805 | "y18n": { 806 | "version": "4.0.0", 807 | "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", 808 | "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==" 809 | }, 810 | "yargs": { 811 | "version": "15.4.1", 812 | "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", 813 | "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", 814 | "requires": { 815 | "cliui": "^6.0.0", 816 | "decamelize": "^1.2.0", 817 | "find-up": "^4.1.0", 818 | "get-caller-file": "^2.0.1", 819 | "require-directory": "^2.1.1", 820 | "require-main-filename": "^2.0.0", 821 | "set-blocking": "^2.0.0", 822 | "string-width": "^4.2.0", 823 | "which-module": "^2.0.0", 824 | "y18n": "^4.0.0", 825 | "yargs-parser": "^18.1.2" 826 | } 827 | }, 828 | "yargs-parser": { 829 | "version": "18.1.3", 830 | "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", 831 | "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", 832 | "requires": { 833 | "camelcase": "^5.0.0", 834 | "decamelize": "^1.2.0" 835 | } 836 | } 837 | } 838 | } 839 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stormclient", 3 | "version": "0.1.57", 4 | "description": "Node client for storm.dev", 5 | "main": "stormnode.js", 6 | "bin": { 7 | "stormnode": "./stormnode.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/stormdotdev/stormnode.git" 12 | }, 13 | "keywords": [ 14 | "stormdev", 15 | "storm.dev", 16 | "stormdotdev", 17 | "storm", 18 | "load test", 19 | "nodejs", 20 | "mqtt", 21 | "nodenet", 22 | "decentralized", 23 | "distributed" 24 | ], 25 | "author": "storm.dev", 26 | "license": "MIT", 27 | "bugs": { 28 | "url": "https://github.com/stormdotdev/stormnode/issues" 29 | }, 30 | "homepage": "https://github.com/stormdotdev/stormnode#readme", 31 | "dependencies": { 32 | "mqtt": "^4.1.0", 33 | "node-rsa": "^1.1.1", 34 | "systeminformation": "^4.26.10", 35 | "yargs": "^15.4.1" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /storm_modules/custom/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storm_modules/system/README.md: -------------------------------------------------------------------------------- 1 | # Storm system module 2 | ## hostmonitoring 3 | Return basic information from host 4 | * memory (total, used) 5 | * cpu load (total cpus, cpu1, ...) 6 | * disk (disk1, disk2, ...) 7 | 8 | The hostmonitoring module totally uses the systeminformation library of [Sebastian Hildebrandt](https://github.com/sebhildebrandt) 9 | [https://github.com/sebhildebrandt/systeminformation](https://github.com/sebhildebrandt/systeminformation) - systeminformation github page 10 | [https://systeminformation.io/](https://systeminformation.io/) - systeminformation web page 11 | Thanks! 12 | return: 13 | ```json 14 | { 15 | "memory": [ 16 | 17179869184, // total ram 17 | 13996253184 // used ram 18 | ], 19 | "cpus": [ 20 | [ 21 | 16.69023349494722, // total cpus load percentage 22 | 10.288821095128597, // total cpus user load percentage 23 | 6.4014123998186205 // total cpus system load percentage 24 | ], 25 | [ 26 | 25.496262824925946, // cpu1 load percentage 27 | 15.499856109617443, // cpu1 user load percentage 28 | 9.996406715308506 // cpu1 system load percentage 29 | ], 30 | [ 31 | 9.305088707343677, // cpu2 load percentage 32 | 5.185420449594703, // cpu2 user load percentage 33 | 4.119668257748973 // cpu2 system load percentage 34 | ], 35 | [ 36 | ... // cpuN 37 | ] 38 | ], 39 | "disks": [ 40 | [ 41 | "/", // disk1 mount point 42 | 499963174912, // disk1 total size 43 | 10818920448 // disk1 used size 44 | ], 45 | [ 46 | "/System/Volumes/Data", // disk2 mount point 47 | 499963174912, // disk2 total size 48 | 236281159680 // disk2 used size 49 | ], 50 | [ 51 | ... // diskN 52 | ] 53 | ] 54 | } 55 | 56 | ``` 57 | 58 | 59 | ## hostinfo 60 | Not require any external library, uses only os of nodejs 61 | 62 | return: 63 | ```json 64 | { 65 | "hostname": "stormlaptop3", 66 | "arch": "x64", 67 | "cpus": [ 68 | "Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz", 69 | "Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz", 70 | "Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz", 71 | "Intel(R) Core(TM) i5-8210Y CPU @ 1.60GHz" 72 | ], 73 | "platform": "darwin", 74 | "release": "19.2.0", 75 | "totalmem": 17179869184, 76 | "humanTotalMem": "16.0 GiB", 77 | "uptime": 66124 78 | } 79 | ``` 80 | 81 | ## stormnodeuptime 82 | return stormnode uptime 83 | 84 | ## stormnodeversion 85 | return stormnode version 86 | 87 | ## stormnodeupdate 88 | update the stormnode 89 | -------------------------------------------------------------------------------- /storm_modules/system/hostinfo.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | custom_signature: null, // not yet used - rsa public key or null 3 | nodeOptions: null, 4 | setNodeOptions: function(nodeOptions){ 5 | this.nodeOptions = nodeOptions; 6 | }, 7 | run: function(){ 8 | return new Promise(function(resolve, reject) { 9 | 10 | const os = require('os'); 11 | 12 | //https://github.com/sebhildebrandt/systeminformation 13 | const si = require('systeminformation'); 14 | 15 | var cpusList = []; 16 | 17 | var arch = os.arch(); 18 | var cpus = os.cpus(); 19 | var hostname = os.hostname(); 20 | var platform = os.platform(); 21 | var release = os.release(); 22 | var totalmem = os.totalmem(); 23 | var uptime = os.uptime(); 24 | 25 | for (var i in cpus) { 26 | cpusList.push(cpus[i].model); 27 | } 28 | var humanTotalMem = humanFileSize(totalmem); 29 | 30 | 31 | Promise.all([ 32 | si.getStaticData(), 33 | si.fsSize() 34 | ]).then(values => { 35 | 36 | //getStaticData 37 | var staticData = values[0]; 38 | 39 | 40 | //fsSize 41 | var fsSize = values[1]; 42 | var disks = []; 43 | for (const disk of fsSize) { 44 | disks.push([disk.mount, disk.size]); 45 | } 46 | 47 | const result = { 48 | hostname: hostname, 49 | manufacturer: staticData.system.manufacturer, 50 | model: staticData.system.model, 51 | serial: staticData.system.serial, 52 | arch: arch, 53 | cpus: cpusList, 54 | cpumanufacturer: staticData.cpu.manufacturer, 55 | cpubrand: staticData.cpu.brand, 56 | platform: platform, 57 | distro: staticData.os.distro, 58 | release: release, 59 | totalmem: totalmem, 60 | humanTotalMem: humanTotalMem, 61 | uptime: uptime, 62 | disks: disks 63 | } 64 | resolve(result); 65 | 66 | }); 67 | 68 | 69 | //https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string/14919494#14919494 70 | function humanFileSize(bytes, si) { 71 | var thresh = si ? 1000 : 1024; 72 | if(Math.abs(bytes) < thresh) { 73 | return bytes + ' B'; 74 | } 75 | var units = si 76 | ? ['kB','MB','GB','TB','PB','EB','ZB','YB'] 77 | : ['KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB']; 78 | var u = -1; 79 | do { 80 | bytes /= thresh; 81 | ++u; 82 | } while(Math.abs(bytes) >= thresh && u < units.length - 1); 83 | return bytes.toFixed(1)+' '+units[u]; 84 | } 85 | 86 | }) 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /storm_modules/system/hostmonitoring.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | custom_signature: null, // not yet used - rsa public key or null 3 | nodeOptions: null, 4 | setNodeOptions: function(nodeOptions){ 5 | this.nodeOptions = nodeOptions; 6 | }, 7 | run: function(){ 8 | return new Promise(function(resolve, reject) { 9 | 10 | //https://github.com/sebhildebrandt/systeminformation 11 | const si = require('systeminformation'); 12 | 13 | Promise.all([ 14 | si.mem(), 15 | si.currentLoad(), 16 | si.fsSize() 17 | ]).then(values => { 18 | 19 | //Memory 20 | var mem = values[0]; 21 | var memory = [mem.total, mem.available]; 22 | 23 | //Cpu 24 | var currentLoad = values[1]; 25 | var cpus = []; 26 | var cpu_total = [currentLoad.currentload, currentLoad.currentload_user, currentLoad.currentload_system]; 27 | cpus.push(cpu_total); 28 | for (const cpu of currentLoad.cpus) { 29 | cpus.push([cpu.load, cpu.load_user, cpu.load_system]); 30 | } 31 | 32 | //Disk 33 | var fsSize = values[2]; 34 | var disks = []; 35 | for (const disk of fsSize) { 36 | disks.push([disk.mount, disk.size, disk.used]); 37 | } 38 | 39 | const result = { 40 | memory: memory, 41 | cpus: cpus, 42 | disks: disks 43 | } 44 | resolve(result); 45 | 46 | }); 47 | 48 | }) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /storm_modules/system/plugin_install.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const fs = require('fs'); 3 | 4 | module.exports = { 5 | nodeOptions: null, 6 | arguments: null, 7 | setNodeOptions: function (nodeOptions) { 8 | this.nodeOptions = nodeOptions; 9 | }, 10 | setArguments: function (arguments) { 11 | this.arguments = arguments; 12 | }, 13 | run: function () { 14 | if (this.nodeOptions.allow_remote_plugins_installation == 0) { 15 | return Promise.reject({ 16 | error_message: 'plugin installation is not allowed' 17 | }); 18 | } 19 | 20 | return new Promise((resolve, reject) => { 21 | try { 22 | const installPath = path.join('storm_modules/custom', this.arguments.installation_name); 23 | const commands = []; 24 | 25 | if (!fs.existsSync(installPath)) { 26 | commands.push({ 27 | command: 'git clone ' + this.arguments.repository + ' ' + this.arguments.installation_name, 28 | path: 'storm_modules/custom' 29 | }); 30 | } else { 31 | commands.push({ 32 | command: 'git pull', 33 | path: installPath 34 | }); 35 | } 36 | 37 | commands.push({ 38 | command: 'npm install --production', 39 | path: installPath 40 | }); 41 | 42 | let string_return = ''; 43 | const { exec } = require('child_process'); 44 | 45 | const exec_commands = (commands) => { 46 | const commandConfig = commands.shift(); 47 | exec(commandConfig.command, { cwd: commandConfig.path }, (error, stdout, stderr) => { 48 | if (stdout) { 49 | string_return += stdout; 50 | } 51 | 52 | if (stderr) { 53 | string_return += stderr; 54 | } 55 | 56 | if (commands.length) { 57 | exec_commands(commands); 58 | } else { 59 | resolve(string_return); 60 | } 61 | }); 62 | }; 63 | 64 | exec_commands(commands); 65 | } catch (e) { 66 | console.log(e); 67 | reject({ 68 | error: e.toString() 69 | }); 70 | } 71 | }); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /storm_modules/system/plugin_remove.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | custom_signature: null, // not yet used - rsa public key or null 3 | nodeOptions: null, 4 | arguments: null, 5 | setNodeOptions: function(nodeOptions){ 6 | this.nodeOptions = nodeOptions; 7 | }, 8 | setArguments: function(arguments){ 9 | this.arguments = arguments; 10 | }, 11 | run: function(){ 12 | var commands = this.arguments; 13 | if (this.nodeOptions.allow_remote_plugins_installation!=0){ 14 | return new Promise(function(resolve, reject) { 15 | 16 | 17 | var fs = require('fs'); 18 | var deleteFolderRecursive = function(path) { 19 | if( fs.existsSync(path) ) { 20 | fs.readdirSync(path).forEach(function(file,index){ 21 | var curPath = path + "/" + file; 22 | if(fs.lstatSync(curPath).isDirectory()) { // recurse 23 | deleteFolderRecursive(curPath); 24 | } else { // delete file 25 | fs.unlinkSync(curPath); 26 | } 27 | }); 28 | fs.rmdirSync(path); 29 | } 30 | }; 31 | var commands_json = JSON.parse(commands); 32 | deleteFolderRecursive('./storm_modules/custom/'+commands_json.plugin_to_be_removed); 33 | 34 | }) 35 | } 36 | else return('plugin installation is not allowed'); 37 | 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /storm_modules/system/plugins_list.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | module.exports = { 5 | run: function(){ 6 | return new Promise(function(resolve, reject) { 7 | const customDir = path.join(path.dirname(__dirname), 'custom'); 8 | resolve(fs.readdirSync(customDir).filter(dirent => fs.statSync(path.join(customDir, dirent)).isDirectory())); 9 | }); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /storm_modules/system/stormnodeupdate.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const cp = require('child_process'); 3 | 4 | module.exports = { 5 | custom_signature: null, // not yet used - rsa public key or null 6 | nodeOptions: null, 7 | setNodeOptions: function(nodeOptions){ 8 | this.nodeOptions = nodeOptions; 9 | }, 10 | run: function() { 11 | if (!this.nodeOptions.allow_remote_update) { 12 | return Promise.reject(); 13 | } 14 | 15 | return new Promise(function (resolve, reject) { 16 | let string_return = ''; 17 | process.chdir(path.dirname(path.dirname(__dirname))); 18 | let child1 = cp.spawnSync('git', ['pull']); 19 | let child2 = cp.spawnSync('npm', ['install', '--production']); 20 | resolve([ 21 | child1.stdout + child2.stdout, 22 | child1.stderr + child2.stderr 23 | ].join('')); 24 | setTimeout(function () { 25 | return process.exit(0); 26 | }, 3000); 27 | }); 28 | } 29 | }; 30 | -------------------------------------------------------------------------------- /storm_modules/system/stormnodeuptime.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | custom_signature: null, // not yet used - rsa public key or null 3 | nodeOptions: null, 4 | setNodeOptions: function(nodeOptions){ 5 | this.nodeOptions = nodeOptions; 6 | }, 7 | run: function(){ 8 | return new Promise(function(resolve, reject) { 9 | 10 | const UPTIME = process.uptime(); 11 | resolve(UPTIME); 12 | 13 | }) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /storm_modules/system/stormnodeversion.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | custom_signature: null, // not yet used - rsa public key or null 3 | nodeOptions: null, 4 | setNodeOptions: function(nodeOptions){ 5 | this.nodeOptions = nodeOptions; 6 | }, 7 | run: function(){ 8 | const VERSION = require(__dirname + '/../../package.json').version; 9 | return VERSION; 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /stormnode.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | 4 | const VERSION = require(__dirname + '/package.json').version; 5 | const yargs = require('yargs'); 6 | 7 | const argv = yargs 8 | .detectLocale(false) 9 | .usage('$0 [ -c path-to-stormnode.json ]') 10 | .version(VERSION) 11 | .help() 12 | .alias('h', 'help') 13 | .default('c', './stormnode.json') 14 | .alias('c', 'config') 15 | .count('verbose') 16 | .alias('v', 'verbose') 17 | .alias('r', 'removelock').describe('r', 'remove lock file and exit') 18 | .argv; 19 | 20 | const VERBOSE_LEVEL = argv.verbose; 21 | const DEBUG = function() { VERBOSE_LEVEL > 0 && console.log.apply(console, arguments); } 22 | 23 | DEBUG("ver. " + VERSION); 24 | 25 | const path = require('path'); 26 | const os = require('os'); 27 | const fs = require('fs'); 28 | const nodeRSA = require('node-rsa'); 29 | const events = require('events'); 30 | 31 | const lockFilePath = function(nodeId) { 32 | return [os.tmpdir(), `storm-node-${nodeId}.lock`].join(path.sep); 33 | }; 34 | 35 | const nodeOptions = requireNodeOptionsOrFail(argv.config); 36 | 37 | DEBUG("Node_id: " + nodeOptions.nodeId); 38 | 39 | if (argv.r) { 40 | fs.unlinkSync(lockFilePath(nodeOptions.nodeId)); 41 | console.log('The lock file has been removed. Now you can restart the node'); 42 | process.exit(0); 43 | } 44 | 45 | if (fs.existsSync(lockFilePath(nodeOptions.nodeId))) { 46 | console.log('lock file exists'); 47 | process.exit(1); 48 | } 49 | 50 | const mqtt = require('mqtt'); 51 | const http = require('http'); 52 | const https = require('https'); 53 | 54 | const NS_PER_SEC = 1e9; 55 | const MS_PER_NS = 1e6; 56 | 57 | const ownTopic = `storm.dev/nodes/${nodeOptions.nodeId}/status`; 58 | 59 | const node = mqtt.connect(process.env.STORM_CONNECT_URL || 'mqtts://nodenet.storm.dev:8883', buildConnectOptions(nodeOptions, ownTopic)); 60 | let deltaTime = 0; 61 | 62 | const eventEmitter = new events.EventEmitter(); 63 | 64 | // sent by broker on multiple connections from same node_id 65 | node.on('disconnect', function (packet) { 66 | console.log('new connection from same node_id, closing this one'); 67 | const nodeLockFilePath = lockFilePath(nodeOptions.nodeId); 68 | fs.writeFile(nodeLockFilePath, process.pid, null, function (err) { 69 | if (err) { 70 | throw err; 71 | } 72 | 73 | console.log(`lock file created at ${nodeLockFilePath}. Node won't restart until lock file exists. Fix problem and run with -r angument for remove lock`); 74 | node.end(); 75 | }); 76 | }); 77 | 78 | node.on('connect', async function () { 79 | DEBUG('connected'); 80 | // general topic 81 | node.subscribe('storm.dev/general'); 82 | 83 | // private topic 84 | node.subscribe(`storm.dev/nodes/${nodeOptions.nodeId}/direct`); 85 | 86 | node.publish(ownTopic, JSON.stringify(helloMessage())); 87 | }); 88 | 89 | node.on('message', function (topic, message) { 90 | DEBUG(message.toString()); 91 | let payload; 92 | 93 | try { 94 | payload = JSON.parse(message.toString()); 95 | } catch (err) { 96 | payload = null; 97 | } 98 | 99 | if (!payload) { 100 | return; 101 | } 102 | 103 | if (!authorized(payload.authtype, payload.authdata)){ 104 | DEBUG('Command discarded'); 105 | return; 106 | } 107 | 108 | if (!verifysign(payload.signature)){ 109 | DEBUG('invalid signature'); 110 | return; 111 | } 112 | 113 | const command = payload.command; 114 | 115 | switch (command) { 116 | case 'loadtest': 117 | handleNewLoadtest(payload); 118 | break; 119 | case 'manageloadtest': 120 | handleManageLoadtest(topic, payload); 121 | break; 122 | case 'endpointhealth': 123 | handleEndpointhealth(payload); 124 | break; 125 | case 'hostmonitoring': 126 | handleHostMonitoring(payload); 127 | break; 128 | case 'customcommand': 129 | handleCustomCommand(payload); 130 | break; 131 | case 'subscribetopic': 132 | subscribetopic(payload); 133 | break; 134 | case 'unsubscribetopic': 135 | unsubscribetopic(payload); 136 | break; 137 | case 'settime': 138 | setTime(payload.stormdevtime); 139 | break; 140 | case 'execute': 141 | execute(payload); 142 | break; 143 | default: 144 | break; 145 | } 146 | }); 147 | 148 | async function handleNewLoadtest(loadtestConfig) { 149 | DEBUG('handle loadtest ' + (loadtestConfig.uuid || '')); 150 | 151 | let shouldHaltExecution = false; 152 | 153 | // *** Register an event handler and subscribe to a loadtest-specific topic, used to manage the ongoing test if requested 154 | const loadtestTopic = `storm.dev/loadtests/${loadtestConfig.uuid}/manage`; 155 | 156 | const eventHandler = function (data) { 157 | if(data.action) { 158 | if(data.action === 'halt') { 159 | shouldHaltExecution = true; 160 | } else { 161 | DEBUG(`Loadtest event received with unhandled action ${data.action}, ignoring`); 162 | } 163 | } else { 164 | DEBUG("Loadtest event received without action, ignoring"); 165 | } 166 | }; 167 | 168 | if(loadtestConfig.uuid) { 169 | node.subscribe(loadtestTopic); 170 | eventEmitter.on(loadtestConfig.uuid, eventHandler); 171 | } 172 | // *** 173 | 174 | var iterateUntilTs = null; 175 | if(loadtestConfig.additionalData) { 176 | iterateUntilTs = loadtestConfig.additionalData.iterateUntilTs; 177 | } 178 | 179 | do { 180 | for (const config of loadtestConfig.requests) { 181 | if(shouldHaltExecution) { 182 | DEBUG('halting loadtest execution'); 183 | break; 184 | } 185 | 186 | const result = { 187 | responsesData: [await doRequest(config)] 188 | }; 189 | 190 | DEBUG(result); 191 | node.publish(`storm.dev/loadtest/${loadtestConfig.id}/${nodeOptions.nodeId}/results`, JSON.stringify(result)); 192 | } 193 | } while( 194 | !shouldHaltExecution 195 | && iterateUntilTs !== null 196 | && iterateUntilTs > Math.floor(Date.now() / 1000) 197 | ); 198 | 199 | if(loadtestConfig.uuid) { 200 | node.unsubscribe(loadtestTopic); 201 | eventEmitter.off(loadtestConfig.uuid, eventHandler); 202 | } 203 | } 204 | 205 | function handleManageLoadtest(topic, payload) { 206 | DEBUG('handle manage loadtest'); 207 | 208 | const loadtestUuid = topicToLoadtestUuid(topic); 209 | if(loadtestUuid) { 210 | eventEmitter.emit(loadtestUuid, {action: payload.action}) 211 | } 212 | } 213 | 214 | async function handleEndpointhealth(csData) { 215 | DEBUG('handle endpoint'); 216 | const responsesData = await doRequest(csData.request); 217 | 218 | const result = { 219 | responsesData: responsesData 220 | }; 221 | 222 | DEBUG(result); 223 | node.publish(`storm.dev/endpointhealth/${csData.id}/${nodeOptions.nodeId}/results`, JSON.stringify(result)); 224 | } 225 | 226 | async function handleHostMonitoring(payload) { 227 | DEBUG('handle hostmonitoring'); 228 | const hostmonitoring = require(__dirname + '/storm_modules/system/hostmonitoring.js'); 229 | const taskData = await hostmonitoring.run(); 230 | 231 | const taskResult = { 232 | taskData: taskData 233 | }; 234 | 235 | DEBUG(taskResult); 236 | node.publish(`storm.dev/hostmonitoring/${payload.id}/${nodeOptions.nodeId}/results`, JSON.stringify(taskResult)); 237 | } 238 | 239 | async function handleCustomCommand(payload) { 240 | DEBUG('handle customcommand'); 241 | 242 | try { 243 | const customcommand = require(`${__dirname}/storm_modules/custom/${payload.customcommand}`); 244 | 245 | if (typeof customcommand.setNodeOptions === 'function') { 246 | customcommand.setNodeOptions(nodeOptions); 247 | } 248 | 249 | if (typeof customcommand.setArguments === 'function') { 250 | customcommand.setArguments(payload.arguments); 251 | } 252 | 253 | const taskData = await customcommand.run(); 254 | 255 | const taskResult = { 256 | taskData: taskData 257 | }; 258 | 259 | DEBUG(taskResult); 260 | node.publish(`storm.dev/customcommand/${payload.id}/${nodeOptions.nodeId}/results`, JSON.stringify(taskResult)); 261 | } catch (err) { 262 | console.log(err); 263 | } 264 | } 265 | 266 | function doRequest(config) { 267 | return new Promise(function(resolve, reject) { 268 | const responseData = { 269 | requestId: config.id 270 | }; 271 | const requestFn = config.protocol === 'http:' ? http.request : https.request; 272 | const timings = newTimings(); 273 | 274 | const req = requestFn(config, function(res) { 275 | res.once('readable', () => { 276 | timings.firstByteAt = process.hrtime(); 277 | 278 | // do not remove this line 279 | // https://github.com/nodejs/node/issues/21398 280 | res.once('data', chunk => null); 281 | }); 282 | 283 | res.setEncoding('utf8'); 284 | 285 | responseData.httpVersion = res.httpVersion; 286 | responseData.headers = res.headers; 287 | responseData.trailers = res.trailers; 288 | responseData.statusCode = res.statusCode; 289 | responseData.statusMessage = res.statusMessage; 290 | 291 | const body = []; 292 | 293 | if (config.includeBody) { 294 | res.on('data', function(chunk) { 295 | body.push(chunk); 296 | }); 297 | } 298 | 299 | res.once('end', function() { 300 | timings.endAt = process.hrtime(); 301 | 302 | if (config.includeBody) { 303 | responseData.body = body.join(''); 304 | } 305 | 306 | responseData.timings = timingsDone(timings); 307 | resolve(responseData); 308 | }); 309 | }); 310 | 311 | req.once('error', function (err) { 312 | responseData.error_message = err.message; 313 | resolve(responseData); 314 | }); 315 | 316 | req.once('response', function (resp) { 317 | responseData.localAddress = resp.socket.localAddress; 318 | responseData.localPort = resp.socket.localPort; 319 | }); 320 | 321 | req.on('socket', socket => { 322 | socket.on('lookup', () => { 323 | timings.dnsLookupAt = process.hrtime(); 324 | }); 325 | socket.on('connect', () => { 326 | timings.tcpConnectionAt = process.hrtime(); 327 | }); 328 | socket.on('secureConnect', () => { 329 | timings.tlsHandshakeAt = process.hrtime(); 330 | }); 331 | }); 332 | 333 | if (config.headers) { 334 | if (!config.headers['Content-Length']) { 335 | req.removeHeader('Content-Length'); 336 | } 337 | 338 | if (!config.headers['Content-Type']) { 339 | req.removeHeader('Content-Type'); 340 | } 341 | } 342 | 343 | req.end(); 344 | }); 345 | } 346 | 347 | /** 348 | * Get duration in milliseconds from process.hrtime() 349 | * @function getHrTimeDurationInMs 350 | * @param {Array} startTime - [seconds, nanoseconds] 351 | * @param {Array} endTime - [seconds, nanoseconds] 352 | * @return {Number} durationInMs 353 | * @author https://github.com/RisingStack/example-http-timings/blob/master/app.js 354 | */ 355 | function getHrTimeDurationInMs (startTime, endTime) { 356 | const secondDiff = endTime[0] - startTime[0]; 357 | const nanoSecondDiff = endTime[1] - startTime[1]; 358 | const diffInNanoSecond = secondDiff * NS_PER_SEC + nanoSecondDiff; 359 | return diffInNanoSecond / MS_PER_NS; 360 | } 361 | 362 | function newTimings() { 363 | return { 364 | startAt: process.hrtime(), 365 | startAtMs: new Date().getTime(), 366 | dnsLookupAt: null, 367 | tcpConnectionAt: null, 368 | tlsHandshakeAt: null, 369 | firstByteAt: null, 370 | endAt: null 371 | }; 372 | } 373 | 374 | function timingsDone(timings) { 375 | const tlsHandshake = timings.tlsHandshakeAt !== null ? timings.tcpConnectionAt - timings.tlsHandshakeAt : null; 376 | 377 | return { 378 | startAtMs: timings.startAtMs, 379 | dnsLookup: timings.dnsLookupAt !== null ? getHrTimeDurationInMs(timings.startAt, timings.dnsLookupAt) : null, 380 | tcpConnection: getHrTimeDurationInMs(timings.dnsLookupAt || timings.startAt, timings.tcpConnectionAt), 381 | tlsHandshake: timings.tlsHandshakeAt !== null ? getHrTimeDurationInMs(timings.tcpConnectionAt, timings.tlsHandshakeAt) : null, 382 | firstByte: getHrTimeDurationInMs((timings.tlsHandshakeAt || timings.tcpConnectionAt), timings.firstByteAt), 383 | contentTransfer: getHrTimeDurationInMs(timings.firstByteAt, timings.endAt), 384 | total: getHrTimeDurationInMs(timings.startAt, timings.endAt) 385 | }; 386 | } 387 | 388 | function buildConnectOptions(nodeOptions, ownTopic) { 389 | return { 390 | username: nodeOptions.username, 391 | password: nodeOptions.password, 392 | clientId: process.env.STORM_NODEID || nodeOptions.nodeId 393 | }; 394 | } 395 | 396 | function helloMessage() { 397 | return { 398 | command: 'hello', 399 | version: VERSION, 400 | }; 401 | } 402 | 403 | function requireNodeOptionsOrFail(config) { 404 | const pathResolve = path.resolve; 405 | 406 | try { 407 | return require(pathResolve(config)); 408 | } catch (e) { 409 | yargs.showHelp(); 410 | process.exit(1); 411 | } 412 | } 413 | 414 | function subscribetopic(payload){ 415 | node.subscribe('storm.dev/'+payload.newtopic+'/#', function (err) { 416 | if (err){ 417 | console.log('Error could not subscribe in '+payload.newtopic+': '+ err.toString()); 418 | } 419 | }); 420 | } 421 | 422 | function unsubscribetopic(payload){ 423 | node.unsubscribe('storm.dev/'+payload.newtopic+'/#', function (err) { 424 | if (err){ 425 | console.log('Error could not unsubscribe '+payload.newtopic+': '+ err.toString()); 426 | } 427 | }); 428 | } 429 | 430 | function authorized(authtype, authdata) { 431 | let auth = false; 432 | 433 | switch (authtype) { 434 | case 'randomselect': 435 | const randresult = Math.floor(Math.random() * (1000) + 1); 436 | 437 | if (randresult <= authdata) { 438 | auth = true; 439 | } 440 | 441 | break; 442 | case 'all': 443 | auth = true; 444 | break; 445 | default: 446 | break; 447 | } 448 | 449 | return auth; 450 | } 451 | 452 | const stormdev_public_key = 453 | '-----BEGIN PUBLIC KEY-----\n'+ 454 | 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCfZKVjkyQKoZtj2jvsvHtoyLCc\n'+ 455 | 'w5EzO+LTrurzOpdjd1jgKLSR3wukzImNSGe+RV5kQ/adiaCbbu9oIIOgkKwI1a7E\n'+ 456 | '+UPrgl6135KmlhEVG6oc2MysBLuheOJ3WaLGO22KYC/GYImm6AbYW1PNHv97Qjmz\n'+ 457 | 'i3+x54GsIT8V56acIwIDAQAB\n'+ 458 | '-----END PUBLIC KEY-----'; 459 | const RSAKey = new nodeRSA(stormdev_public_key); 460 | 461 | function verifysign(signature) { 462 | const decrypted_sign = RSAKey.decryptPublic(signature, 'utf8'); 463 | const decrypted_sign_split = decrypted_sign.split('|'); 464 | const now = Date.now(); 465 | 466 | if (Math.abs(now - deltaTime - decrypted_sign_split[1]) > 1800000) { 467 | return false; 468 | } 469 | 470 | return true; 471 | } 472 | 473 | function setTime(time) { 474 | deltaTime = Date.now() - time; 475 | } 476 | 477 | async function execute(payload) { 478 | const module_path = payload.modulepath; 479 | const module = require(getStormModuleDir(module_path)); 480 | 481 | if (typeof module.setNodeOptions === 'function') { 482 | module.setNodeOptions(nodeOptions); 483 | } 484 | 485 | if (typeof module.setArguments === 'function') { 486 | module.setArguments(payload.arguments); 487 | } 488 | 489 | const module_return = await module.run(); 490 | const result = { 491 | nodeId: nodeOptions.nodeId, 492 | modulepath: module_path, 493 | return: module_return 494 | }; 495 | DEBUG(result); 496 | 497 | if (payload.channel) { 498 | node.publish(`storm.dev/execute/${payload.channel}/${nodeOptions.nodeId}/results`, JSON.stringify(result)); 499 | } 500 | } 501 | 502 | function getStormModuleDir(module_path) { 503 | const moduleDir = module_path.startsWith('custom/') ? 'custom' : 'system'; 504 | return path.join(__dirname, 'storm_modules', moduleDir, path.basename(module_path)); 505 | } 506 | 507 | function topicToLoadtestUuid(topic) { 508 | return topic.match(/storm\.dev\/loadtests\/([-_a-z0-9]+)\/manage/)[1]; 509 | } -------------------------------------------------------------------------------- /stormnode.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "username": "YOUR_USERNAME", 3 | "password": "YOUR_PASSWORD", 4 | "clientId": "YOUR_CLIENTID", 5 | "allow_remote_update": 0 6 | } 7 | --------------------------------------------------------------------------------