respodns/respodns/structs.py

40 lines
1.1 KiB
Python
Raw Permalink Normal View History

2020-08-29 05:54:07 -07:00
from collections import namedtuple
2020-08-29 01:16:06 -07:00
from dataclasses import dataclass
2020-08-29 06:34:46 -07:00
2020-08-29 01:16:06 -07:00
@dataclass
class Options:
# TODO: move this out of Options, since it's really not.
2020-08-29 01:16:06 -07:00
execution: object = None
ip_simul: int = 30 # how many IPs to connect to at once
domain_simul: int = 3 # how many domains per IP to request at once
packets_per_second: int = 50 # rough limit on all outgoing DNS packets
2020-08-29 01:16:06 -07:00
ip_wait: float = 0.05
2020-08-29 01:16:06 -07:00
domain_wait: float = 0.25
impatient: bool = False # reduce retries and times for timeouts
2020-08-29 06:34:46 -07:00
early_stopping: bool = True # stop at the first invalid domain
2020-08-29 01:16:06 -07:00
dry: bool = True # don't write anything to database
2020-09-04 06:01:58 -07:00
progress: bool = False # periodically print progress to stderr
blocking_file_io: bool = False # halt execution until inputs arrive
2020-08-29 01:16:06 -07:00
2020-08-29 06:34:46 -07:00
2020-08-29 01:16:06 -07:00
@dataclass
class Entry:
from datetime import datetime
date: datetime
success: bool
server: str
kind: str
domain: str
exception: str
addrs: list # list of strings
reason: str
execution: object
2020-08-29 05:54:07 -07:00
2020-08-29 06:34:46 -07:00
Check = namedtuple("Check", ("kind", "domain", "failures"))