示例#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)
     ]
 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)]
示例#3
0
 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),
     ]
示例#4
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(MultiChainCommunity, self).initiate_meta_messages() + [
         Message(
             self, SIGNATURE,
             DoubleMemberAuthentication(
                 allow_signature_func=self.allow_signature_request,
                 split_payload_func=split_function), PublicResolution(),
             DirectDistribution(), CandidateDestination(),
             SignaturePayload(), self._generic_timeline_check,
             self.received_signature_response),
         Message(self, CRAWL_REQUEST, MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), CrawlRequestPayload(),
                 self._generic_timeline_check, self.received_crawl_request),
         Message(self, CRAWL_RESPONSE, MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), CrawlResponsePayload(),
                 self._generic_timeline_check,
                 self.received_crawl_response),
         Message(self, CRAWL_RESUME, MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), CrawlResumePayload(),
                 self._generic_timeline_check,
                 self.received_crawl_resumption)
     ]
示例#5
0
    def initiate_meta_messages(self):
        batch_delay = 1.0

        return [Message(self, u"channelcast", MemberAuthentication(encoding="sha1"), PublicResolution(), DirectDistribution(), CandidateDestination(), ChannelCastPayload(), self.check_channelcast, self.on_channelcast),
                Message(self, u"channelcast-request", MemberAuthentication(encoding="sha1"), PublicResolution(), DirectDistribution(), CandidateDestination(), ChannelCastRequestPayload(), self.check_channelcast_request, self.on_channelcast_request),
                Message(self, u"channelsearch", MemberAuthentication(encoding="sha1"), PublicResolution(), DirectDistribution(), CommunityDestination(node_count=10), ChannelSearchPayload(), self.check_channelsearch, self.on_channelsearch),
                Message(self, u"channelsearch-response", MemberAuthentication(encoding="sha1"), PublicResolution(), DirectDistribution(), CandidateDestination(), ChannelSearchResponsePayload(), self.check_channelsearch_response, self.on_channelsearch_response),
                Message(self, u"votecast", MemberAuthentication(encoding="sha1"), PublicResolution(), FullSyncDistribution(enable_sequence_number=False, synchronization_direction=u"DESC", priority=128), CommunityDestination(node_count=10), VoteCastPayload(), self.check_votecast, self.on_votecast, self.undo_votecast, batch=BatchConfiguration(max_window=batch_delay))
                ]
示例#6
0
 def initiate_meta_messages(self):
     return super(BarterCommunity, self).initiate_meta_messages() + [
         Message(self, u"stats-request", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), StatisticsRequestPayload(),
                 self.check_stats_request, self.on_stats_request),
         Message(self, u"stats-response", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), StatisticsResponsePayload(),
                 self.check_stats_response, self.on_stats_response)
     ]
示例#7
0
    def _initialize_meta_messages(self):
        super(EffortCommunity, self)._initialize_meta_messages()

        # replace the callbacks for the dispersy-introduction-request and
        # dispersy-introduction-response messages
        meta = self._meta_messages[u"dispersy-introduction-request"]
        self._original_on_introduction_request = meta.handle_callback
        self._meta_messages[meta.name] = Message(meta.community, meta.name, meta.authentication, meta.resolution, meta.distribution, meta.destination, meta.payload, meta.check_callback, self.on_introduction_request, meta.undo_callback, meta.batch)
        assert self._original_on_introduction_request

        meta = self._meta_messages[u"dispersy-introduction-response"]
        self._original_on_introduction_response = meta.handle_callback
        self._meta_messages[meta.name] = Message(meta.community, meta.name, meta.authentication, meta.resolution, meta.distribution, meta.destination, meta.payload, meta.check_callback, self.on_introduction_response, meta.undo_callback, meta.batch)
        assert self._original_on_introduction_response
示例#8
0
 def initiate_meta_messages(self):
     return [
         Message(self, u"contact",
                 NoAuthentication(), PublicResolution(),
                 DirectDistribution(), CandidateDestination(),
                 ContactPayload(), self.check_contact, self.on_contact)
     ]
    def _initialize_meta_messages(self):
        Community._initialize_meta_messages(self)

        ori = self._meta_messages[u"dispersy-introduction-request"]
        self._disp_intro_handler = ori.handle_callback

        new = Message(self, ori.name, ori.authentication, ori.resolution, ori.distribution, ori.destination, TasteIntroPayload(), ori.check_callback, self.on_taste_intro)
        self._meta_messages[u"dispersy-introduction-request"] = new
示例#10
0
    def _initialize_meta_messages(self):
        super(SearchCommunity, self)._initialize_meta_messages()

        ori = self._meta_messages[u"dispersy-introduction-request"]
        new = Message(self, ori.name, ori.authentication,
                      ori.resolution, ori.distribution, ori.destination,
                      TasteIntroPayload(), ori.check_callback,
                      ori.handle_callback)
        self._meta_messages[u"dispersy-introduction-request"] = new
示例#11
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)]
示例#12
0
 def initiate_meta_messages(self):
     return super(DemersTest, self).initiate_meta_messages() + [
         Message(
             self, u"text", MemberAuthentication(), PublicResolution(),
             FullSyncDistribution(enable_sequence_number=False,
                                  synchronization_direction=u"DESC",
                                  priority=128),
             CommunityDestination(node_count=10), TextPayload(),
             self.check_text, self.on_text)
     ]
示例#13
0
 def initiate_meta_messages(self):
     return super(SearchCommunity, self).initiate_meta_messages() + [
         Message(self, u"search-request", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), SearchRequestPayload(),
                 self._generic_timeline_check, self.on_search),
         Message(self, u"search-response", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), SearchResponsePayload(),
                 self._generic_timeline_check, self.on_search_response),
         Message(self, u"torrent-request", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), TorrentRequestPayload(),
                 self._generic_timeline_check, self.on_torrent_request),
         Message(self, u"torrent-collect-request", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), TorrentCollectRequestPayload(),
                 self._generic_timeline_check,
                 self.on_torrent_collect_request),
         Message(self, u"torrent-collect-response", MemberAuthentication(),
                 PublicResolution(), DirectDistribution(),
                 CandidateDestination(), TorrentCollectResponsePayload(),
                 self._generic_timeline_check,
                 self.on_torrent_collect_response),
         Message(
             self, u"torrent", MemberAuthentication(), PublicResolution(),
             FullSyncDistribution(enable_sequence_number=False,
                                  synchronization_direction=u"ASC",
                                  priority=128),
             CommunityDestination(node_count=0), TorrentPayload(),
             self._generic_timeline_check, self.on_torrent),
     ]
示例#14
0
 def initiate_meta_messages(self):
     return super(TemplateCommunity, self).initiate_meta_messages() + [
         Message(self,
                 u"text",
                 MemberAuthentication(),
                 LinearResolution(),
                 FullSyncDistribution(enable_sequence_number=False,
                                      synchronization_direction=u"ASC",
                                      priority=128),
                 CommunityDestination(node_count=10),
                 TextPayload(),
                 self.check_text,
                 self.on_text,
                 batch=BatchConfiguration(max_window=5.0))
     ]
示例#15
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)]
示例#16
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)]
示例#17
0
 def initiate_meta_messages(self):
     # return [Message(self, u"barter-record", MultiMemberAuthentication(count=2, allow_signature_func=self.allow_signature_request), PublicResolution(), LastSyncDistribution(synchronization_direction=u"out-order", history_size=1), CommunityDestination(node_count=10), BarterRecordPayload(), self.check_barter_record, self.on_barter_record)]
     return [Message(self, u"barter-record", MultiMemberAuthentication(count=2, allow_signature_func=self.allow_signature_request), PublicResolution(), FullSyncDistribution(enable_sequence_number=False, synchronization_direction=u"out-order"), CommunityDestination(node_count=10), BarterRecordPayload(), self.check_barter_record, self.on_barter_record)]
示例#18
0
 def initiate_meta_messages(self):
     return [Message(self, u"effort-record", MultiMemberAuthentication(count=2, allow_signature_func=self.allow_signature_request), 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)),
             ]