2019-01-19 16:13:58 +08:00
|
|
|
#ifndef CONF_H
|
|
|
|
#define CONF_H
|
|
|
|
|
2020-03-24 11:46:32 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <error.h>
|
2019-04-21 10:41:28 +08:00
|
|
|
#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;
|
2020-03-24 11:46:32 +08:00
|
|
|
int sslencoding;
|
|
|
|
//int server_port;
|
2020-07-30 18:10:31 +08:00
|
|
|
int tcp_listen;
|
2020-11-05 21:56:08 +08:00
|
|
|
int tcp6_listen;
|
2020-07-30 18:10:31 +08:00
|
|
|
int dns_listen;
|
2021-12-23 09:02:41 +08:00
|
|
|
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
|
|
|
|
2021-12-23 09:02:41 +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;
|
2022-06-04 11:06:12 +08:00
|
|
|
|
2021-12-23 09:02:41 +08:00
|
|
|
// httpudp module
|
|
|
|
char *httpudp_addr;
|
|
|
|
char *httpudp_http_req;
|
2022-01-19 21:48:02 +08:00
|
|
|
int httpudp_addr_len;
|
2021-12-23 09:02:41 +08:00
|
|
|
int httpudp_http_req_len;
|
|
|
|
int httpudp_encode;
|
2020-01-21 19:48:05 +08:00
|
|
|
} conf;
|
|
|
|
|
2022-01-02 18:36:09 +08:00
|
|
|
typedef struct tcp {
|
|
|
|
char *strrep;
|
2022-01-12 09:41:32 +08:00
|
|
|
int strrep_len;
|
2022-01-02 18:36:09 +08:00
|
|
|
char *strrep_s, *strrep_t;
|
2022-01-12 09:41:32 +08:00
|
|
|
int strrep_s_len, strrep_t_len;
|
2022-01-02 18:36:09 +08:00
|
|
|
|
|
|
|
char *regrep;
|
2022-01-12 09:41:32 +08:00
|
|
|
int regrep_len;
|
2022-01-02 18:36:09 +08:00
|
|
|
char *regrep_s, *regrep_t;
|
2022-01-12 09:41:32 +08:00
|
|
|
int regrep_s_len, regrep_t_len;
|
2022-01-02 18:36:09 +08:00
|
|
|
|
|
|
|
struct tcp *next;
|
|
|
|
} tcp;
|
|
|
|
|
2022-02-06 19:04:04 +08:00
|
|
|
extern tcp *http_head_strrep;
|
|
|
|
extern tcp *http_head_regrep;
|
2022-01-02 18:36:09 +08:00
|
|
|
extern tcp *http_node;
|
|
|
|
|
2022-02-06 19:04:04 +08:00
|
|
|
extern tcp *https_head_strrep;
|
|
|
|
extern tcp *https_head_regrep;
|
2022-01-02 18:36:09 +08:00
|
|
|
extern tcp *https_node;
|
2022-02-06 19:04:04 +08:00
|
|
|
|
2022-06-04 11:06:12 +08:00
|
|
|
extern void print_tcp(tcp * p);
|
|
|
|
extern void free_tcp(tcp ** p);
|
|
|
|
extern tcp *local_reverse(tcp * head);
|
2022-01-02 18:36:09 +08:00
|
|
|
|
2019-02-19 17:29:58 +08:00
|
|
|
char *strncpy_(char *dest, const char *src, size_t n);
|
2022-06-04 11:06:12 +08:00
|
|
|
void read_conf(char *file, conf * p);
|
|
|
|
void free_conf(conf * p);
|
2019-01-19 16:13:58 +08:00
|
|
|
|
|
|
|
#endif
|