goldilocks.js/lib/worker.js

26 lines
732 B
JavaScript

'use strict';
// TODO needs some sort of config-sync
process.on('message', function (conf) {
var deps = {
messenger: process
// Note that if a custom createConnections is used it will be called with different
// sets of custom options based on what is actually being proxied. Most notably the
// HTTP proxying connection creation is not something we currently control.
, net: require('net')
};
deps.proxy = require('./proxy-conn').create(deps, conf);
deps.storage = {
config: {
save: function (changes) {
process.send({
type: 'com.daplie.goldilocks.config-change',
changes: changes
});
}
}
};
require('./goldilocks.js').create(deps, conf);
});