Skip to content

Commit ae00b9e

Browse files
jonatacklaanwj
authored andcommitted
contrib: add seeds progress indicator and remove asmap one in makeseeds script
1 parent b541803 commit ae00b9e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

contrib/seeds/makeseeds.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def parseline(line: str) -> Union[dict, None]:
4747
sline = line.split()
4848
if len(sline) < 11:
4949
# line too short to be valid, skip it.
50-
return None
50+
return None
5151
m = PATTERN_IPV4.match(sline[0])
5252
sortkey = None
5353
ip = None
@@ -141,10 +141,6 @@ def filterbyasn(asmap: ASMap, ips: List[Dict], max_per_asn: Dict, max_per_net: i
141141
asn_count: Dict[int, int] = collections.defaultdict(int)
142142

143143
for i, ip in enumerate(ips_ipv46):
144-
if i % 10 == 0:
145-
# give progress update
146-
print(f"{i:6d}/{len(ips_ipv46)} [{100*i/len(ips_ipv46):04.1f}%]\r", file=sys.stderr, end='', flush=True)
147-
148144
if net_count[ip['net']] == max_per_net:
149145
# do not add this ip as we already too many
150146
# ips from this network
@@ -184,8 +180,10 @@ def main():
184180
asmap = ASMap(args.asmap)
185181
print('Done.', file=sys.stderr)
186182

183+
print('Loading and parsing DNS seeds…', end='', file=sys.stderr, flush=True)
187184
lines = sys.stdin.readlines()
188185
ips = [parseline(line) for line in lines]
186+
print('Done.', file=sys.stderr)
189187

190188
print('\x1b[7m IPv4 IPv6 Onion Pass \x1b[0m', file=sys.stderr)
191189
print(f'{ip_stats(ips):s} Initial', file=sys.stderr)

0 commit comments

Comments
 (0)