From 51cfb2001e63ea40a8175fe9b26ab2996a4b3167 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 29 Oct 2019 01:32:32 -0600 Subject: [PATCH] remove cruft --- examples/manage.js | 60 ---------------------------------------------- examples/server.js | 16 ------------- 2 files changed, 76 deletions(-) delete mode 100644 examples/manage.js delete mode 100644 examples/server.js diff --git a/examples/manage.js b/examples/manage.js deleted file mode 100644 index e336d05..0000000 --- a/examples/manage.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; - -// tradeoff - lazy load certs vs DOS invalid sni - -var Manager = module.exports; - -var Cache = {}; - -Manager.create = function(conf) { - var domains = conf.domains; - var manager = {}; - - // { servername, wildname } - manager.getSubject = function(opts) { - if ( - !opts.domains.includes(opts.domain) && - !opts.domains.includes(opts.wildname) - ) { - throw new Error('not a registered domain'); - } - return opts.domains[0]; - }; - - manager.add = function() {}; - - // { servername, wildname } - manager.configure = function(opts) {}; - - // { servername } - manager._contexts = {}; -}; - -var manager = Manager.create({ - domains: ['example.com', '*.example.com'] -}); - -Cache.getTlsContext = function(servername) { - // TODO exponential fallback certificate renewal - if (Cache._contexts[servername]) { - // may be a context, or a promise for a context - return Cache._contexts[servername]; - } - - var wildname = - '*.' + - (servername || '') - .split('.') - .slice(1) - .join('.'); - - var opts = { - servername: servername, - domain: servername, - wildname: wildname - }; - manager._contexts[servername] = manager - .orderCertificate(opts) - .then(function() {}) - .catch(function(e) {}); -}; diff --git a/examples/server.js b/examples/server.js deleted file mode 100644 index cd0e391..0000000 --- a/examples/server.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -var http = require('http'); -var https = require('http2'); -var greenlock = require('../greenlock.js').create({ - maintainerEmail: 'jon@example.com' -}); - -function app(req, res) { - res.end('Hello, Encrypted World!'); -} - -http.createServer(greenlock.plainMiddleware()).listen(8080); -https - .createServer(greenlock.tlsOptions, greenlock.secureMiddleware(app)) - .listen(8443);