Skip to content
Snippets Groups Projects
Select Git revision
  • 3aa8848ac047763ae6fc575ec64beadeefda2d17
  • main default protected
  • release/1.1
  • encrypt_comments
  • mnemonic_dewif
  • authors_rules
  • 0.14
  • rtd
  • 1.2.1 protected
  • 1.2.0 protected
  • 1.1.1 protected
  • 1.1.0 protected
  • 1.0.0 protected
  • 1.0.0rc1 protected
  • 1.0.0rc0 protected
  • 1.0.0-rc protected
  • 0.62.0 protected
  • 0.61.0 protected
  • 0.60.1 protected
  • 0.58.1 protected
  • 0.60.0 protected
  • 0.58.0 protected
  • 0.57.0 protected
  • 0.56.0 protected
  • 0.55.1 protected
  • 0.55.0 protected
  • 0.54.3 protected
  • 0.54.2 protected
28 results

load_cleartext_ascii_armor_message.py

Blame
  • index.js 2.16 KiB
    "use strict";
    
    var co = require('co');
    var Server = require('./server');
    var bma  = require('./app/lib/streams/bma');
    var webmin  = require('./app/lib/streams/webmin');
    var upnp = require('./app/lib/upnp');
    var multicaster = require('./app/lib/streams/multicaster');
    var logger = require('./app/lib/logger')('ucoin');
    
    module.exports = function (dbConf, overConf) {
      return new Server(dbConf, overConf);
    };
    
    module.exports.statics = {
    
      enableHttpAdmin: (dbConf, overConf, httpLogs, wmHost, wmPort) => webmin(dbConf, overConf, [{
        ip:  wmHost || 'localhost',
        port: wmPort || 9220
      }], httpLogs !== false),
    
      startNode: (server, conf) => co(function *() {
    
        logger.info(">> NODE STARTING");
    
        // Public http interface
        let bmapi = yield bma(server, null, conf.httplogs);
    
        // Routing documents
        server
        // The router asks for multicasting of documents
          .pipe(server.router())
          // The documents get sent to peers
          .pipe(multicaster(server.conf))
          // The multicaster may answer 'unreachable peer'
          .pipe(server.router());
    
        // Services
        yield module.exports.statics.startServices(server);
        yield bmapi.openConnections();
    
        logger.info('>> Server ready!');
      }),
    
      startServices: (server) => co(function *() {
    
        /***************
         * HTTP ROUTING
         **************/
        server.router(server.conf.routing);
    
        /***************
         *    UPnP
         **************/
        if (server.conf.upnp) {
          try {
            if (server.upnpAPI) {
              server.upnpAPI.stopRegular();
            }
            server.upnpAPI = yield upnp(server.conf.port, server.conf.remoteport);
            server.upnpAPI.startRegular();
          } catch (e) {
            logger.warn(e);
          }
        }
    
        /*******************
         * BLOCK COMPUTING
         ******************/
        if (server.conf.participate) {
          server.startBlockComputation();
        }
    
        /***********************
         * CRYPTO NETWORK LAYER
         **********************/
        server.start();
    
        return {};
      }),
    
      stopServices: (server) => co(function *() {
    
        server.router(false);
        if (server.conf.participate) {
          server.stopBlockComputation();
        }
        yield server.stop();
    
        return {};
      })
    };