MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / client_conf

Method client_conf

mitmproxy/proxy/mode_servers.py:393–414  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

391 )
392
393 def client_conf(self) -> str | None:
394 if not self._servers:
395 return None
396 host = (
397 self.mode.listen_host(ctx.options.listen_host)
398 or local_ip.get_local_ip()
399 or local_ip.get_local_ip6()
400 )
401 port = self.mode.listen_port(ctx.options.listen_port)
402 return textwrap.dedent(
403 f"""
404 [Interface]
405 PrivateKey = {self.client_key}
406 Address = 10.0.0.1/32
407 DNS = 10.0.0.53
408
409 [Peer]
410 PublicKey = {mitmproxy_rs.wireguard.pubkey(self.server_key)}
411 AllowedIPs = 0.0.0.0/0
412 Endpoint = {host}:{port}
413 """
414 ).strip()
415
416 def to_json(self) -> dict:
417 return {"wireguard_conf": self.client_conf(), **super().to_json()}

Callers 3

_startMethod · 0.95
to_jsonMethod · 0.95

Calls 2

listen_hostMethod · 0.80
listen_portMethod · 0.80

Tested by 1