MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / __init__

Method __init__

irc_dpi.py:153–172  ·  view source on GitHub ↗
(
        self,
        interface: str = 'any',
        ports: Optional[frozenset] = None,
        on_session_event: Optional[Callable[[IRCSession, IRCMessage], None]] = None,
        tshark_path: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

151 MAX_BUFFER_PER_FLOW = 16 * 1024 # drop oversized garbage rather than grow forever
152
153 def __init__(
154 self,
155 interface: str = 'any',
156 ports: Optional[frozenset] = None,
157 on_session_event: Optional[Callable[[IRCSession, IRCMessage], None]] = None,
158 tshark_path: Optional[str] = None,
159 ) -> None:
160 self.interface = interface
161 self.ports = ports if ports is not None else self.DEFAULT_PORTS
162 self._on_event = on_session_event
163 self._tshark = tshark_path or shutil.which('tshark')
164
165 self._sessions: Dict[Tuple[str, str, int], IRCSession] = {}
166 # Per-flow line buffer keyed by (src, dst, sport, dport)
167 self._buffers: Dict[Tuple[str, str, int, int], bytearray] = {}
168 self._lock = threading.Lock()
169
170 self._proc: Optional[subprocess.Popen] = None
171 self._thread: Optional[threading.Thread] = None
172 self._running = False
173
174 # ------------------------------------------------------------------ #
175 # Lifecycle

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected