Compare commits
13 Commits
v0.0.28-mu
...
v0.0.38-mu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
278fc69789 | ||
|
|
99262777fc | ||
|
|
b0f60caab2 | ||
|
|
efd5e0bb36 | ||
|
|
ade4617d53 | ||
|
|
64a5fd8227 | ||
|
|
eba968797c | ||
|
|
d60f28a7fe | ||
|
|
32069eb104 | ||
|
|
a6adcefc25 | ||
|
|
743b0ee0da | ||
|
|
ba06a6fc10 | ||
|
|
80d4c2814f |
@@ -1,4 +1,4 @@
|
||||
# Glorytun
|
||||
# π₁(Glorytun)=ℤ²
|
||||
|
||||
Small, Simple and Stupid VPN over [mud](https://github.com/angt/mud).
|
||||
|
||||
|
||||
2
mud
2
mud
Submodule mud updated: 1b58401095...04c8495fe6
26
src/main.c
26
src/main.c
@@ -242,6 +242,8 @@ int main (int argc, char **argv)
|
||||
|
||||
gt.timeout = 5000;
|
||||
|
||||
long time_tolerance = 0;
|
||||
|
||||
struct option opts[] = {
|
||||
{ "host", &host, option_str },
|
||||
{ "port", &port, option_str },
|
||||
@@ -252,6 +254,7 @@ int main (int argc, char **argv)
|
||||
{ "multiqueue", NULL, option_option },
|
||||
{ "statefile", &statefile, option_str },
|
||||
{ "timeout", >.timeout, option_long },
|
||||
{ "time-tolerance", &time_tolerance, option_long },
|
||||
{ "version", NULL, option_option },
|
||||
{ NULL },
|
||||
};
|
||||
@@ -279,11 +282,6 @@ int main (int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!crypto_aead_aes256gcm_is_available()) {
|
||||
gt_na("AES-256-GCM");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (state_init(statefile))
|
||||
return 1;
|
||||
|
||||
@@ -310,6 +308,11 @@ int main (int argc, char **argv)
|
||||
|
||||
mud_set_key(mud, gt.key, sizeof(gt.key));
|
||||
|
||||
mud_set_send_timeout_msec(mud, gt.timeout);
|
||||
|
||||
if (time_tolerance > 0)
|
||||
mud_set_time_tolerance_sec(mud, time_tolerance);
|
||||
|
||||
if (bind_list) {
|
||||
char tmp[1024];
|
||||
char *name = &tmp[0];
|
||||
@@ -355,9 +358,12 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
struct timeval timeout = {
|
||||
.tv_usec = 1000,
|
||||
.tv_usec = 100000,
|
||||
};
|
||||
|
||||
if (mud_can_push(mud))
|
||||
timeout.tv_usec = 1000;
|
||||
|
||||
if _0_(select(mud_fd+1, &rfds, NULL, NULL, &timeout)==-1) {
|
||||
if (errno==EINTR)
|
||||
continue;
|
||||
@@ -367,13 +373,15 @@ int main (int argc, char **argv)
|
||||
|
||||
if (mud_is_up(mud)) {
|
||||
if (!started) {
|
||||
state("STARTED", NULL);
|
||||
state("STARTED", tun_name);
|
||||
started = 1;
|
||||
}
|
||||
} else if (started) {
|
||||
state("STOPPED", NULL);
|
||||
} else {
|
||||
if (started) {
|
||||
state("STOPPED", tun_name);
|
||||
started = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (FD_ISSET(tun_fd, &rfds)) {
|
||||
while (1) {
|
||||
|
||||
Reference in New Issue
Block a user