-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy paths5tunnel.h
53 lines (43 loc) · 1.01 KB
/
s5tunnel.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
#ifndef S5TUNNEL_H
#define S5TUNNEL_H
#include <stdint.h>
#include <stdbool.h>
#include <pthread.h>
#include <sys/socket.h>
#include <netinet/in.h>
typedef struct s5_remote {
int protocol;
char* local_host;
char* local_port;
uint8_t remote_type;
size_t remote_len;
uint8_t* remote;
struct s5_remote *next;
} s5_remote_t;
typedef struct s5_config {
char* server_host;
char* server_port;
bool auth_enabled;
char* user;
char* passwd;
s5_remote_t *remotes;
} s5_config_t;
typedef struct s5_context {
const s5_config_t *config;
const s5_remote_t *remote;
} s5_context_t;
typedef struct s5_thread {
pthread_t thread;
s5_context_t ctx;
struct s5_thread *next;
} s5_thread_t;
typedef struct s5_fdpair {
int local;
int remote;
} s5_fdpair_t;
enum s5_states {
IDLE, METHOD_SENT, AUTH_SENT, REQUEST_SENT
};
void s5_run(const s5_config_t *config);
ssize_t mks5addr(uint8_t atyp, const char *host, in_port_t port, uint8_t **rslt);
#endif // S5TUNNEL_H