mirror of
https://github.com/Waujito/youtubeUnblock.git
synced 2025-12-31 21:58:51 +03:00
Daemonize youtubeUnblock with flags, without any overhead
This commit is contained in:
@@ -241,6 +241,10 @@ Available flags:
|
|||||||
|
|
||||||
- `--threads=<threads number>` Specifies the amount of threads you want to be running for your program. This defaults to **1** and shouldn't be edited for normal use. But if you really want multiple queue instances of youtubeUnblock, note that you should change --queue-num to --queue balance. For example, with 4 threads, use `--queue-balance 537:540` on iptables and `queue num 537-540` on nftables.
|
- `--threads=<threads number>` Specifies the amount of threads you want to be running for your program. This defaults to **1** and shouldn't be edited for normal use. But if you really want multiple queue instances of youtubeUnblock, note that you should change --queue-num to --queue balance. For example, with 4 threads, use `--queue-balance 537:540` on iptables and `queue num 537-540` on nftables.
|
||||||
|
|
||||||
|
- `--daemonize` Daemonizes the youtubeUnblock (forks and detaches it from the shell). Terminate the program with `killall youtubeUnblock`.
|
||||||
|
|
||||||
|
- `--noclose` Usable only with `--daemonize`. Will not redirect io streams to /dev/null.
|
||||||
|
|
||||||
- `--packet-mark=<mark>` Use this option if youtubeUnblock conflicts with other systems rely on packet mark. Note that you may want to change accept rule for iptables to follow the mark.
|
- `--packet-mark=<mark>` Use this option if youtubeUnblock conflicts with other systems rely on packet mark. Note that you may want to change accept rule for iptables to follow the mark.
|
||||||
|
|
||||||
- `--fbegin` and `--fend` flags: youtubeUnblock supports multiple sets of strategies for specific filters. You may want to initiate a new set after the default one, like: `--sni-domains=googlevideo.com --faking-strategy=md5sum --fbegin --sni-domains=youtube.com --faking-strategy=tcp_check --fend --fbegin --sni-domains=l.google.com --faking-strategy=pastseq --fend`. Note, that the priority of these sets goes backwards: last is first, default (one that does not start with --fbegin) is last. If you start the new section, the default settings are implemented just like youtubeUnblock without any parameters. Note that the config above is just an example and won't work for you.
|
- `--fbegin` and `--fend` flags: youtubeUnblock supports multiple sets of strategies for specific filters. You may want to initiate a new set after the default one, like: `--sni-domains=googlevideo.com --faking-strategy=md5sum --fbegin --sni-domains=youtube.com --faking-strategy=tcp_check --fend --fbegin --sni-domains=l.google.com --faking-strategy=pastseq --fend`. Note, that the priority of these sets goes backwards: last is first, default (one that does not start with --fbegin) is last. If you start the new section, the default settings are implemented just like youtubeUnblock without any parameters. Note that the config above is just an example and won't work for you.
|
||||||
|
|||||||
19
args.c
19
args.c
@@ -21,7 +21,10 @@ struct config_t config = {
|
|||||||
.use_gso = true,
|
.use_gso = true,
|
||||||
|
|
||||||
.default_config = default_section_config,
|
.default_config = default_section_config,
|
||||||
.custom_configs_len = 0
|
.custom_configs_len = 0,
|
||||||
|
|
||||||
|
.daemonize = 0,
|
||||||
|
.noclose = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#define OPT_SNI_DOMAINS 1
|
#define OPT_SNI_DOMAINS 1
|
||||||
@@ -34,6 +37,8 @@ struct config_t config = {
|
|||||||
#define OPT_FAKE_CUSTOM_PAYLOAD 28
|
#define OPT_FAKE_CUSTOM_PAYLOAD 28
|
||||||
#define OPT_START_SECTION 29
|
#define OPT_START_SECTION 29
|
||||||
#define OPT_END_SECTION 30
|
#define OPT_END_SECTION 30
|
||||||
|
#define OPT_DAEMONIZE 31
|
||||||
|
#define OPT_NOCLOSE 32
|
||||||
#define OPT_FRAG 4
|
#define OPT_FRAG 4
|
||||||
#define OPT_FRAG_SNI_REVERSE 12
|
#define OPT_FRAG_SNI_REVERSE 12
|
||||||
#define OPT_FRAG_SNI_FAKED 13
|
#define OPT_FRAG_SNI_FAKED 13
|
||||||
@@ -54,7 +59,7 @@ struct config_t config = {
|
|||||||
#define OPT_NO_GSO 8
|
#define OPT_NO_GSO 8
|
||||||
#define OPT_QUEUE_NUM 9
|
#define OPT_QUEUE_NUM 9
|
||||||
|
|
||||||
#define OPT_MAX OPT_END_SECTION
|
#define OPT_MAX OPT_NOCLOSE
|
||||||
|
|
||||||
static struct option long_opt[] = {
|
static struct option long_opt[] = {
|
||||||
{"help", 0, 0, 'h'},
|
{"help", 0, 0, 'h'},
|
||||||
@@ -84,6 +89,8 @@ static struct option long_opt[] = {
|
|||||||
{"trace", 0, 0, OPT_TRACE},
|
{"trace", 0, 0, OPT_TRACE},
|
||||||
{"no-gso", 0, 0, OPT_NO_GSO},
|
{"no-gso", 0, 0, OPT_NO_GSO},
|
||||||
{"no-ipv6", 0, 0, OPT_NO_IPV6},
|
{"no-ipv6", 0, 0, OPT_NO_IPV6},
|
||||||
|
{"daemonize", 0, 0, OPT_DAEMONIZE},
|
||||||
|
{"noclose", 0, 0, OPT_NOCLOSE},
|
||||||
{"queue-num", 1, 0, OPT_QUEUE_NUM},
|
{"queue-num", 1, 0, OPT_QUEUE_NUM},
|
||||||
{"packet-mark", 1, 0, OPT_PACKET_MARK},
|
{"packet-mark", 1, 0, OPT_PACKET_MARK},
|
||||||
{"fbegin", 0, 0, OPT_START_SECTION},
|
{"fbegin", 0, 0, OPT_START_SECTION},
|
||||||
@@ -152,6 +159,8 @@ void print_usage(const char *argv0) {
|
|||||||
printf("\t--trace\n");
|
printf("\t--trace\n");
|
||||||
printf("\t--no-gso\n");
|
printf("\t--no-gso\n");
|
||||||
printf("\t--no-ipv6\n");
|
printf("\t--no-ipv6\n");
|
||||||
|
printf("\t--daemonize\n");
|
||||||
|
printf("\t--noclose\n");
|
||||||
printf("\t--fbegin\n");
|
printf("\t--fbegin\n");
|
||||||
printf("\t--fend\n");
|
printf("\t--fend\n");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@@ -202,6 +211,12 @@ int parse_args(int argc, char *argv[]) {
|
|||||||
|
|
||||||
config.use_ipv6 = 0;
|
config.use_ipv6 = 0;
|
||||||
break;
|
break;
|
||||||
|
case OPT_DAEMONIZE:
|
||||||
|
config.daemonize = 1;
|
||||||
|
break;
|
||||||
|
case OPT_NOCLOSE:
|
||||||
|
config.noclose = 1;
|
||||||
|
break;
|
||||||
case OPT_THREADS:
|
case OPT_THREADS:
|
||||||
if (section_iter != SECT_ITER_DEFAULT)
|
if (section_iter != SECT_ITER_DEFAULT)
|
||||||
goto invalid_opt;
|
goto invalid_opt;
|
||||||
|
|||||||
4
config.h
4
config.h
@@ -64,7 +64,6 @@ struct section_config_t {
|
|||||||
#define SNI_DETECTION_BRUTE 1
|
#define SNI_DETECTION_BRUTE 1
|
||||||
int sni_detection;
|
int sni_detection;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_CONFIGLIST_LEN 64
|
#define MAX_CONFIGLIST_LEN 64
|
||||||
@@ -75,6 +74,9 @@ struct config_t {
|
|||||||
int use_gso;
|
int use_gso;
|
||||||
int use_ipv6;
|
int use_ipv6;
|
||||||
unsigned int mark;
|
unsigned int mark;
|
||||||
|
int daemonize;
|
||||||
|
// Same as daemon() noclose
|
||||||
|
int noclose;
|
||||||
|
|
||||||
#define VERBOSE_INFO 0
|
#define VERBOSE_INFO 0
|
||||||
#define VERBOSE_DEBUG 1
|
#define VERBOSE_DEBUG 1
|
||||||
|
|||||||
@@ -625,6 +625,7 @@ int main(int argc, char *argv[]) {
|
|||||||
print_version();
|
print_version();
|
||||||
print_welcome();
|
print_welcome();
|
||||||
|
|
||||||
|
|
||||||
if (open_raw_socket() < 0) {
|
if (open_raw_socket() < 0) {
|
||||||
perror("Unable to open raw socket");
|
perror("Unable to open raw socket");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@@ -638,6 +639,10 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.daemonize) {
|
||||||
|
daemon(0, config.noclose);
|
||||||
|
}
|
||||||
|
|
||||||
struct queue_res *qres = &defqres;
|
struct queue_res *qres = &defqres;
|
||||||
|
|
||||||
if (config.threads == 1) {
|
if (config.threads == 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user