コード例 #1
0
 def initiate_meta_messages(self):
     """
     Setup all message that can be received by this community and the super classes.
     :return: list of meta messages.
     """
     return super(TrustChainCommunity, self).initiate_meta_messages() + [
         Message(self, HALF_BLOCK, NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 HalfBlockPayload(), self._generic_timeline_check,
                 self.received_half_block),
         Message(self, HALF_BLOCK_BROADCAST, NoAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 NHopCommunityDestination(10, depth=2), HalfBlockPayload(),
                 self._generic_timeline_check, self.received_half_block),
         Message(self, BLOCK_PAIR, NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 BlockPairPayload(), self._generic_timeline_check,
                 self.received_block_pair),
         Message(self, BLOCK_PAIR_BROADCAST, NoAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 NHopCommunityDestination(10, depth=2), BlockPairPayload(),
                 self._generic_timeline_check, self.received_block_pair),
         Message(self, CRAWL, MemberAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 CrawlRequestPayload(), self._generic_timeline_check,
                 self.received_crawl_request)
     ]
コード例 #2
0
ファイル: community.py プロジェクト: zzmjohn/tribler
 def initiate_meta_messages(self):
     pruning = GlobalTimePruning(10000, 11000)
     return [
         Message(self,
                 u"barter-record",
                 DoubleMemberAuthentication(
                     allow_signature_func=self.allow_signature_request,
                     encoding="bin"),
                 PublicResolution(),
                 LastSyncDistribution(synchronization_direction=u"DESC",
                                      priority=128,
                                      history_size=1,
                                      pruning=pruning),
                 CommunityDestination(node_count=10),
                 BarterRecordPayload(),
                 self.check_barter_record,
                 self.on_barter_record,
                 batch=BatchConfiguration(max_window=4.5)),
         Message(self, u"ping", NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 PingPayload(), self.check_ping, self.on_ping),
         Message(self, u"pong", NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 PongPayload(), self.check_pong, self.on_pong),
         Message(self, u"member-request", NoAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), MemberRequestPayload(),
                 self.check_member_request, self.on_member_request),
         Message(self, u"member-response",
                 MemberAuthentication(encoding="bin"), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 MemberResponsePayload(), self.check_member_response,
                 self.on_member_response),
     ]
コード例 #3
0
 def initiate_meta_messages(self):
     return super(TestCommunity, self).initiate_meta_messages() + [
         Message(self, SIGNATURE,
                 NoAuthentication(),
                 PublicResolution(),
                 DirectDistribution(),
                 CandidateDestination(),
                 SignaturePayload(),
                 lambda: None,
                 lambda: None),
         Message(self, CRAWL_REQUEST,
                 NoAuthentication(),
                 PublicResolution(),
                 DirectDistribution(),
                 CandidateDestination(),
                 CrawlRequestPayload(),
                 lambda: None,
                 lambda: None),
         Message(self, CRAWL_RESPONSE,
                 NoAuthentication(),
                 PublicResolution(),
                 DirectDistribution(),
                 CandidateDestination(),
                 CrawlResponsePayload(),
                 lambda: None,
                 lambda: None),
         Message(self, CRAWL_RESUME,
                 NoAuthentication(),
                 PublicResolution(),
                 DirectDistribution(),
                 CandidateDestination(),
                 CrawlResumePayload(),
                 lambda: None,
                 lambda: None)]
コード例 #4
0
 def initiate_meta_messages(self):
     return [
         Message(self, u"contact",
                 NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 ContactPayload(), self.check_contact, self.on_contact)
     ]
コード例 #5
0
 def initiate_meta_messages(self):
     return super(TestCommunity, self).initiate_meta_messages() + [
         Message(self, HALF_BLOCK,
                 NoAuthentication(),
                 PublicResolution(),
                 DirectDistribution(),
                 CandidateDestination(),
                 HalfBlockPayload(),
                 lambda: None,
                 lambda: None),
         Message(self, CRAWL,
                 NoAuthentication(),
                 PublicResolution(),
                 DirectDistribution(),
                 CandidateDestination(),
                 CrawlRequestPayload(),
                 lambda: None,
                 lambda: None)]
コード例 #6
0
 def initiate_meta_messages(self):
     return super(HiddenTunnelCommunity, self).initiate_meta_messages() + \
         [Message(self, u"dht-request", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), DHTRequestPayload(), self._generic_timeline_check,
                  self.on_dht_request),
          Message(self, u"dht-response", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), DHTResponsePayload(), self.check_dht_response,
                  self.on_dht_response),
          Message(self, u"key-request", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), KeyRequestPayload(), self.check_key_request,
                  self.on_key_request),
          Message(self, u"key-response", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), KeyResponsePayload(), self.check_key_response,
                  self.on_key_response),
          Message(self, u"create-e2e", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), CreateE2EPayload(), self.check_key_request,
                  self.on_create_e2e),
          Message(self, u"created-e2e", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), CreatedE2EPayload(), self.check_created_e2e,
                  self.on_created_e2e),
          Message(self, u"link-e2e", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), LinkE2EPayload(), self.check_link_e2e,
                  self.on_link_e2e),
          Message(self, u"linked-e2e", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), LinkedE2EPayload(), self.check_linked_e2e,
                  self.on_linked_e2e),
          Message(self, u"establish-intro", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), EstablishIntroPayload(), self.check_establish_intro,
                  self.on_establish_intro),
          Message(self, u"intro-established", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), IntroEstablishedPayload(), self.check_intro_established,
                  self.on_intro_established),
          Message(self, u"establish-rendezvous", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), EstablishRendezvousPayload(), self.check_establish_rendezvous,
                  self.on_establish_rendezvous),
          Message(self, u"rendezvous-established", NoAuthentication(), PublicResolution(), DirectDistribution(),
                  CandidateDestination(), RendezvousEstablishedPayload(), self.check_rendezvous_established,
                  self.on_rendezvous_established)]
コード例 #7
0
 def initiate_meta_messages(self):
     return [Message(self, u"effort-record", DoubleMemberAuthentication(allow_signature_func=self.allow_signature_request, encoding="bin"), PublicResolution(), LastSyncDistribution(synchronization_direction=u"DESC", priority=128, history_size=1), CommunityDestination(node_count=10), EffortRecordPayload(), self.check_effort_record, self.on_effort_record, batch=BatchConfiguration(max_window=4.5)),
             Message(self, u"ping", NoAuthentication(), PublicResolution(), DirectDistribution(), CandidateDestination(), PingPayload(), self.check_ping, self.on_ping),
             Message(self, u"pong", NoAuthentication(), PublicResolution(), DirectDistribution(), CandidateDestination(), PongPayload(), self.check_pong, self.on_pong),
             Message(self, u"debug-request", MemberAuthentication(), LinearResolution(), DirectDistribution(), CommunityDestination(node_count=32), DebugRequestPayload(), self.check_debug_request, self.on_debug_request),
             Message(self, u"debug-response", MemberAuthentication(), PublicResolution(), DirectDistribution(), CandidateDestination(), DebugResponsePayload(), self.check_debug_response, self.on_debug_response)]