CProxy/conf.h

82 lines
1.6 KiB
C
Raw Normal View History

#ifndef CONF_H
#define CONF_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <error.h>
#include <unistd.h>
2019-06-20 09:39:31 +08:00
2020-01-21 19:48:05 +08:00
// 配置文件结构
typedef struct CONF {
// server module
int uid;
int process;
2020-07-30 18:10:31 +08:00
int timeout;
int sslencoding;
//int server_port;
2020-07-30 18:10:31 +08:00
int tcp_listen;
int tcp6_listen;
2020-07-30 18:10:31 +08:00
int dns_listen;
int udp_listen;
2020-01-21 19:48:05 +08:00
// http module
int http_port;
char *http_ip, *http_del, *http_first;
int http_ip_len, http_del_len, http_first_len;
2022-04-20 17:12:58 +08:00
int http_encode;
2020-01-21 19:48:05 +08:00
// https module
int https_port;
char *https_ip, *https_del, *https_first;
int https_ip_len, https_del_len, https_first_len;
2022-04-20 17:12:58 +08:00
int https_encode;
2020-12-15 10:43:06 +08:00
// httpdns module
2022-04-23 21:55:24 +08:00
char *httpdns_addr;
char *httpdns_http_req;
int httpdns_addr_len;
int httpdns_http_req_len;
2020-07-30 18:10:31 +08:00
int encode;
// httpudp module
char *httpudp_addr;
char *httpudp_http_req;
2022-01-19 21:48:02 +08:00
int httpudp_addr_len;
int httpudp_http_req_len;
int httpudp_encode;
2020-01-21 19:48:05 +08:00
} conf;
typedef struct tcp {
char *strrep;
int strrep_len;
char *strrep_s, *strrep_t;
int strrep_s_len, strrep_t_len;
char *regrep;
int regrep_len;
char *regrep_s, *regrep_t;
int regrep_s_len, regrep_t_len;
struct tcp *next;
} tcp;
extern tcp *http_head_strrep;
extern tcp *http_head_regrep;
extern tcp *http_node;
extern tcp *https_head_strrep;
extern tcp *https_head_regrep;
extern tcp *https_node;
extern void print_tcp(tcp *p);
extern void free_tcp(tcp **p);
extern tcp *local_reverse(tcp *head);
char *strncpy_(char *dest, const char *src, size_t n);
void read_conf(char *file, conf *p);
void free_conf(conf *p);
#endif