コード例 #1
0
    def __init__(self, callback, statedir, port):
        assert isinstance(port, int)
        assert 0 <= port
        super(TrackerDispersy, self).__init__(callback, statedir)

        # non-autoload nodes
        self._non_autoload = set()
        self._non_autoload.update(
            host for host, _ in self._bootstrap_candidates.iterkeys())
        # leaseweb machines, some are running boosters, they never unload a community
        self._non_autoload.update([
            "95.211.105.65", "95.211.105.67", "95.211.105.69", "95.211.105.71",
            "95.211.105.73", "95.211.105.75", "95.211.105.77", "95.211.105.79",
            "95.211.105.81", "85.17.81.36"
        ])

        # logger
        overlaylogpostfix = "dp" + str(port) + ".log"
        self._logger = OverlayLogger.getInstance(overlaylogpostfix, statedir)
        self._candidates_status = {}
        callback.register(self._candidate_logger, priority=-128)

        # generate a new my-member
        ec = ec_generate_key(u"very-low")
        self._my_member = Member(ec_to_public_bin(ec), ec_to_private_bin(ec))

        callback.register(self._unload_communities, priority=-128)
コード例 #2
0
    def __init__(self, callback, statedir, port):
        assert isinstance(port, int)
        assert 0 <= port
        super(TrackerDispersy, self).__init__(callback, statedir)

        # logger
        overlaylogpostfix = "dp" + str(port) + ".log"
        self._logger = OverlayLogger.getInstance(overlaylogpostfix, statedir)

        # generate a new my-member
        ec = ec_generate_key(u"very-low")
        self._my_member = Member.get_instance(ec_to_public_bin(ec), ec_to_private_bin(ec))

        callback.register(self._unload_communities, priority=-128)
コード例 #3
0
    def __init__(self, callback, statedir, port):
        assert isinstance(port, int)
        assert 0 <= port
        super(TrackerDispersy, self).__init__(callback, statedir)

        # non-autoload nodes
        self._non_autoload = set()
        self._non_autoload.update(host for host, _ in self._bootstrap_candidates.iterkeys())
        # leaseweb machines, some are running boosters, they never unload a community
        self._non_autoload.update(["95.211.105.65", "95.211.105.67", "95.211.105.69", "95.211.105.71", "95.211.105.73", "95.211.105.75", "95.211.105.77", "95.211.105.79", "95.211.105.81", "85.17.81.36"])

        # logger
        overlaylogpostfix = "dp" + str(port) + ".log"
        self._logger = OverlayLogger.getInstance(overlaylogpostfix, statedir)
        self._candidates_status = {}
        callback.register(self._candidate_logger, priority=-128)

        # generate a new my-member
        ec = ec_generate_key(u"very-low")
        self._my_member = Member(ec_to_public_bin(ec), ec_to_private_bin(ec))

        callback.register(self._unload_communities, priority=-128)
コード例 #4
0
ファイル: script.py プロジェクト: gvsurenderreddy/Tribler-2
    def run(self):
        ec = ec_generate_key(u"low")
        self._my_member = Member.get_instance(ec_to_public_bin(ec), ec_to_private_bin(ec), sync_with_database=True)

        self.caller(self.test_incoming_channel)
        self.caller(self.test_outgoing_channel)
コード例 #5
0
# The list is in the following format:
#
# <peername> <ip> <port> <public key> <private key>
#
# The public and private keys come from an eleptic curve
# key, generated during runtime for each peer
#
# Use ./barter-ec-generator.py --help for help on the parameters
#
from Tribler.Core.dispersy.crypto import ec_generate_key, ec_to_public_bin, ec_to_private_bin

if __name__ == "__main__":
    from optparse import OptionParser
    parser = OptionParser()
    parser.add_option("--total-peers", help="Total number of peers to generate ip:port and key combinations. Default 50", type=int, default=50)
    parser.add_option("--port-start", help="Port number to start assigning from. Default 12000", default=12000)
    parser.add_option("-o", help="Output file. Default \"../peers/peer-keys\"", default="../peers/peer-keys")
    options, _ = parser.parse_args()

    with open(options.o, 'wb') as nodefp:
        for i in xrange(0, options.total_peers):
            rsa = ec_generate_key(u"low")
            nodefp.write("%(id)s %(ip)s %(port)d %(public_key)s %(private_key)s\n" % \
                          {'id': i+1, #'peer-%05d' % i,
                           'ip': '0.0.0.0',
                           'port': options.port_start + i,
                           'public_key': ec_to_public_bin(rsa).encode("HEX"),
                           'private_key': ec_to_private_bin(rsa).encode("HEX")
                           }
                          )
コード例 #6
0
ファイル: script.py プロジェクト: gvsurenderreddy/Tribler-2
    def run(self):
        ec = ec_generate_key(u"low")
        self._my_member = Member.get_instance(ec_to_public_bin(ec), ec_to_private_bin(ec))
        self._community = None

        self.caller(self.scenario)