MCPcopy
hub / github.com/mitmproxy/mitmproxy / match

Function match

mitmproxy/flowfilter.py:671–683  ·  view source on GitHub ↗

Matches a flow against a compiled filter expression. Returns True if matched, False if not. If flt is a string, it will be compiled as a filter expression. If the expression is invalid, ValueError is raised.

(flt: str | TFilter, flow: flow.Flow)

Source from the content-addressed store, hash-verified

669
670
671def match(flt: str | TFilter, flow: flow.Flow) -> bool:
672 """
673 Matches a flow against a compiled filter expression.
674 Returns True if matched, False if not.
675
676 If flt is a string, it will be compiled as a filter expression.
677 If the expression is invalid, ValueError is raised.
678 """
679 if isinstance(flt, str):
680 flt = parse(flt)
681 if flt:
682 return flt(flow)
683 return True
684
685
686match_all: TFilter = parse("~all")

Callers 1

getMethod · 0.85

Calls 1

parseFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…