fixed proxy interface
This commit is contained in:
parent
f99ee2abde
commit
1baee8c1e7
3 changed files with 14 additions and 8 deletions
|
@ -1,5 +1,6 @@
|
|||
SET(CMAKE_AUTOMOC ON)
|
||||
add_library(mitmproxy_plugin MODULE mitmproxy_network.cpp mitmproxy_network.h mitmproxy.json)
|
||||
add_compile_definitions(IS_HTTP_PROXY_INTERFACE)
|
||||
add_library(mitmproxy_plugin SHARED mitmproxy_network.cpp mitmproxy_network.h mitmproxy.json)
|
||||
target_include_directories(mitmproxy_plugin PRIVATE ../../include/)
|
||||
target_link_libraries(mitmproxy_plugin PRIVATE Qt5::Core cppzmq)
|
||||
set_target_properties(mitmproxy_plugin PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN_DIR})
|
||||
|
|
|
@ -22,9 +22,8 @@ void mitmproxyPlugin::reconnect()
|
|||
this->connect();
|
||||
}
|
||||
|
||||
void mitmproxyPlugin::process(std::string path)
|
||||
void mitmproxyPlugin::process()
|
||||
{
|
||||
this->path = path;
|
||||
connect();
|
||||
while(true) {
|
||||
zmq::message_t response;
|
||||
|
|
|
@ -13,7 +13,7 @@ mitmproxy base plugin
|
|||
|
||||
This plugin implements the interface for the basic mitmproxy plugin.
|
||||
*/
|
||||
class mitmproxyPlugin : public QObject, http::ProxyInterface
|
||||
class mitmproxyPlugin : public QObject, public http::ProxyInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID HTTPProxyInterfaceIID FILE "mitmproxy.json")
|
||||
|
@ -23,16 +23,22 @@ private:
|
|||
zmq::context_t context;
|
||||
zmq::socket_t *socket;
|
||||
std::set<std::string> accepted_flows;
|
||||
std::string path;
|
||||
bool is_connected = false;
|
||||
void connect();
|
||||
void reconnect();
|
||||
|
||||
public:
|
||||
//! called in a custom thread, may block.
|
||||
void process(std::string path) override;
|
||||
//! returns, whether the proxy is currently connected
|
||||
bool connected() override;
|
||||
//! disconnects the handle
|
||||
void disconnect() override;
|
||||
// options/settings
|
||||
|
||||
public slots:
|
||||
//! called in a custom thread, may block.
|
||||
void process();
|
||||
|
||||
signals:
|
||||
void finished();
|
||||
void error(QString err);
|
||||
void message(http::Flow flow);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue