Commit Graph

405 Commits

Author SHA1 Message Date
Mazen Ramadan 5697b2e352
docs: Fix wrong option type (#5633) 2022-10-05 14:13:03 +02:00
Fabio Valentini 19afd8f9dd
docs: add documentation for wireguard mode (#5607) 2022-09-25 18:49:05 +02:00
Maximilian Hils dc8ff24685 don't remove `add_log` but deprecate it. 2022-09-18 13:45:37 +02:00
Maximilian Hils c69239bb90 switch to stdlib logging
mitmproxy previously used a homegrown logging mechanism based around
`mitmproxy.ctx.log` and the `add_log` hook. This worked well for everything
we control, but does not work outside the mitmproxy universe.
For now we have simply ignored logging in e.g. tornado or h2, but with the
upcoming introduction of mitmproxy_wireguard we now have a dependency
on some Rust/PyO3 code for which we definitely want logs, but which also
cannot easily be changed to use our homegrown logging (PyO3 does the heavy
lifting to add interoperability with stdlib logging). Long story short,
we want to introduce a log handler for stdlib logging.

Now there are two ways how such a handler could operate:

 1. We could build a handler that forwards all stdlib log events
    into our homegrown mechanism.
 2. We embrace stdlib's logging as the correct way to do things,
    and get rid of our homegrown stuff.

This PR follows the second approach by removing the `add_log` hook and
rewriting the `TermLog` and `EventStore` addons to listen for stdlib log records.
This means that all `mitmproxy.ctx.log.info` events are now simply `logging.info` etc.

One upside of this approach is that many parts of the codebase now don't depend
on the existence of `mitmproxy.ctx` and we can use off-the-shelf things like pytest's
`caplog`. We can also now better colorize log output and/or add timestamps.
2022-09-17 17:28:35 +02:00
Manuel Meitinger 891dae031c
Make default_port protocol specific. (#5563)
* [modes] make default_port protocol specific

* fix nits

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2022-09-07 12:14:48 +00:00
Manuel Meitinger 1706a9b9fe
Unify proxy modes, introduce UDP protocol detection. (#5556)
* [modes] new unified syntax

* [modes] full coverage udp.py

* [modes] mypy and coverage

* [modes] split mode_spec into two files

* [modes] adjust DNS layer

* [modes] add udp layer decision

* [modes] use 1:1 ServerInstances

* [modes] fix paste issue

* [modes] update tests

* [modes] fix typo

* [modes] updated docs

* [modes] fix typo
2022-08-30 05:27:51 +02:00
Manuel Meitinger cd4a74fae7
Add support for raw UDP. (#5414) 2022-07-27 02:20:30 +02:00
Maximilian Hils 633130e208
add `mode_specs` docs, remove `@classmethod @property` usage (#5485)
`@classmethod @property` is deprecated in Python 3.11.
2022-07-25 14:16:12 +00:00
Maximilian Hils 02b982f000
windows install: document that installer is faster
refs #5375
2022-05-26 14:12:25 +02:00
Maximilian Hils 49c7f09a94 adjust to changes in pdoc 12 2022-05-15 19:16:36 +02:00
Maximilian Hils b3587b52b2 make it black! 2022-04-28 19:11:10 +02:00
Maximilian Hils fdde9ba3b3 use Python 3.9+ typing 2022-04-26 13:53:23 +02:00
Maximilian Hils 08b8310133 drop support for Python 3.8 2022-04-26 13:53:04 +02:00
Maximilian Hils b31ad66225 `autoflake --in-place **/*.py` 2022-04-26 13:52:46 +02:00
Maximilian Hils e83ec8390a `pyupgrade --py39-plus **/*.py` 2022-04-26 13:51:11 +02:00
Maximilian Hils 8d6a279818 add very basic DNS API docs
the rest still needs to be done, but this should serve as a template
2022-04-23 13:33:18 +02:00
Manuel Meitinger 7acc1b2590 Merge branch 'main' of https://github.com/mitmproxy/mitmproxy into dns 2022-04-09 04:03:23 +02:00
Maximilian Hils 02d2b6d310
warn users if sse flows are received without streaming, refs #4469 (#5249) 2022-04-06 10:51:58 +00:00
Manuel Meitinger f1d937bf4b Merge branch 'main' of https://github.com/mitmproxy/mitmproxy into dns 2022-03-29 22:43:08 +02:00
Maximilian Hils beb49ab121 don't use #noqa for imports 2022-03-29 13:51:08 +02:00
Manuel Meitinger af2251c2ef [dns] minor fixes 2022-03-27 15:23:59 +02:00
Maximilian Hils a7d473c1c1 fix compatibility with Python <3.10 2022-03-15 19:50:06 +01:00
Maximilian Hils 1af095bcf8 docs: fix options generation, add anchors 2022-03-15 19:02:43 +01:00
Maximilian Hils 2d2a9f3c52
adjust to template changes in pdoc 10 (#5132) 2022-02-14 15:07:20 +00:00
Maximilian Hils ffe58ae34c fix map local examples 2022-02-09 09:03:59 +01:00
nt8en 83b43b93a7
Fix a typo in addons-overview.md (#5088) 2022-01-25 09:39:54 +01:00
ian klatzco 2455632a9c
typo (#5062) 2022-01-16 00:37:57 +01:00
James Yale ace07e7e3c
Example specified incorrect header (#4997)
* Example specified incorrect header

* Add CHANGELOG entry reference the documentation update

* fixup! Add CHANGELOG entry reference the documentation update
2021-12-20 20:18:00 +01:00
Maximilian Hils 3cb87f5a2f split `tls_handshake` hook into client/server and success/fail variants 2021-11-22 10:23:21 +01:00
Maximilian Hils a72f61ef57 Merge remote-tracking branch 'origin/main' into ignore-after-clienthello 2021-11-22 09:54:08 +01:00
Maximilian Hils 7be646f44a add note that spoof_source_address is unavailable, refs #4914 2021-11-18 15:39:23 +01:00
Maximilian Hils 4f47612548 StackOverflow -> GitHub Discussions (part 2) 2021-11-16 11:02:57 +01:00
Maximilian Hils 017344dfe4 tls: api docs++ 2021-09-04 17:03:26 +02:00
Maximilian Hils 9f39e2f387 tests++ 2021-09-04 16:03:06 +02:00
Maximilian Hils a3eca0b859 socks5 upstream auth: use proxyauth option 2021-08-25 17:23:49 +02:00
Maximilian Hils 7efefb716e docs: remove outdated http/2 advice 2021-08-04 17:30:36 +02:00
Maximilian Hils 359406e7a5 update certificate docs 2021-08-03 17:02:49 +02:00
Maximilian Hils aca3456fee docs: update ignore domains tutorial 2021-08-03 16:31:57 +02:00
Maximilian Hils e270399a3e docs: be more clear on pattern separator 2021-07-21 09:58:42 +02:00
Maximilian Hils 5b4ac96f4c
Merge pull request #4650 from mhils/prinzhorn
[WIP] Fix WebSocket/TCP injection
2021-07-15 13:18:33 +02:00
Alexander Prinzhorn aee4df7c4a
remove websocket_error event, fixes #4674
Technically there is no websocket error but different close codes. Similar to how an internal server error is not an error in HTTP, but just a different status code.
2021-07-14 09:09:59 +02:00
Alexander Prinzhorn eef6522a5e remove websocket_error event, fixes #4674 2021-07-12 16:35:25 +02:00
Alexander Prinzhorn d4bc25fce9
separate tls_start hooks for client and server, fixes #4665, refs #4547 (#4666) 2021-07-09 20:15:38 +02:00
Maximilian Hils 1858564b91 add WebSocketMessage.text 2021-06-22 17:39:55 +02:00
Maximilian Hils a33ab986ba revise based on @prinzhorn's feedback 2021-06-22 16:54:29 +02:00
Maximilian Hils f342061319
Update addons-api-changelog.md 2021-06-17 20:15:29 +02:00
Maximilian Hils 0958f39f40 add upgrade docs for mitmproxy 7 2021-06-17 15:53:22 +02:00
Maximilian Hils 76f0b8f65e fix tests 2021-06-15 10:45:26 +02:00
Alexander Prinzhorn 231c8eefe3
Update README.md (#4620)
* Document Cookie header folding issues

* plural: *exists*, me: 😮

* link list

* Update README.md

* fair well modd

* minor wording fix

Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2021-06-04 09:14:11 +00:00
Zoltán Reegn 01c18c109b
docs: requirements for custom mitmproxy-ca.pem (#4601)
* docs: requirements for custom mitmproxy-ca.pem

* docs: fix typos
2021-05-24 12:19:45 +02:00