-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from DecFox/issue-32-messaging
feat: introduce observation generation for messaging nettests
- Loading branch information
Showing
7 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from dataclasses import dataclass | ||
from typing import List, Optional | ||
from oonidata.compat import add_slots | ||
from oonidata.models.base_model import BaseModel | ||
from oonidata.models.dataformats import ( | ||
TCPConnect, | ||
DNSQuery | ||
) | ||
|
||
from .base_measurement import BaseMeasurement | ||
|
||
|
||
@add_slots | ||
@dataclass | ||
class FacebookMessengerTestKeys(BaseModel): | ||
facebook_b_api_dns_consistent: Optional[bool] = None | ||
facebook_b_api_reachable: Optional[bool] = None | ||
facebook_b_graph_dns_consistent: Optional[bool] = None | ||
facebook_b_graph_reachable: Optional[bool] = None | ||
facebook_dns_blocking: Optional[bool] = None | ||
facebook_edge_dns_consistent: Optional[bool] = None | ||
facebook_edge_reachable: Optional[bool] = None | ||
facebook_external_cdn_dns_consistent: Optional[bool] = None | ||
facebook_external_cdn_reachable: Optional[bool] = None | ||
facebook_scontent_cdn_dns_consistent: Optional[bool] = None | ||
facebook_scontent_cdn_reachable: Optional[bool] = None | ||
facebook_star_dns_consistent: Optional[bool] = None | ||
facebook_star_reachable: Optional[bool] = None | ||
facebook_stun_dns_consistent: Optional[bool] = None | ||
facebook_stun_reachable: Optional[bool] = None | ||
facebook_tcp_blocking: Optional[bool] = None | ||
|
||
socksproxy: Optional[str] = None, | ||
tcp_connect: Optional[List[TCPConnect]] = None | ||
queries: Optional[List[DNSQuery]] = None | ||
|
||
|
||
@add_slots | ||
@dataclass | ||
class FacebookMessenger(BaseMeasurement): | ||
__test_name__ = "facebook_messenger" | ||
|
||
test_keys: FacebookMessengerTestKeys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from typing import List, Tuple | ||
from oonidata.models.nettests import FacebookMessenger | ||
from oonidata.models.observations import WebObservation | ||
from oonidata.transforms.nettests.measurement_transformer import MeasurementTransformer | ||
|
||
|
||
class FacebookMessengerTransformer(MeasurementTransformer): | ||
def make_observations(self, msmt: FacebookMessenger) -> Tuple[List[WebObservation]]: | ||
dns_observations = self.make_dns_observations(msmt.test_keys.queries) | ||
tcp_observations = self.make_tcp_observations(msmt.test_keys.tcp_connect) | ||
|
||
return ( | ||
self.consume_web_observations( | ||
dns_observations=dns_observations, | ||
tcp_observations=tcp_observations, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import List, Tuple | ||
from oonidata.models.nettests import Whatsapp | ||
from oonidata.models.observations import WebObservation | ||
from oonidata.transforms.nettests.measurement_transformer import MeasurementTransformer | ||
|
||
|
||
class WhatsappTransformer(MeasurementTransformer): | ||
def make_observations(self, msmt: Whatsapp) -> Tuple[List[WebObservation]]: | ||
dns_observations = self.make_dns_observations(msmt.test_keys.queries) | ||
tcp_observations = self.make_tcp_observations(msmt.test_keys.tcp_connect) | ||
tls_observations = self.make_tls_observations( | ||
msmt.test_keys.tls_handshakes, | ||
msmt.test_keys.network_events, | ||
) | ||
http_observations = self.make_http_observations(msmt.test_keys.requests) | ||
|
||
return ( | ||
self.consume_web_observations( | ||
dns_observations=dns_observations, | ||
tcp_observations=tcp_observations, | ||
tls_observations=tls_observations, | ||
http_observations=http_observations, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters