Closed chhsiao90 closed 2 years ago
Hi @koh-osug @abbasvalliani
There is a lot of change in this pull request, can you help to check this? Any comments will be appreciated. Thanks.
There is also a lot of breaking change (I'm trying to make the interface and function name more readable and reasonable), so I already update the next release version to 2.0.0 as a major release. Sorry for the inconvenience about the breaking change.
@abbasvalliani
Example code for http response intercept can be found here
It looks complicated, I will create some template interceptors to simplify the intercept process in separate PR.
Yes, I will check it. My setup is a local MITM proxy and an Android project.
@chhsiao90 My initial gut feeling looking at this is the level of complexity for the user. Any chance we can simplify this while still providing the control (if needed). I don't have an issue using the API as is, but could be cumbersome for someone new.
Thanks @abbasvalliani for the feedback, agreed with the complexity of the API. This PR just built the fundamental of response interception, will provide more user friendly api later!
I have used:
config.getListeners().add(NitmProxyListenerProvider.singleton(new NitmProxyListener() {
@Override
public void onConnect(ConnectionContext connectionContext, Channel serverChannel) {
System.out.println("Connected");
}
}));
and the listener is triggered once the backend channel is established. But I'm confused about the API. I do not understand the singleton pattern, actually whenever the singleton
method is called, a new instance is created? And a NitmProxyListenerProvider
is used, not a listener directly.
To configure a listener provider instead of listener itself is because we want to have the flexibility to have different instance of listener across different context. The singleton method is to provide for the case if you just want to have only one instance in the server.
Karsten Ohme @.***>於 2021年10月22日 週五,下午8:34寫道:
I have used:
config.getListeners().add(NitmProxyListenerProvider.singleton(new NitmProxyListener() { @Override public void onConnect(ConnectionContext connectionContext, Channel serverChannel) { System.out.println("Connected"); } }));
and the listener is triggered once the backend channel is established. But I'm confused about the API. I do not understand the singleton pattern, actually whenever the singleton method is called, a new instance is created? And a NitmProxyListenerProvider is used, not a listener directly.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/chhsiao90/nitmproxy/pull/111#issuecomment-949590127, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSLJWFSSTYWTZQPRMRV5HLUIFK6JANCNFSM5GLA5RWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@chhsiao90 Thanks for all your hard work on this. Is there a way to prevent the Http2FrameWrapper from being part of the response interface and use Netty objects directly?
@chhsiao90 Any chance we can do a release of 2.0? Thanks!
nitmproxy v2.0.0 just released