46 lines
1 KiB
C++
46 lines
1 KiB
C++
#pragma once
|
|
|
|
#include "api.h"
|
|
#include "proxyinterface.h"
|
|
#include <QObject>
|
|
#include <QtPlugin>
|
|
|
|
#include <set>
|
|
#include <zmq.hpp>
|
|
|
|
/*
|
|
mitmproxy base plugin
|
|
|
|
This plugin implements the interface for the basic mitmproxy plugin.
|
|
*/
|
|
class mitmproxyPlugin : public QObject, public http::ProxyInterface
|
|
{
|
|
Q_OBJECT
|
|
Q_PLUGIN_METADATA(IID HTTPProxyInterfaceIID FILE "mitmproxy.json")
|
|
Q_INTERFACES(http::ProxyInterface)
|
|
private:
|
|
std::set<std::string> received;
|
|
zmq::context_t context;
|
|
zmq::socket_t *socket;
|
|
std::set<std::string> accepted_flows;
|
|
bool is_connected = false;
|
|
void connect();
|
|
void reconnect();
|
|
|
|
public:
|
|
//! name of the plugin
|
|
QString getName() override;
|
|
//! returns, whether the proxy is currently connected
|
|
bool connected() override;
|
|
//! disconnects the handle
|
|
void disconnect() override;
|
|
|
|
public slots:
|
|
//! called in a custom thread, may block.
|
|
void process();
|
|
|
|
signals:
|
|
void finished();
|
|
void error(QString err);
|
|
void message(http::Flow flow);
|
|
};
|