You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/*
|
|
|
|
* @Description:
|
|
|
|
* @Version: 1.0
|
|
|
|
* @Autor: lishengyin
|
|
|
|
* @Date: 2022-04-11 17:30:58
|
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
|
* @LastEditTime: 2022-04-12 00:07:32
|
|
|
|
*/
|
|
|
|
#ifndef __TCPPROXYSESSION_HPP_
|
|
|
|
#define __TCPPROXYSESSION_HPP_
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <signal.h>
|
|
|
|
#include "Util/logger.h"
|
|
|
|
#include "Util/NoticeCenter.h"
|
|
|
|
#include "UserApp.hpp"
|
|
|
|
#include "Network/TcpServer.h"
|
|
|
|
#include "Network/TcpSession.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace toolkit;
|
|
|
|
|
|
|
|
class TcpProxySession;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TcpProxySession: public TcpSession {
|
|
|
|
public:
|
|
|
|
TcpProxySession(const Socket::Ptr &sock) :
|
|
|
|
TcpSession(sock) {
|
|
|
|
DebugL;
|
|
|
|
}
|
|
|
|
~TcpProxySession() {
|
|
|
|
DebugL;
|
|
|
|
}
|
|
|
|
virtual void onRecv(const Buffer::Ptr &buf) override;
|
|
|
|
|
|
|
|
virtual void onError(const SockException &err) override;
|
|
|
|
|
|
|
|
virtual void onManager() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Ticker _ticker;
|
|
|
|
bool alive = false;
|
|
|
|
std::string usr = "";
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|