Repository: mitmproxy/mitmproxy

Issue:
WireGuard missing in `--help` and `--options`
#### Problem Description

Maybe it's just my tired brain?

#### Steps to reproduce the behavior:
```
$: mitmdump --help

--mode MODE, -m MODE  The proxy server type(s) to spawn. Can be passed multiple times. Mitmproxy supports "regular" (HTTP), "transparent", "socks5", "reverse:SPEC", and "upstream:SPEC" proxy servers. For reverse
                        and upstream proxy modes, SPEC is host specification in the form of "http[s]://host[:port]". You may append `@listen_port` or `@listen_host:listen_port` to override `listen_host` or
                        `listen_port` for a specific proxy mode. Features such as client playback will use the first mode to determine which upstream server to use. May be passed multiple times.
```

```
$: mitmdump --options

# The proxy server type(s) to spawn. Can be passed multiple times.
# Mitmproxy supports "regular" (HTTP), "transparent", "socks5",
# "reverse:SPEC", and "upstream:SPEC" proxy servers. For reverse and
# upstream proxy modes, SPEC is host specification in the form of
# "http[s]://host[:port]".  You may append `@listen_port` or
# `@listen_host:listen_port` to override `listen_host` or `listen_port`
# for a specific proxy mode. Features such as client playback will use
# the first mode to determine which upstream server to use. Type
# sequence of str.
mode:
- regular
```

#### System Information

```
Mitmproxy: 10.0.0.dev binary
Python:    3.11.0
OpenSSL:   OpenSSL 3.0.5 5 Jul 2022
Platform:  Linux-5.15.0-52-generic-x86_64-with-glibc2.35
```



Discussion:

Resolving patch:
diff --git a/mitmproxy/options.py b/mitmproxy/options.py
--- a/mitmproxy/options.py
+++ b/mitmproxy/options.py
@@ -103,8 +103,9 @@ def __init__(self, **kwargs) -> None:
             The proxy server type(s) to spawn. Can be passed multiple times.
 
             Mitmproxy supports "regular" (HTTP), "transparent", "socks5", "reverse:SPEC",
-            and "upstream:SPEC" proxy servers. For reverse and upstream proxy modes, SPEC
-            is host specification in the form of "http[s]://host[:port]".
+            "upstream:SPEC", and "wireguard[:PATH]" proxy servers. For reverse and upstream proxy modes, SPEC
+            is host specification in the form of "http[s]://host[:port]". For WireGuard mode, PATH may point to
+            a file containing key material. If no such file exists, it will be created on startup.
 
             You may append `@listen_port` or `@listen_host:listen_port` to override `listen_host` or `listen_port` for
             a specific proxy mode. Features such as client playback will use the first mode to determine
diff --git a/mitmproxy/proxy/mode_servers.py b/mitmproxy/proxy/mode_servers.py
--- a/mitmproxy/proxy/mode_servers.py
+++ b/mitmproxy/proxy/mode_servers.py
@@ -308,6 +308,7 @@ async def start(self) -> None:
 
         try:
             if not conf_path.exists():
+                conf_path.parent.mkdir(parents=True, exist_ok=True)
                 conf_path.write_text(json.dumps({
                     "server_key": wg.genkey(),
                     "client_key": wg.genkey(),


Test patch: