Example #1
0
def setup(args):
    logger.log("Setting up PlebNet")

    # Prepare Cloudomate
    if args.test_net:
        settings.wallets_testnet("1")
        settings.settings.write()

    fake_generator.generate_child_account()

    # TODO: change --> Prepare plebnet
    config = PlebNetConfig()
    config.set('expiration_date',
               time.time() + 30 * plebnet_settings.TIME_IN_DAY)
    config.save()

    # handle the DNA
    dna = DNA()
    dna.read_dictionary(cloudomate_controller.get_vps_providers())
    dna.write_dictionary()

    # Prepare the IRC Client
    irc_handler.init_irc_client()
    irc_handler.start_irc_client()

    logger.success("PlebNet is ready to roll!")
Example #2
0
def setup(args):
    """
    This method should only be called once and is responsible for the initial setup of the PlebNet
    agent. All necessary configuration files are created and IRC communication is started.
    :param args: If running in Testnet mode.
    """
    global qtable, config
    logger.log("Setting up PlebNet")

    # Set general info about the PlebNet agent
    settings.irc_nick(settings.irc_nick_def() +
                      str(random.randint(1000, 10000)))
    config = PlebNetConfig()
    config.set('expiration_date', time.time() + TIME_ALIVE)

    # Prepare the QTable configuration
    qtable = QTable()

    if args.test_net:
        settings.wallets_testnet("1")
        qtable.read_dictionary({
            'proxhost':
            cloudomate_controller.get_vps_providers()['proxhost']
        })
    else:
        providers = cloudomate_controller.get_vps_providers()

        if providers.has_key('proxhost'):
            del providers["proxhost"]

        # Create QTable if it does not exist
        qtable.read_dictionary(providers)

    if args.exit_node:
        logger.log("Running as exitnode")
        settings.tribler_exitnode('1')

    settings.settings.write()

    # Prepare first child configuration
    fake_generator.generate_child_account()

    # Prepare the IRC Client
    irc_handler.init_irc_client()
    irc_handler.start_irc_client()

    config.save()

    # add learning_consumer as a consumer for qtable channel in addressbook
    qtable.address_book.receiver.register_consumer("qtable", learning_consumer)

    logger.success("PlebNet is ready to roll!")
Example #3
0
def setup(args):
    """
    This method should only be called once and is responsible for the initial setup of the PlebNet
    agent. All necessary configuration files are created and IRC communication is started.
    :param args: If running in Testnet mode.
    """
    global dna, config
    logger.log("Setting up PlebNet")

    # Prepare the DNA configuration
    dna = DNA()

    if args.test_net:
        settings.wallets_testnet("1")
        settings.settings.write()
        dna.read_dictionary({
            'proxhost':
            cloudomate_controller.get_vps_providers()['proxhost']
        })
    else:
        dna.read_dictionary(cloudomate_controller.get_vps_providers())
        if 'proxhost' in dna.vps.keys():
            dna.remove_provider('proxhost')
    dna.write_dictionary()

    if args.exit_node:
        logger.log("Running as exitnode")
        settings.tribler_exitnode('1')

    # Prepare first child configuration
    fake_generator.generate_child_account()

    # Set general info about the PlebNet agent
    settings.irc_nick(settings.irc_nick_def() +
                      str(random.randint(1000, 10000)))
    config = PlebNetConfig()
    config.set('expiration_date',
               time.time() + 30 * plebnet_settings.TIME_IN_DAY)

    # Prepare the IRC Client
    irc_handler.init_irc_client()
    irc_handler.start_irc_client()

    if dna.get_own_tree() == '':
        logger.log("tree set to %s" % settings.irc_nick())
        dna.set_own_tree(settings.irc_nick())

    config.save()

    logger.success("PlebNet is ready to roll!")