This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This script will download a package (and all of its dependencies) from the | |
* online NPM registry, then create a gzip'd tarball containing that package | |
* and all of its dependencies. This archive can then be copied to a machine | |
* without internet access and installed using npm. | |
* | |
* The idea is pretty simple: | |
* - npm install [package] | |
* - rewrite [package]/package.json to copy dependencies to bundleDependencies | |
* - npm pack [package] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use script"; | |
var http = require(http); | |
var request_count = 10; | |
var options = { | |
hostname: '192.0.2.1' | |
port: 80, | |
method: 'GET', | |
path: '/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var vsm = require('lrs/virtualServerModule'); | |
var requestHandler = function(servReq, servResp, next){ | |
servReq.on('response', function responseHandler(cliResp){ | |
cliResp.bindHeaders(servResp); | |
servResp.removeHeader("Server"); | |
servResp.removeHeader("X-Powered-By"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var vsm = require('lrs/VirtualServerModule'); | |
var urlm = require('url'); | |
var cookie = require('cookie'); | |
function onClientReq(servReq, servResp, next) { | |
var url = urlm.parse(servReq.url); | |
if (url.hostname == 'example.com') | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var vsm = require('lrs/virtualServerModule'); | |
var bunyan = require('bunyan'); | |
// Function to return required fields from the request object | |
function reqSerializer(req) { | |
return { | |
method: req.method, | |
url: req.url, | |
headers: req.headers.host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
safeBrowse = require('safe-browse'); | |
var safeBrowseApi = new safeBrowse.Api(AIzaSyA0do0yx2CP786Ex31THcjNRkuuIdtL5wg, options); | |
safeBrowseApi.lookup('http://twitter.com') | |
.on('success', function (data) { | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//******************************************************************************************************************************** | |
// Description: HTTP redirection in a forward-proxy context. A forward-proxy is useful for filter connections | |
// particularly outbound to the internet for clients sitting behind a firewall for example. | |
// In this example below, any user HTTP request from clients results in a redirection | |
// to the specified site (in this case a bland example.com site). More sophistication can be added | |
// like a login page for authenticating outbound/internet access and other IT policy enforcement. | |
"use strict"; | |
var fpm = require('lrs/forwardProxyModule'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************************************************* | |
* Description: | |
* HTTP redirection in a forward-proxy context. A forward-proxy is useful for filter | |
* connections particularly outbound to the internet for clients sitting behind a | |
* firewall for example. In this example below, any user HTTP request from clients | |
* results in a redirection to the specified site (in this case a bland example.com site). | |
* More sophistication can be added like a login page for authenticating outbound/internet | |
* access and other enterprise policy enforcement. | |
*/ |