mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
sans-io compat++
This commit is contained in:
parent
98f060d019
commit
739b5b0b74
@ -9,7 +9,7 @@ from mitmproxy.utils import human
|
|||||||
|
|
||||||
class TermStatus:
|
class TermStatus:
|
||||||
def running(self):
|
def running(self):
|
||||||
if ctx.options.server:
|
if ctx.master.server.bound:
|
||||||
ctx.log.info(
|
ctx.log.info(
|
||||||
"Proxy server listening at http://{}".format(
|
"Proxy server listening at http://{}".format(
|
||||||
human.format_address(ctx.master.server.address)
|
human.format_address(ctx.master.server.address)
|
||||||
|
@ -6,6 +6,7 @@ from mitmproxy import connections
|
|||||||
from mitmproxy import controller, exceptions # noqa
|
from mitmproxy import controller, exceptions # noqa
|
||||||
from mitmproxy import stateobject
|
from mitmproxy import stateobject
|
||||||
from mitmproxy import version
|
from mitmproxy import version
|
||||||
|
from mitmproxy.utils import compat
|
||||||
|
|
||||||
|
|
||||||
class Error(stateobject.StateObject):
|
class Error(stateobject.StateObject):
|
||||||
@ -63,8 +64,8 @@ class Flow(stateobject.StateObject):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
type: str,
|
type: str,
|
||||||
client_conn: connections.ClientConnection,
|
client_conn: compat.Client,
|
||||||
server_conn: connections.ServerConnection,
|
server_conn: compat.Server,
|
||||||
live: bool=None
|
live: bool=None
|
||||||
) -> None:
|
) -> None:
|
||||||
self.type = type
|
self.type = type
|
||||||
@ -84,8 +85,8 @@ class Flow(stateobject.StateObject):
|
|||||||
_stateobject_attributes = dict(
|
_stateobject_attributes = dict(
|
||||||
id=str,
|
id=str,
|
||||||
error=Error,
|
error=Error,
|
||||||
client_conn=connections.ClientConnection,
|
client_conn=compat.Client,
|
||||||
server_conn=connections.ServerConnection,
|
server_conn=compat.Server,
|
||||||
type=str,
|
type=str,
|
||||||
intercepted=bool,
|
intercepted=bool,
|
||||||
is_replay=str,
|
is_replay=str,
|
||||||
|
@ -10,6 +10,7 @@ async def test_configure():
|
|||||||
ts = termstatus.TermStatus()
|
ts = termstatus.TermStatus()
|
||||||
with taddons.context() as ctx:
|
with taddons.context() as ctx:
|
||||||
ctx.master.server = proxy.DummyServer()
|
ctx.master.server = proxy.DummyServer()
|
||||||
|
ctx.master.server.bound = True
|
||||||
ctx.configure(ts, server=False)
|
ctx.configure(ts, server=False)
|
||||||
ts.running()
|
ts.running()
|
||||||
ctx.configure(ts, server=True)
|
ctx.configure(ts, server=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user