-
Notifications
You must be signed in to change notification settings - Fork 203
/
Copy pathglobal.h
131 lines (120 loc) · 2.68 KB
/
global.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef __GLOBAL_H__
#define __GLOBAL_H__
#include <string>
#include <map>
#include <list>
#include "sslbio.h"
using namespace std;
#if WIN32
#else
#include <netinet/in.h>
#endif
struct TunnelInfo
{
char localhost[255];
int localport;
int localtls;
char hostheader[255];
char subdomain[255];
char hostname[255];
char httpauth[255];
char protocol[10];
char ReqId[20];
int remoteport;
int regtime;
int regstate;
};
struct TunnelReq
{
char localhost[255];
char url[255];
char hostheader[255];
int localport;
int localtls;
int regtime;
};
struct Sockinfo
{
ssl_info *sslinfo; //remote ssl
ssl_info *localSslinfo; //local ssl
TunnelReq *tunnelreq;
int isconnect; //remote connect flag
int istype; //1=remote 2=local,3=cmd
int tosock;
int sock;
unsigned char *packbuf;
unsigned long long packbuflen;
int isconnectlocal; //local connect flag
int linktime;
int isauth; //auth
};
struct MainInfo
{
char shost[255];
char udphost[255];
sockaddr_in saddr;
int sport;
int udpport;
int udp;
char authtoken[255];
char pwdc[255];//
string ClientId ;
int pingtime ;
int ping ; //
int mainsock;
int lastdnstime;
int mainsockstatus;
int regtunneltime;
int lastdnsback;
int lasterrtime;
map<string,TunnelReq*> G_TunnelAddr;
};
#if UDPTUNNEL
struct UdpInfo
{
int auth; //login flag
int authtime; //login flag
int regTunnel;//login flag
int pingtime;
int pongtime;
int ping; //
int msock;
int lsock;
sockaddr_in servAddr;
string ClientId;
string authtoken;
string password_c;
map<string,TunnelReq*>G_TunnelAddr;
};
extern UdpInfo udpInfo;
#endif
extern MainInfo mainInfo;
extern map<int,Sockinfo*>G_SockList;
extern list<TunnelInfo*> G_TunnelList;
inline void InitMainInfo(){
memset(mainInfo.authtoken,0,255);
memset(mainInfo.pwdc,0,255);
memset(mainInfo.shost,0,255);
memset(mainInfo.udphost,0,255);
mainInfo.ping=25;
mainInfo.sport=443;
mainInfo.udpport=8001;
mainInfo.udp=0;
mainInfo.pingtime=0;
mainInfo.mainsock=0;
mainInfo.lastdnstime=0;
mainInfo.regtunneltime=0;
mainInfo.lastdnsback=0;
mainInfo.lasterrtime=0;
sprintf(mainInfo.shost,"ngrokd.ngrok.com");
sprintf(mainInfo.udphost,"127.0.0.1");
#if UDPTUNNEL
udpInfo.auth=0;
udpInfo.authtime=0;
udpInfo.ping=25;
udpInfo.regTunnel=0;
udpInfo.pongtime=0;
udpInfo.pingtime=0;
#endif
}
#endif