Skip to content

Commit

Permalink
Count for network_type
Browse files Browse the repository at this point in the history
Signed-off-by: Toomore Chiang (ocf.tw) <toomore@ocf.tw>
  • Loading branch information
toomore committed Nov 16, 2023
1 parent 4f1cfc5 commit 7a8ccea
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions asn_coverage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@

> [!NOTE]
> 無法使用 `s3cmd` 來取得公開 bucket 的資料,可以改用 [s5cmd](https://github.com/peak/s5cmd) 取得。
### 已發現的資料問題

1. `AS38136` 註冊為 HK,但在 TW 觀測資料中發現。
11 changes: 11 additions & 0 deletions asn_coverage/ooni.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def lookback(units=36, loc='TW'):
''' lookback the datas '''
oonis3 = OONIS3()
counts = {}
network_type = {}
for date in Arrow.span_range('hour',
Arrow.utcnow().shift(hours=units*-1).datetime,
Arrow.utcnow().datetime):
Expand Down Expand Up @@ -73,13 +74,23 @@ def lookback(units=36, loc='TW'):

counts[json_data['probe_asn']] += 1

if 'network_type' in json_data['annotations']:
if json_data['annotations']['network_type'] not in network_type:
network_type[json_data['annotations']
['network_type']] = 0

network_type[json_data['annotations']
['network_type']] += 1

# print(f"""[{json_data['probe_asn']} - {
# json_data['probe_cc']}] {json_data['resolver_asn']} {
# json_data['resolver_ip']} {json_data['resolver_network_name']}""")

pprint(counts)
pprint(network_type)

pprint(counts)
pprint(network_type)


def span_date():
Expand Down

0 comments on commit 7a8ccea

Please sign in to comment.