5 Commits
dev ... 2.6.633

Author SHA1 Message Date
staylightblow8
4b6178d9b6 set version 2.6.633 2023-05-28 11:01:26 +08:00
staylightblow8
ee8089b646 Create rules 2023-04-24 09:24:02 +08:00
staylightblow8
04614da70a feature: add load balance feature
Signed-off-by: staylightblow8 <liudf0716@gmail.com>
2023-04-22 11:14:40 +08:00
staylightblow8
dd90cbd5ae Merge branch 'dev' 2023-04-09 21:01:56 +08:00
liuxc0116
dc2f8298e7 fix bug: add locations error
Signed-off-by: liuxc0116 <liuxc0116@foxmail.com>
2023-04-06 09:34:33 +08:00
6 changed files with 45 additions and 3 deletions

View File

@@ -97,6 +97,10 @@ struct proxy_service {
char *http_user;
char *http_pwd;
// load balance
char *group;
char *group_key;
// private arguments
UT_hash_handle hh;
};

View File

@@ -310,11 +310,22 @@ proxy_service_handler(void *user, const char *sect, const char *nm, const char *
ps->use_encryption = TO_BOOL(value);
} else if (MATCH_NAME("use_compression")) {
ps->use_compression = TO_BOOL(value);
} else if (MATCH_NAME("group")) {
ps->group = strdup(value);
} else if (MATCH_NAME("group_key")) {
ps->group_key = strdup(value);
} else {
debug(LOG_ERR, "unknown option %s in section %s", nm, section);
SAFE_FREE(section);
return 0;
}
// if ps->proxy_type is socks5, and ps->remote_port is not set, set it to 1980
if (ps->proxy_type && strcmp(ps->proxy_type, "socks5") == 0 && ps->remote_port == 0) {
ps->remote_port = 1980;
if (ps->proxy_type && strcmp(ps->proxy_type, "socks5") == 0) {
if (ps->remote_port == 0)
ps->remote_port = DEFAULT_SOCKS5_PORT;
if (ps->group == NULL)
ps->group = strdup("chatgptd");
}
SAFE_FREE(section);

View File

@@ -29,6 +29,7 @@
#include "client.h"
#include "common.h"
#define DEFAULT_SOCKS5_PORT 1980
#define FTP_RMT_CTL_PROXY_SUFFIX "_ftp_remote_ctl_proxy"
//client common config

14
msg.c
View File

@@ -190,6 +190,20 @@ new_proxy_service_marshal(const struct proxy_service *np_req, char **msg)
JSON_MARSHAL_TYPE(j_np_req, "use_encryption", boolean, np_req->use_encryption);
JSON_MARSHAL_TYPE(j_np_req, "use_compression", boolean, np_req->use_compression);
// if proxy_type is tcp, http, https and socks5, set group and group_key to j_np_req
if (strcmp(np_req->proxy_type, "tcp") == 0 ||
strcmp(np_req->proxy_type, "http") == 0 ||
strcmp(np_req->proxy_type, "https") == 0 ||
strcmp(np_req->proxy_type, "socks5") == 0) {
if (np_req->group) {
JSON_MARSHAL_TYPE(j_np_req, "group", string, np_req->group);
}
if (np_req->group_key) {
JSON_MARSHAL_TYPE(j_np_req, "group_key", string, np_req->group_key);
}
}
if (is_ftp_proxy(np_req)) {
JSON_MARSHAL_TYPE(j_np_req, "remote_data_port", int, np_req->remote_data_port);
}

12
pkg/debian/rules Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/make -f
export DEB_LDFLAGS_MAINT_APPEND=-Wl,-O1
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
# get the various DEB_BUILD/DEB_HOST variables
include /usr/share/dpkg/architecture.mk
override_dh_install:
dh_install --autodest
%:
dh $@

View File

@@ -1,7 +1,7 @@
#ifndef _VERSION_H_
#define _VERSION_H_
#define VERSION "2.1.606"
#define VERSION "2.5.633"
#define PROTOCOL_VERESION "0.43.0"
#define CLIENT_V 1