Compare commits
1 Commits
v0.0.56-mu
...
v0.0.27
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
030087cb27 |
15
.build.sh
15
.build.sh
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
export CC="gcc -static"
|
|
||||||
|
|
||||||
git clone https://github.com/jedisct1/libsodium --depth=1 --branch stable
|
|
||||||
cd libsodium || exit 1
|
|
||||||
./autogen.sh && ./configure --enable-minimal --disable-shared --prefix=/usr && make install
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
./autogen.sh && ./configure && make
|
|
||||||
[ -x glorytun ] || exit 1
|
|
||||||
|
|
||||||
mkdir -p deploy
|
|
||||||
strip -s glorytun
|
|
||||||
mv glorytun deploy/glorytun-$(cat VERSION)-$(uname -m).bin
|
|
||||||
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
|||||||
[submodule "mud"]
|
|
||||||
path = mud
|
|
||||||
url = https://github.com/angt/mud.git
|
|
||||||
@@ -20,11 +20,6 @@ glorytun_SOURCES = \
|
|||||||
src/state.c \
|
src/state.c \
|
||||||
src/state.h
|
src/state.h
|
||||||
|
|
||||||
glorytun_CFLAGS += -I$(srcdir)/mud
|
|
||||||
glorytun_SOURCES += \
|
|
||||||
mud/mud.h \
|
|
||||||
mud/mud.c
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
LICENSE \
|
LICENSE \
|
||||||
README.md \
|
README.md \
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# π₁(Glorytun)=ℤ²
|
# Glorytun
|
||||||
|
|
||||||
Small, Simple and Stupid VPN over [mud](https://github.com/angt/mud).
|
Small, Simple and Stupid TCP VPN.
|
||||||
|
|
||||||
#### Work In Progress
|
#### Work In Progress
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ and needs an AES-NI capable CPU.
|
|||||||
|
|
||||||
To build and install the latest version:
|
To build and install the latest version:
|
||||||
|
|
||||||
$ git clone https://github.com/angt/glorytun --recursive --branch mud
|
$ git clone https://github.com/angt/glorytun
|
||||||
$ cd glorytun
|
$ cd glorytun
|
||||||
$ ./autogen.sh
|
$ ./autogen.sh
|
||||||
$ ./configure
|
$ ./configure
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ AM_SILENT_RULES([yes])
|
|||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
AC_PROG_CC_C99
|
AC_PROG_CC_C99
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
AC_SEARCH_LIBS([getaddrinfo], [resolv nsl])
|
||||||
AC_SEARCH_LIBS([socket], [socket])
|
AC_SEARCH_LIBS([socket], [socket])
|
||||||
AC_CHECK_LIB([rt], [clock_gettime])
|
|
||||||
AC_CHECK_FUNCS([clock_gettime])
|
|
||||||
PKG_CHECK_MODULES([libsodium], [libsodium >= 1.0.4])
|
PKG_CHECK_MODULES([libsodium], [libsodium >= 1.0.4])
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
1
mud
1
mud
Submodule mud deleted from 67f1f6abc2
1372
src/main.c
1372
src/main.c
File diff suppressed because it is too large
Load Diff
41
src/state.c
41
src/state.c
@@ -7,14 +7,16 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
int state_create (const char *filename)
|
static int state_fd = -1;
|
||||||
|
|
||||||
|
int state_init (const char *filename)
|
||||||
{
|
{
|
||||||
if (str_empty(filename))
|
if (str_empty(filename))
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
int fd = open(filename, O_WRONLY);
|
state_fd = open(filename, O_WRONLY);
|
||||||
|
|
||||||
if (fd==-1) {
|
if (state_fd==-1) {
|
||||||
if (errno!=EINTR)
|
if (errno!=EINTR)
|
||||||
perror("open");
|
perror("open");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -22,41 +24,38 @@ int state_create (const char *filename)
|
|||||||
|
|
||||||
struct stat st = {0};
|
struct stat st = {0};
|
||||||
|
|
||||||
if (fstat(fd, &st)==-1) {
|
if (fstat(state_fd, &st)==-1) {
|
||||||
perror("fstat");
|
perror("fstat");
|
||||||
close(fd);
|
close(state_fd);
|
||||||
|
state_fd = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!S_ISFIFO(st.st_mode)) {
|
if (!S_ISFIFO(st.st_mode)) {
|
||||||
gt_log("`%s' is not a fifo\n", filename);
|
gt_log("`%s' is not a fifo\n", filename);
|
||||||
close(fd);
|
close(state_fd);
|
||||||
|
state_fd = -1;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fd;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void state_send (int fd, const char *state, const char *info)
|
void state (const char *state, const char *info)
|
||||||
{
|
{
|
||||||
if (str_empty(state))
|
if (str_empty(state))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fd==-1) {
|
|
||||||
gt_print("%s %s\n", state, info);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *strs[] = { state, " ", info, "\n" };
|
const char *strs[] = { state, " ", info, "\n" };
|
||||||
char *str = str_cat(strs, COUNT(strs));
|
char *str = str_cat(strs, COUNT(strs));
|
||||||
|
|
||||||
if (!str) {
|
if (!str)
|
||||||
perror("str_cat");
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (state_fd==-1) {
|
||||||
|
gt_print("%s", str);
|
||||||
|
} else {
|
||||||
|
if (write(state_fd, str, str_len(str))==-1 && errno!=EINTR)
|
||||||
|
perror("write");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write(fd, str, str_len(str))==-1 && errno!=EINTR)
|
|
||||||
perror("write");
|
|
||||||
|
|
||||||
free(str);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
int state_create (const char *);
|
int state_init (const char *);
|
||||||
void state_send (int, const char *, const char *);
|
void state (const char *, const char *);
|
||||||
|
|||||||
Reference in New Issue
Block a user