mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 13:27:36 +08:00
35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
--- a/src/jconf.c
|
|
+++ b/src/jconf.c
|
|
@@ -259,6 +259,19 @@ read_jconf(const char *file)
|
|
conf.server_legacy.obfs = to_string(value);
|
|
} else if (strcmp(name, "obfs_param") == 0) { // SSR
|
|
conf.server_legacy.obfs_param = to_string(value);
|
|
+ } else if (strcmp(name, "mode") == 0) {
|
|
+ char *mode_str = to_string(value);
|
|
+
|
|
+ if (strcmp(mode_str, "tcp_only") == 0)
|
|
+ conf.mode = TCP_ONLY;
|
|
+ else if (strcmp(mode_str, "tcp_and_udp") == 0)
|
|
+ conf.mode = TCP_AND_UDP;
|
|
+ else if (strcmp(mode_str, "udp_only") == 0)
|
|
+ conf.mode = UDP_ONLY;
|
|
+ else
|
|
+ LOGI("ignore unknown mode: %s, use tcp_only as fallback",
|
|
+ mode_str);
|
|
+ ss_free(mode_str);
|
|
} else {
|
|
match = 0;
|
|
}
|
|
--- a/src/redir.c
|
|
+++ b/src/redir.c
|
|
@@ -1252,6 +1252,9 @@ main(int argc, char **argv)
|
|
if (user == NULL) {
|
|
user = conf->user;
|
|
}
|
|
+ if (mode == TCP_ONLY) {
|
|
+ mode = conf->mode;
|
|
+ }
|
|
if (mtu == 0) {
|
|
mtu = conf->mtu;
|
|
}
|