mirror of https://github.com/oxen-io/lokinet
Merge remote-tracking branch 'upstream/dev' into multithreaded-cryptography
commit
32ed821763
@ -0,0 +1,40 @@
|
||||
if(NOT STATIC_LINK_RUNTIME)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# not supported on Solaris - system libraries are not available as archives
|
||||
# LTO is supported only for native builds
|
||||
if(SOLARIS)
|
||||
link_libraries( -static-libstdc++ -static-libgcc )
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
add_compile_options(-static -flto)
|
||||
else()
|
||||
add_compile_options(-static)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if(APPLE)
|
||||
link_libraries( -flto)
|
||||
else()
|
||||
link_libraries( -static -static-libstdc++ -pthread -flto )
|
||||
endif()
|
||||
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
# this is messing with release builds
|
||||
add_compile_options(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0)
|
||||
set(CMAKE_AR "gcc-ar")
|
||||
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_C_ARCHIVE_FINISH "true")
|
||||
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||
set(CMAKE_CXX_ARCHIVE_FINISH "true")
|
||||
link_libraries( -flto -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive )
|
||||
else()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif()
|
@ -1,4 +0,0 @@
|
||||
*.o
|
||||
mbedtls/
|
||||
*.a
|
||||
*.exe
|
@ -1,17 +0,0 @@
|
||||
Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
@ -1,71 +0,0 @@
|
||||
# makefile for windows bootstrap
|
||||
# requires mbedtls to be installed somewhere, for both native and windows targets
|
||||
# requires wget to be installed for ca bundle download
|
||||
|
||||
# to build:
|
||||
# $ [g]make prepare;[g]make lokinet-bootstrap
|
||||
|
||||
# set this beforehand if you use clang
|
||||
CC ?= i686-w64-mingw32-gcc
|
||||
NATIVE_CC ?= cc
|
||||
|
||||
# set these for the native system
|
||||
INCLUDE ?=
|
||||
LIBS ?=
|
||||
|
||||
# set these for 32-bit windows if cross-compiling
|
||||
WINNT_INCLUDE ?=
|
||||
WINNT_LIBS ?=
|
||||
|
||||
ifdef LTO
|
||||
LTO_FLAG = -flto
|
||||
LTO_LDFLAG = -flto -march=nocona -mfpmath=sse -Ofast
|
||||
endif
|
||||
|
||||
.PHONY: download prepare all default
|
||||
|
||||
# windows target only
|
||||
.c.o:
|
||||
$(CC) $(WINNT_INCLUDE) -Iinclude $(LTO_FLAG) -Ofast -march=nocona -mfpmath=sse $< -c
|
||||
|
||||
zpipe: zpipe.c miniz.c
|
||||
$(NATIVE_CC) $(INCLUDE) -Iinclude $(LIBS) $^ -s -static -o $@
|
||||
|
||||
base64enc: base64enc.c
|
||||
$(NATIVE_CC) $(INCLUDE) -Iinclude $(LIBS) $^ -s -static -o $@ -lmbedx509 -lmbedtls -lmbedcrypto
|
||||
|
||||
download:
|
||||
wget -O ./cacert.pem https://curl.haxx.se/ca/cacert.pem
|
||||
|
||||
# I *think* this only work with GNU sed...
|
||||
prepare: zpipe base64enc download
|
||||
./zpipe < cacert.pem > data.enc
|
||||
./base64enc < data.enc > out.bin
|
||||
sed -ie "s/.\{76\}/&\n/g" out.bin
|
||||
sed -i 's/.*/\"&\"/g' out.bin
|
||||
sed -i '61,2268d' bootstrap.c
|
||||
echo ';' >> out.bin
|
||||
sed -i '60r out.bin' bootstrap.c
|
||||
|
||||
prepare-testnet: zpipe base64enc download
|
||||
./zpipe < cacert.pem > data.enc
|
||||
./base64enc < data.enc > out.bin
|
||||
sed -ie "s/.\{76\}/&\n/g" out.bin
|
||||
sed -i 's/.*/\"&\"/g' out.bin
|
||||
sed -i '58,2144d' testnet.c
|
||||
echo ';' >> out.bin
|
||||
sed -i '57r out.bin' testnet.c
|
||||
|
||||
lokinet-bootstrap: bootstrap.o miniz.o
|
||||
$(CC) $(WINNT_LIBS) -s -static $^ -o $@.exe $(LTO_LDFLAG) -lmbedx509 -lmbedtls -lmbedcrypto -lws2_32
|
||||
|
||||
lokinet-bootstrap-testnet: testnet.o miniz.o
|
||||
$(CC) $(WINNT_LIBS) -s -static $^ -o $@.exe $(LTO_LDFLAG) -lmbedx509 -lmbedtls -lmbedcrypto -lws2_32
|
||||
clean:
|
||||
-@rm lokinet*.exe
|
||||
-@rm base64enc
|
||||
-@rm zpipe
|
||||
-@rm cacert.pem
|
||||
-@rm data.enc
|
||||
-@rm out.*
|
||||
-@rm *.o
|
@ -1,35 +0,0 @@
|
||||
# LokiNET bootstrap for Windows
|
||||
|
||||
This is a tiny executable that does the same thing as the `lokinet-bootstrap` shell script for Linux, specifically for the purpose of bypassing broken or outdated versions of Schannel that do not support current versions of TLS.
|
||||
|
||||
# Building
|
||||
|
||||
## requirements
|
||||
|
||||
- mbedtls 2.13.0 or later, for both host and windows
|
||||
- wget for host (to download Netscape CA bundle from cURL website)
|
||||
- Also included is a patch that can be applied to the mbedtls source to enable features like AES-NI in protected mode, plus some networking fixes for win32
|
||||
|
||||
native build:
|
||||
|
||||
$ export INCLUDE=/mingw32/include LIBS=/mingw32/lib # or a different path
|
||||
$ export CC=cc # change these if you use clang
|
||||
$ export NATIVE_CC=$CC
|
||||
$ export WINNT_INCLUDE=$INCLUDE WINNT_LIBS=$LIBS
|
||||
$ make prepare;make lokinet-bootstrap
|
||||
|
||||
cross-compile build (If you have *GNU* sed, you can also update the certificate trust store with `make prepare`):
|
||||
|
||||
$ export INCLUDE=/usr/local/include LIBS=/usr/local/lib # or a different path
|
||||
$ export CC=i686-w64-mingw32-gcc # change these if you use clang, make sure these are in your system $PATH!
|
||||
$ export NATIVE_CC=cc
|
||||
$ export WINNT_INCLUDE=/path/to/win32/headers WINNT_LIBS=/path/to/win32/libs
|
||||
$ make lokinet-bootstrap
|
||||
|
||||
# Usage
|
||||
|
||||
C:\>lokinet-bootstrap [uri] [local download path]
|
||||
|
||||
this is also included in the lokinet installer package.
|
||||
|
||||
-rick
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* this is a tiny build-time utility that base64 encodes up to 512K
|
||||
* of text/binary data from stdin. (On UNIX, we'd use GNU's [g]base64(1)
|
||||
* to encode the stream. Can't guarantee that a windows user will have cygwin
|
||||
* installed, so we bootstrap these at build-time instead.)
|
||||
*
|
||||
* here, it is used to encode the compressed zlib-stream of the
|
||||
* Netscape root certificate trust store on behalf of the lokinet
|
||||
* for NT bootstrap stubs.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "sysconf.h"
|
||||
#ifdef HAVE_SETMODE
|
||||
# define SET_BINARY_MODE(handle) setmode(handle, O_BINARY)
|
||||
#else
|
||||
# define SET_BINARY_MODE(handle) ((void)0)
|
||||
#endif
|
||||
#include <mbedtls/base64.h>
|
||||
#include <mbedtls/error.h>
|
||||
|
||||
main(argc, argv)
|
||||
char** argv;
|
||||
{
|
||||
int size,r, inl;
|
||||
unsigned char in[524288];
|
||||
unsigned char out[1048576];
|
||||
unsigned char err[1024];
|
||||
memset(&in, 0, 524288);
|
||||
memset(&out, 0, 1048576);
|
||||
SET_BINARY_MODE(0);
|
||||
/* Read up to 512K of data from stdin */
|
||||
inl = fread(in, 1, 524288, stdin);
|
||||
r = mbedtls_base64_encode(out, 1048576, &size, in, inl);
|
||||
if (r)
|
||||
{
|
||||
mbedtls_strerror(r, err, 1024);
|
||||
printf("error: %s\n", err);
|
||||
return r;
|
||||
}
|
||||
fprintf(stdout, "%s", out);
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,95 +0,0 @@
|
||||
/**
|
||||
* sysconf.h -- system-dependent macros and settings
|
||||
*
|
||||
* Copyright (C) 2002-2004 Cosmin Truta.
|
||||
* Permission to use and distribute freely.
|
||||
* No warranty.
|
||||
**/
|
||||
|
||||
#ifndef SYSCONF_H
|
||||
#define SYSCONF_H
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Platform identifiers */
|
||||
|
||||
|
||||
/* Detect Unix. */
|
||||
#if defined(unix) || defined(__linux__) || defined(BSD) || defined(__CYGWIN__)
|
||||
/* Add more systems here. */
|
||||
# ifndef UNIX
|
||||
# define UNIX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Detect MS-DOS. */
|
||||
#if defined(__MSDOS__)
|
||||
# ifndef MSDOS
|
||||
# define MSDOS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* TO DO: Detect OS/2. */
|
||||
|
||||
/* Detect Windows. */
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif
|
||||
#endif
|
||||
#if defined(_WIN64)
|
||||
# ifndef WIN64
|
||||
# define WIN64
|
||||
# endif
|
||||
#endif
|
||||
#if defined(_WINDOWS) || defined(WIN32) || defined(WIN64)
|
||||
# ifndef WINDOWS
|
||||
# define WINDOWS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Enable POSIX-friendly symbols on Microsoft (Visual) C. */
|
||||
#ifdef _MSC_VER
|
||||
# define _POSIX_
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Library access */
|
||||
|
||||
|
||||
#if defined(UNIX)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_VERSION)
|
||||
# include <fcntl.h>
|
||||
# ifndef HAVE_ISATTY
|
||||
# define HAVE_ISATTY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MSDOS) || defined(OS2) || defined(WINDOWS) || defined(__CYGWIN__)
|
||||
/* Add more systems here, e.g. MacOS 9 and earlier. */
|
||||
# include <fcntl.h>
|
||||
# include <io.h>
|
||||
# ifndef HAVE_ISATTY
|
||||
# define HAVE_ISATTY
|
||||
# endif
|
||||
# ifndef HAVE_SETMODE
|
||||
# define HAVE_SETMODE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Standard I/O handles. */
|
||||
#define STDIN 0
|
||||
#define STDOUT 1
|
||||
#define STDERR 2
|
||||
|
||||
/* Provide a placeholder for O_BINARY, if it doesn't exist. */
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* SYSCONF_H */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,209 +0,0 @@
|
||||
/* zpipe.c: example of proper use of zlib's inflate() and deflate()
|
||||
Not copyrighted -- provided to the public domain
|
||||
Version 1.4 11 December 2005 Mark Adler */
|
||||
|
||||
/* Version history:
|
||||
1.0 30 Oct 2004 First version
|
||||
1.1 8 Nov 2004 Add void casting for unused return values
|
||||
Use switch statement for inflate() return values
|
||||
1.2 9 Nov 2004 Add assertions to document zlib guarantees
|
||||
1.3 6 Apr 2005 Remove incorrect assertion in inf()
|
||||
1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions
|
||||
Avoid some compiler warnings for input and output buffers
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "miniz.h"
|
||||
|
||||
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
|
||||
# include <fcntl.h>
|
||||
# include <io.h>
|
||||
# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
|
||||
#else
|
||||
# define SET_BINARY_MODE(file)
|
||||
#endif
|
||||
|
||||
#define CHUNK 16384
|
||||
|
||||
/* Compress from file source to file dest until EOF on source.
|
||||
def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
|
||||
allocated for processing, Z_STREAM_ERROR if an invalid compression
|
||||
level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
|
||||
version of the library linked do not match, or Z_ERRNO if there is
|
||||
an error reading or writing the files. */
|
||||
int def(FILE *source, FILE *dest, int level)
|
||||
{
|
||||
int ret, flush;
|
||||
unsigned have;
|
||||
z_stream strm;
|
||||
unsigned char in[CHUNK];unsigned char out[CHUNK];
|
||||
|
||||
/* allocate deflate state */
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
ret = deflateInit(&strm, level);
|
||||
if (ret != Z_OK)
|
||||
return ret;
|
||||
|
||||
/* compress until end of file */
|
||||
do {
|
||||
strm.avail_in = fread(in, 1, CHUNK, source);
|
||||
if (ferror(source)) {
|
||||
(void)deflateEnd(&strm);
|
||||
return Z_ERRNO;
|
||||
}
|
||||
flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
|
||||
strm.next_in = in;
|
||||
|
||||
/* run deflate() on input until output buffer not full, finish
|
||||
compression if all of source has been read in */
|
||||
do {
|
||||
strm.avail_out = CHUNK;
|
||||
strm.next_out = out;
|
||||
ret = deflate(&strm, flush); /* no bad return value */
|
||||
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
||||
have = CHUNK - strm.avail_out;
|
||||
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
|
||||
(void)deflateEnd(&strm);
|
||||
return Z_ERRNO;
|
||||
}
|
||||
} while (strm.avail_out == 0);
|
||||
assert(strm.avail_in == 0); /* all input will be used */
|
||||
|
||||
/* done when last data in file processed */
|
||||
} while (flush != Z_FINISH);
|
||||
assert(ret == Z_STREAM_END); /* stream will be complete */
|
||||
|
||||
/* clean up and return */
|
||||
(void)deflateEnd(&strm);
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
/* Decompress from file source to file dest until stream ends or EOF.
|
||||
inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
|
||||
allocated for processing, Z_DATA_ERROR if the deflate data is
|
||||
invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
|
||||
the version of the library linked do not match, or Z_ERRNO if there
|
||||
is an error reading or writing the files. */
|
||||
int inf(FILE *source, FILE *dest)
|
||||
{
|
||||
int ret;
|
||||
unsigned have;
|
||||
z_stream strm;
|
||||
unsigned char in[CHUNK];
|
||||
unsigned char out[CHUNK];
|
||||
|
||||
/* allocate inflate state */
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = 0;
|
||||
strm.next_in = Z_NULL;
|
||||
ret = inflateInit(&strm);
|
||||
if (ret != Z_OK)
|
||||
return ret;
|
||||
|
||||
/* decompress until deflate stream ends or end of file */
|
||||
do {
|
||||
strm.avail_in = fread(in, 1, CHUNK, source);
|
||||
if (ferror(source)) {
|
||||
(void)inflateEnd(&strm);
|
||||
return Z_ERRNO;
|
||||
}
|
||||
if (strm.avail_in == 0)
|
||||
break;
|
||||
strm.next_in = in;
|
||||
|
||||
/* run inflate() on input until output buffer not full */
|
||||
do {
|
||||
strm.avail_out = CHUNK;
|
||||
strm.next_out = out;
|
||||
ret = inflate(&strm, Z_NO_FLUSH);
|
||||
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
||||
switch (ret) {
|
||||
case Z_NEED_DICT:
|
||||
ret = Z_DATA_ERROR; /* and fall through */
|
||||
case Z_DATA_ERROR:
|
||||
case Z_MEM_ERROR:
|
||||
(void)inflateEnd(&strm);
|
||||
return ret;
|
||||
}
|
||||
have = CHUNK - strm.avail_out;
|
||||
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
|
||||
(void)inflateEnd(&strm);
|
||||
return Z_ERRNO;
|
||||
}
|
||||
} while (strm.avail_out == 0);
|
||||
|
||||
/* done when inflate() says it's done */
|
||||
} while (ret != Z_STREAM_END);
|
||||
|
||||
/* clean up and return */
|
||||
(void)inflateEnd(&strm);
|
||||
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
|
||||
}
|
||||
|
||||
/* report a zlib or i/o error */
|
||||
void zerr(int ret)
|
||||
{
|
||||
fputs("zpipe: ", stderr);
|
||||
switch (ret) {
|
||||
case Z_ERRNO:
|
||||
if (ferror(stdin))
|
||||
fputs("error reading stdin\n", stderr);
|
||||
if (ferror(stdout))
|
||||
fputs("error writing stdout\n", stderr);
|
||||
break;
|
||||
case Z_STREAM_ERROR:
|
||||
fputs("invalid compression level\n", stderr);
|
||||
break;
|
||||
case Z_DATA_ERROR:
|
||||
fputs("invalid or incomplete deflate data\n", stderr);
|
||||
break;
|
||||
case Z_MEM_ERROR:
|
||||
fputs("out of memory\n", stderr);
|
||||
break;
|
||||
case Z_VERSION_ERROR:
|
||||
fputs("zlib version mismatch!\n", stderr);
|
||||
}
|
||||
}
|
||||
|
||||
/* compress or decompress from stdin to stdout */
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* avoid end-of-line conversions */
|
||||
SET_BINARY_MODE(stdin);
|
||||
SET_BINARY_MODE(stdout);
|
||||
|
||||
/* do compression if no arguments */
|
||||
/* Warning: Not compatible with plain libz, dial it back down to
|
||||
* 9 if this is required, uber-level is 10
|
||||
* since we have everything crammed in miniz, we don't depend on
|
||||
* libz at all.
|
||||
*/
|
||||
if (argc == 1) {
|
||||
ret = def(stdin, stdout, MZ_UBER_COMPRESSION);
|
||||
if (ret != Z_OK)
|
||||
zerr(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* do decompression if -d specified */
|
||||
else if (argc == 2 && strcmp(argv[1], "-d") == 0) {
|
||||
ret = inf(stdin, stdout);
|
||||
if (ret != Z_OK)
|
||||
zerr(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* otherwise, report usage */
|
||||
else {
|
||||
fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
# TUN/TAP driver v9 for Windows
|
||||
|
||||
in order to set up tunnels on Windows, you will need
|
||||
to instal this driver.
|
||||
|
||||
* v9.9.2.3 is for Windows 2000/XP/2003 (NDIS 5.0-based)
|
||||
* v9.21.2 is for Windows Vista/7/8.1 and 10 (NDIS 6.0, forward-compatible with NDIS 10.0)
|
||||
|
||||
to instal, extract the corresponding version of the driver for your
|
||||
platform and run `%ARCH%/install_tap.cmd` in an elevated shell
|
||||
|
||||
to remove *ALL* virtual tunnel adapters, run `%ARCH%/del_tap.cmd` in an elevated shell. Use the
|
||||
Device Manager snap-in to remove individual adapter instances.
|
||||
|
||||
Both are signed by OpenVPN Inc, and are available for 32- and 64-bit archs.
|
||||
|
||||
-despair86
|
Binary file not shown.
Binary file not shown.
@ -1,9 +0,0 @@
|
||||
*.o
|
||||
mbedtls/
|
||||
*.a
|
||||
*.dll
|
||||
*.so
|
||||
*.exe
|
||||
cacert.pem
|
||||
*.enc
|
||||
*.bin*
|
@ -1,17 +0,0 @@
|
||||
Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
@ -1,62 +0,0 @@
|
||||
# makefile for libhttp
|
||||
# requires mbedtls to be installed somewhere, for both host and target systems
|
||||
# requires wget to be installed for ca bundle download
|
||||
|
||||
# to build:
|
||||
# make prepare; make libhttp
|
||||
|
||||
# set this beforehand if you use clang
|
||||
# make sure to preset CFLAGS if you use non-ix86 platform
|
||||
# or non-GNU-compat C compilation system
|
||||
# Uncomment these if you're on a 32-bit Linux?
|
||||
# CC = cc
|
||||
# CFLAGS = -Ofast -march=nocona -mfpmath=sse
|
||||
|
||||
# path to mbedtls headers/libs and system libs
|
||||
# if you have local copies of libs in this folder,
|
||||
# try LIBS=-L. (other stuff here)
|
||||
#
|
||||
# -lsocket -lnsl on Sun
|
||||
# -lws2_32 on windows nt
|
||||
#INCLUDE :=
|
||||
#LIBS :=
|
||||
|
||||
.PHONY: download prepare all default
|
||||
|
||||
.c.o:
|
||||
$(CC) $(INCLUDE) -fPIC -Iinclude $(CFLAGS) $< -c
|
||||
|
||||
zpipe: zpipe.c miniz.c
|
||||
$(CC) $(INCLUDE) -Iinclude $(CFLAGS) $^ -s -static -o $@
|
||||
|
||||
base64enc: base64enc.c
|
||||
$(CC) $(INCLUDE) -Iinclude $(CFLAGS) $^ -s -static -o $@ -lmbedx509 -lmbedtls -lmbedcrypto $(LIBS)
|
||||
|
||||
download:
|
||||
wget -O ./cacert.pem https://curl.haxx.se/ca/cacert.pem
|
||||
|
||||
# I *think* this only work with GNU sed...
|
||||
prepare: zpipe base64enc download
|
||||
./zpipe < cacert.pem > data.enc
|
||||
./base64enc < data.enc > out.bin
|
||||
sed -ie "s/.\{76\}/&\n/g" out.bin
|
||||
sed -i 's/.*/\"&\"/g' out.bin
|
||||
sed -i '38,2228d' cacerts.c
|
||||
echo ';' >> out.bin
|
||||
sed -i '37r out.bin' cacerts.c
|
||||
|
||||
libhttp.dll: cacerts.o miniz.o libhttp.o uri.o internal.o
|
||||
$(CC) -fPIC $(CFLAGS) $^ -s -shared -o $@ -static -lmbedx509 -lmbedtls -lmbedcrypto $(LIBS)
|
||||
|
||||
libhttp.so: cacerts.o miniz.o libhttp.o uri.o internal.o
|
||||
$(CC) $^ -fPIC $(CFLAGS) -shared -o $@ $(LIBS) -lmbedx509 -lmbedtls -lmbedcrypto $(SYS_LIBS)
|
||||
|
||||
clean:
|
||||
-@rm base64enc
|
||||
-@rm zpipe
|
||||
-@rm cacert.pem
|
||||
-@rm data.enc
|
||||
-@rm out.*
|
||||
-@rm *.o
|
||||
-@rm *.so
|
||||
-@rm *.dll
|
@ -1,26 +0,0 @@
|
||||
# liblokiweb (libhttp)
|
||||
|
||||
## Building
|
||||
|
||||
### requirements
|
||||
|
||||
- mbedtls 2.13.0 or later, for both host and target (if cross-compiling)
|
||||
- wget for host (to download Netscape root certificate store from cURL website)
|
||||
- Also included is a patch that can be applied to the mbedtls source to enable features like AES-NI in protected mode, plus some networking fixes for win32, see `../contrib/lokinet-bootstrap-winnt/mbedtls-win32.patch`
|
||||
|
||||
build:
|
||||
|
||||
$ make prepare; make libhttp.[so|dll]
|
||||
|
||||
## Useful build-time variables
|
||||
|
||||
- INCLUDE: path to mbedtls headers
|
||||
- LIBS: path to mbedtls libraries
|
||||
- SYS_LIBS: system-specific link libraries (`-lsocket -lnsl` on Sun systems, `-lws2_32` [or `-lwsock32` if IPv6 is disabled] on Windows)
|
||||
|
||||
## Usage
|
||||
|
||||
- include libhttp.h in your source
|
||||
- link against libhttp.[so|dll]
|
||||
|
||||
-rick
|
@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/* this is a tiny build-time utility that base64 encodes up to 512K
|
||||
* of text/binary data from stdin. (On UNIX, we'd use GNU's [g]base64(1)
|
||||
* to encode the stream. Can't guarantee that a windows user will have cygwin
|
||||
* installed, so we bootstrap these at build-time instead.)
|
||||
*
|
||||
* here, it is used to encode the compressed zlib-stream of the
|
||||
* Netscape root certificate trust store on behalf of the lokinet
|
||||
* for NT bootstrap stubs.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "sysconf.h"
|
||||
#ifdef HAVE_SETMODE
|
||||
# define SET_BINARY_MODE(handle) setmode(handle, O_BINARY)
|
||||
#else
|
||||
# define SET_BINARY_MODE(handle) ((void)0)
|
||||
#endif
|
||||
#include <mbedtls/base64.h>
|
||||
#include <mbedtls/error.h>
|
||||
|
||||
main(argc, argv)
|
||||
char** argv;
|
||||
{
|
||||
int size,r, inl;
|
||||
unsigned char in[524288];
|
||||
unsigned char out[1048576];
|
||||
unsigned char err[1024];
|
||||
memset(&in, 0, 524288);
|
||||
memset(&out, 0, 1048576);
|
||||
SET_BINARY_MODE(0);
|
||||
/* Read up to 512K of data from stdin */
|
||||
inl = fread(in, 1, 524288, stdin);
|
||||
r = mbedtls_base64_encode(out, 1048576, &size, in, inl);
|
||||
if (r)
|
||||
{
|
||||
mbedtls_strerror(r, err, 1024);
|
||||
printf("error: %s\n", err);
|
||||
return r;
|
||||
}
|
||||
fprintf(stdout, "%s", out);
|
||||
return 0;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,95 +0,0 @@
|
||||
/**
|
||||
* sysconf.h -- system-dependent macros and settings
|
||||
*
|
||||
* Copyright (C) 2002-2004 Cosmin Truta.
|
||||
* Permission to use and distribute freely.
|
||||
* No warranty.
|
||||
**/
|
||||
|
||||
#ifndef SYSCONF_H
|
||||
#define SYSCONF_H
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Platform identifiers */
|
||||
|
||||
|
||||
/* Detect Unix. */
|
||||
#if defined(unix) || defined(__linux__) || defined(BSD) || defined(__CYGWIN__)
|
||||
/* Add more systems here. */
|
||||
# ifndef UNIX
|
||||
# define UNIX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Detect MS-DOS. */
|
||||
#if defined(__MSDOS__)
|
||||
# ifndef MSDOS
|
||||
# define MSDOS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* TO DO: Detect OS/2. */
|
||||
|
||||
/* Detect Windows. */
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif
|
||||
#endif
|
||||
#if defined(_WIN64)
|
||||
# ifndef WIN64
|
||||
# define WIN64
|
||||
# endif
|
||||
#endif
|
||||
#if defined(_WINDOWS) || defined(WIN32) || defined(WIN64)
|
||||
# ifndef WINDOWS
|
||||
# define WINDOWS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Enable POSIX-friendly symbols on Microsoft (Visual) C. */
|
||||
#ifdef _MSC_VER
|
||||
# define _POSIX_
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Library access */
|
||||
|
||||
|
||||
#if defined(UNIX)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_POSIX_VERSION)
|
||||
# include <fcntl.h>
|
||||
# ifndef HAVE_ISATTY
|
||||
# define HAVE_ISATTY
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MSDOS) || defined(OS2) || defined(WINDOWS) || defined(__CYGWIN__)
|
||||
/* Add more systems here, e.g. MacOS 9 and earlier. */
|
||||
# include <fcntl.h>
|
||||
# include <io.h>
|
||||
# ifndef HAVE_ISATTY
|
||||
# define HAVE_ISATTY
|
||||
# endif
|
||||
# ifndef HAVE_SETMODE
|
||||
# define HAVE_SETMODE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Standard I/O handles. */
|
||||
#define STDIN 0
|
||||
#define STDOUT 1
|
||||
#define STDERR 2
|
||||
|
||||
/* Provide a placeholder for O_BINARY, if it doesn't exist. */
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* SYSCONF_H */
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*------------------------------------------------------------------------------
|
||||
* internal utility functions for libhttp
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
void *memncat(a, an, b, bn, s)
|
||||
const void *a, *b;
|
||||
size_t an, bn, s;
|
||||
{
|
||||
char *p = malloc(s * (an + bn));
|
||||
memset(p, '\0', s * (an + bn));
|
||||
memcpy(p, a, an*s);
|
||||
memcpy(p + an*s, b, bn*s);
|
||||
return p;
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*------------------------------------------------------------------------------
|
||||
* this file contains internal definitions of libhttp data structures
|
||||
* internal.h and libhttp.h are mutually exclusive as they define the same
|
||||
* data structures, library clients must use libhttp.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INTERNAL_H
|
||||
#define INTERNAL_H
|
||||
|
||||
/* PolarSSL */
|
||||
#include <mbedtls/ssl.h>
|
||||
#include <mbedtls/entropy.h>
|
||||
#include <mbedtls/ctr_drbg.h>
|
||||
#include <mbedtls/net_sockets.h>
|
||||
#include <mbedtls/error.h>
|
||||
#include <mbedtls/certs.h>
|
||||
#include <mbedtls/base64.h>
|
||||
|
||||
/* function declarations */
|
||||
void free_parsed_url();
|
||||
parse_url();
|
||||
void *memncat();
|
||||
|
||||
typedef struct url_parser_url
|
||||
{
|
||||
char *protocol;
|
||||
char *host;
|
||||
int port;
|
||||
char *path;
|
||||
char *query_string;
|
||||
int host_exists;
|
||||
char *host_ip;
|
||||
} url_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *ua; /* platform-specific user-agent string */
|
||||
char *request_uri; /* last uri requested, the response corresponds to this link */
|
||||
struct responseBody
|
||||
{
|
||||
/* the raw_data and headers point to the same place */
|
||||
/* the content is an offset into the raw_data */
|
||||
union
|
||||
{
|
||||
char* raw_data;
|
||||
char* headers;
|
||||
};
|
||||
char* content;
|
||||
};
|
||||
|
||||
/* not a public field */
|
||||
struct
|
||||
{
|
||||
mbedtls_net_context server_fd;
|
||||
mbedtls_entropy_context entropy;
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
mbedtls_ssl_context ssl;
|
||||
mbedtls_ssl_config conf;
|
||||
mbedtls_x509_crt cacert;
|
||||
bool TLSInit;
|
||||
char seed[64];
|
||||
} tls_state;
|
||||
} http_state;
|
||||
|
||||
#endif
|
@ -1,301 +0,0 @@
|
||||
/*
|
||||
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*------------------------------------------------------------------------------
|
||||
* libhttp, a really small HTTP 0-3 client library with TLS
|
||||
*
|
||||
* HTTPS only; why the hell would you serve semi-sensitive data over an
|
||||
* unencrypted channel? In fact, the polarssl integration is intended to
|
||||
* bypass limitations in the native TLS stack (no TLS 1.1+ on some older
|
||||
* platforms, lack of high-encryption ciphersuites other than ARC4 or
|
||||
* Triple-DES, etc)
|
||||
* -rick
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#endif
|
||||
|
||||
#include "miniz.h"
|
||||
#include "internal.h"
|
||||
|
||||
/* only decompress rootcerts once */
|
||||
unsigned char* ca_certs = NULL;
|
||||
/* netscape ca bundle */
|
||||
const unsigned char *ca_cert_store_encoded;
|
||||
/* imageboard ref just because */
|
||||
static char userAgent[] = "NetRunner_Micro/0.1 PolarSSL/2.16.0;U;";
|
||||
|
||||
static void destroy_persistent_data()
|
||||
{
|
||||
free(ca_certs);
|
||||
ca_certs = NULL;
|
||||
}
|
||||
|
||||
static bool generateSeed(client)
|
||||
http_state *client;
|
||||
{
|
||||
#ifdef _WIN32
|
||||
HCRYPTPROV hprovider;
|
||||
|
||||
/* On Windows NT 4.0 or later, use CryptoAPI to grab 64 bytes of random data */
|
||||
hprovider = 0;
|
||||
CryptAcquireContext(&hprovider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT);
|
||||
CryptGenRandom(hprovider, 64, (BYTE*)&client->tls_state.seed);
|
||||
CryptReleaseContext(hprovider, 0);
|
||||
#endif
|
||||
client->tls_state.seed[63] = '\0'; /* null-terminate for safety */
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool initTLS(client)
|
||||
http_state *client;
|
||||
{
|
||||
int inf_status,r;
|
||||
size_t out;
|
||||
unsigned long inf_len;
|
||||
unsigned char* tmp;
|
||||
char str[512];
|
||||
|
||||
mbedtls_net_init(&client->tls_state.server_fd);
|
||||
mbedtls_ssl_init(&client->tls_state.ssl);
|
||||
mbedtls_ssl_config_init(&client->tls_state.conf);
|
||||
mbedtls_x509_crt_init(&client->tls_state.cacert);
|
||||
mbedtls_entropy_init(&client->tls_state.entropy);
|
||||
mbedtls_ctr_drbg_init(&client->tls_state.ctr_drbg);
|
||||
|
||||
/* only decompress once */
|
||||
if (!ca_certs)
|
||||
{
|
||||
tmp = malloc(524288);
|
||||
|
||||
r = strlen(ca_cert_store_encoded) - 1;
|
||||
r = mbedtls_base64_decode(tmp, 524288, &out, ca_cert_store_encoded, r);
|
||||
if (r)
|
||||
{
|
||||
mbedtls_strerror(r, (char*)tmp, 524288);
|
||||
printf("decoding failed: %s\n", tmp);
|
||||
free(tmp);
|
||||
return false;
|
||||
}
|
||||
/* inflate ca certs, they are still compressed */
|
||||
ca_certs = malloc(524288);
|
||||
inf_len = 524288;
|
||||
|
||||
inf_status = uncompress(ca_certs, &inf_len, tmp, out);
|
||||
if (inf_status != Z_OK)
|
||||
{
|
||||
printf("decompression failed: %s\n", mz_error(inf_status));
|
||||
free(tmp);
|
||||
return false;
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
if (!generateSeed())
|
||||
return false;
|
||||
|
||||
if (mbedtls_ctr_drbg_seed(&client->tls_state.ctr_drbg, mbedtls_entropy_func, &client->tls_state.entropy, (const unsigned char*)client->tls_state.seed, 64)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
r = mbedtls_x509_crt_parse(&client->tls_state.cacert, ca_certs, inf_len+1);
|
||||
if (r < 0) {
|
||||
mbedtls_strerror(r, str, 512);
|
||||
printf("parse ca cert store failed\n ! mbedtls_x509_crt_parse returned: %s\n\n", str);
|
||||
return false;
|
||||
}
|
||||
client->tls_state.TLSInit = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* if false, library may be in an inconsistent state,
|
||||
* call terminate_client()
|
||||
*/
|
||||
bool init_client(client)
|
||||
http_state* client;
|
||||
{
|
||||
if (!ca_certs)
|
||||
atexit(destroy_persistent_data);
|
||||
if (!client)
|
||||
client = calloc(1, sizeof(http_state));
|
||||
initTLS(client);
|
||||
|
||||
return client->tls_state.TLSInit;
|
||||
}
|
||||
|
||||
static void ua_string(client)
|
||||
http_state *client;
|
||||
{
|
||||
/* fill in user-agent string */
|
||||
#ifdef _WIN32
|
||||
DWORD version, major, minor, build;
|
||||
version = GetVersion();
|
||||
major = (DWORD)(LOBYTE(LOWORD(version)));
|
||||
minor = (DWORD)(HIBYTE(LOWORD(version)));
|
||||
if (version < 0x80000000)
|
||||
build = (DWORD)(HIWORD(version));
|
||||
client->ua = malloc(512);
|
||||
snprintf(client->ua, 512, "%sWindows NT %d.%d", userAgent, major, minor);
|
||||
#endif
|
||||
}
|
||||
|
||||
download_https_resource(client, uri)
|
||||
http_state *client;
|
||||
char *uri;
|
||||
{
|
||||
int r, len;
|
||||
char buf[1024], port[8];
|
||||
char *rq, *resp;
|
||||
unsigned flags;
|
||||
url_t *parsed_uri;
|
||||
|
||||
rq = malloc(4096);
|
||||
/* this string gets readjusted each time we make a request */
|
||||
client->request_uri = realloc(NULL, strlen(uri)+1);
|
||||
parsed_uri = malloc(sizeof(url_t));
|
||||
memset(parsed_uri, 0, sizeof(url_t));
|
||||
r = parse_url(uri, false, parsed_uri);
|
||||
if (r)
|
||||
{
|
||||
printf("Invalid URI pathspec\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!client->tls_state.TLSInit)
|
||||
{
|
||||
printf("Failed to initialise polarssl\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* get host name, set port if blank */
|
||||
if (!strcmp("https", parsed_uri->protocol) && !parsed_uri->port)
|
||||
parsed_uri->port = 443;
|
||||
|
||||
printf("connecting to %s on port %d...",parsed_uri->host, parsed_uri->port);
|
||||
sprintf(port, "%d", parsed_uri->port);
|
||||
r = mbedtls_net_connect(&client->tls_state.server_fd, parsed_uri->host, port, MBEDTLS_NET_PROTO_TCP);
|
||||
if (r)
|
||||
{
|
||||
printf("error - failed to connect to server: %d\n", r);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
r = mbedtls_ssl_config_defaults(&client->tls_state.conf, MBEDTLS_SSL_IS_CLIENT, MBEDTLS_SSL_TRANSPORT_STREAM, MBEDTLS_SSL_PRESET_DEFAULT);
|
||||
if (r)
|
||||
{
|
||||
printf("error - failed to set TLS options: %d\n", r);
|
||||
goto exit;
|
||||
}
|
||||
mbedtls_ssl_conf_authmode(&client->tls_state.conf, MBEDTLS_SSL_VERIFY_REQUIRED);
|
||||
mbedtls_ssl_conf_ca_chain(&client->tls_state.conf, &client->tls_state.cacert, NULL);
|
||||
mbedtls_ssl_conf_rng(&client->tls_state.conf, mbedtls_ctr_drbg_random, &client->tls_state.ctr_drbg);
|
||||
r = mbedtls_ssl_setup(&client->tls_state.ssl, &client->tls_state.conf);
|
||||
if (r)
|
||||
{
|
||||
printf("error - failed to setup TLS session: %d\n", r);
|
||||
goto exit;
|
||||
}
|
||||
r = mbedtls_ssl_set_hostname(&client->tls_state.ssl, parsed_uri->host);
|
||||
if (r)
|
||||
{
|
||||
printf("error - failed to perform SNI: %d\n", r);
|
||||
goto exit;
|
||||
}
|
||||
mbedtls_ssl_set_bio(&client->tls_state.ssl, &client->tls_state.server_fd, mbedtls_net_send, mbedtls_net_recv, NULL);
|
||||
while ((r = mbedtls_ssl_handshake(&client->tls_state.ssl)) != 0)
|
||||
{
|
||||
if (r != MBEDTLS_ERR_SSL_WANT_READ && r != MBEDTLS_ERR_SSL_WANT_WRITE)
|
||||
{
|
||||
printf(" failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", -r);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
if ((flags = mbedtls_ssl_get_verify_result(&client->tls_state.ssl)) != 0)
|
||||
{
|
||||
char vrfy_buf[512];
|
||||
printf(" failed\n");
|
||||
mbedtls_x509_crt_verify_info(vrfy_buf, sizeof(vrfy_buf), " ! ", flags);
|
||||
printf("%s\n", vrfy_buf);
|
||||
goto exit;
|
||||
}
|
||||
printf("\nDownloading %s...", &parsed_uri->path[1]);
|
||||
snprintf(rq, 512, "GET %s HTTP/1.0\r\nHost: %s\r\nUser-Agent: %s\r\n\r\n", parsed_uri->path, parsed_uri->host, client->ua);
|
||||
while ((r = mbedtls_ssl_write(&client->tls_state.ssl, (unsigned char*)rq, strlen(rq))) <= 0)
|
||||
{
|
||||
if (r != MBEDTLS_ERR_SSL_WANT_READ && r != MBEDTLS_ERR_SSL_WANT_WRITE)
|
||||
{
|
||||
printf("failed! error %d\n\n", r);
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
memset(rq, 0, 4096);
|
||||
len = 0;
|
||||
do {
|
||||
r = mbedtls_ssl_read(&client->tls_state.ssl, (unsigned char*)buf, 1024);
|
||||
if (r <= 0)
|
||||
break;
|
||||
else
|
||||
{
|
||||
rq = memncat(rq, len, buf, r, sizeof(char));
|
||||
len += r;
|
||||
}
|
||||
} while (r);
|
||||
printf("%d bytes downloaded to core.\n", len);
|
||||
mbedtls_ssl_close_notify(&client->tls_state.ssl);
|
||||
if (!strstr(rq, "200 OK"))
|
||||
{
|
||||
printf("An error occurred.\n");
|
||||
printf("Server response:\n%s", rq);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Response body is in buf after processing */
|
||||
resp = strstr(rq, "Content-Length");
|
||||
r = strcspn(resp, "0123456789");
|
||||
memcpy(buf, &resp[r], 4);
|
||||
buf[3] = '\0';
|
||||
r = atoi(buf);
|
||||
resp = strstr(rq, "\r\n\r\n");
|
||||
memcpy(buf, &resp[4], r);
|
||||
|
||||
r = 0;
|
||||
|
||||
exit:
|
||||
free(rq);
|
||||
free_parsed_url(parsed_uri);
|
||||
return r;
|
||||
}
|
||||
|
||||
void terminate_client(client)
|
||||
http_state *client;
|
||||
{
|
||||
mbedtls_ssl_close_notify(&client->tls_state.ssl);
|
||||
mbedtls_net_free(&client->tls_state.server_fd);
|
||||
mbedtls_x509_crt_free(&client->tls_state.cacert);
|
||||
mbedtls_ssl_free(&client->tls_state.ssl);
|
||||
mbedtls_ssl_config_free(&client->tls_state.conf);
|
||||
mbedtls_ctr_drbg_free(&client->tls_state.ctr_drbg);
|
||||
mbedtls_entropy_free(&client->tls_state.entropy);
|
||||
free(client->ua);
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*------------------------------------------------------------------------------
|
||||
* libhttp, a really small HTTP 0-3 client library with TLS
|
||||
* public API header
|
||||
* do not include this file in any of the libhttp sources itself
|
||||
*
|
||||
* HTTPS only; why the hell would you serve semi-sensitive data over an
|
||||
* unencrypted channel? In fact, the polarssl integration is intended to
|
||||
* bypass limitations in the native TLS stack (no TLS 1.1+ on some older
|
||||
* platforms, lack of high-encryption ciphersuites other than ARC4 or
|
||||
* Triple-DES, etc)
|
||||
* -rick
|
||||
*/
|
||||
|
||||
#ifndef LIBHTTP_H
|
||||
#define LIBHTTP_H
|
||||
|
||||
/* http client object */
|
||||
typedef struct
|
||||
{
|
||||
char *ua; /* platform-specific user-agent string */
|
||||
char *request_uri; /* last uri requested, the response corresponds to this link */
|
||||
struct responseBody
|
||||
{
|
||||
/* the raw_data and headers point to the same place */
|
||||
/* the content is an offset into the raw_data */
|
||||
union
|
||||
{
|
||||
char* raw_data;
|
||||
char* headers;
|
||||
};
|
||||
char* content;
|
||||
};
|
||||
/* anonymous field, do not poke */
|
||||
void *reserved;
|
||||
} http_state;
|
||||
|
||||
/* libhttp public API */
|
||||
bool init_client(http_state*);
|
||||
int download_https_resource(http_state*, char*);
|
||||
void terminate_client(http_state*);
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*------------------------------------------------------------------------------
|
||||
* uri parsing functions
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
void free_parsed_url(url_parsed)
|
||||
url_t *url_parsed;
|
||||
{
|
||||
if (url_parsed->protocol)
|
||||
free(url_parsed->protocol);
|
||||
if (url_parsed->host)
|
||||
free(url_parsed->host);
|
||||
if (url_parsed->path)
|
||||
free(url_parsed->path);
|
||||
if (url_parsed->query_string)
|
||||
free(url_parsed->query_string);
|
||||
|
||||
free(url_parsed);
|
||||
}
|
||||
|
||||
parse_url(url, verify_host, parsed_url)
|
||||
char *url;
|
||||
bool verify_host;
|
||||
url_t *parsed_url;
|
||||
{
|
||||
char *local_url, *token, *token_host, *host_port, *host_ip, *token_ptr;
|
||||
char *host_token_ptr, *path = NULL;
|
||||
|
||||
/* Copy our string */
|
||||
local_url = strdup(url);
|
||||
|
||||
token = strtok_r(local_url, ":", &token_ptr);
|
||||
parsed_url->protocol = strdup(token);
|
||||
|
||||
/* Host:Port */
|
||||
token = strtok_r(NULL, "/", &token_ptr);
|
||||
if (token)
|
||||
host_port = strdup(token);
|
||||
else
|
||||
host_port = (char *) calloc(1, sizeof(char));
|
||||
|
||||
token_host = strtok_r(host_port, ":", &host_token_ptr);
|
||||
parsed_url->host_ip = NULL;
|
||||
if (token_host) {
|
||||
parsed_url->host = strdup(token_host);
|
||||
|
||||
if (verify_host) {
|
||||
struct hostent *host;
|
||||
host = gethostbyname(parsed_url->host);
|
||||
if (host != NULL) {
|
||||
parsed_url->host_ip = inet_ntoa(* (struct in_addr *) host->h_addr);
|
||||
parsed_url->host_exists = 1;
|
||||
} else {
|
||||
parsed_url->host_exists = 0;
|
||||
}
|
||||
} else {
|
||||
parsed_url->host_exists = -1;
|
||||
}
|
||||
} else {
|
||||
parsed_url->host_exists = -1;
|
||||
parsed_url->host = NULL;
|
||||
}
|
||||
|
||||
/* Port */
|
||||
token_host = strtok_r(NULL, ":", &host_token_ptr);
|
||||
if (token_host)
|
||||
parsed_url->port = atoi(token_host);
|
||||
else
|
||||
parsed_url->port = 0;
|
||||
|
||||
token_host = strtok_r(NULL, ":", &host_token_ptr);
|
||||
assert(token_host == NULL);
|
||||
|
||||
token = strtok_r(NULL, "?", &token_ptr);
|
||||
parsed_url->path = NULL;
|
||||
if (token) {
|
||||
path = (char *) realloc(path, sizeof(char) * (strlen(token) + 2));
|
||||
memset(path, 0, sizeof(char) * (strlen(token)+2));
|
||||
strcpy(path, "/");
|
||||
strcat(path, token);
|
||||
|
||||
parsed_url->path = strdup(path);
|
||||
|
||||
free(path);
|
||||
} else {
|
||||
parsed_url->path = (char *) malloc(sizeof(char) * 2);
|
||||
strcpy(parsed_url->path, "/");
|
||||
}
|
||||
|
||||
token = strtok_r(NULL, "?", &token_ptr);
|
||||
if (token) {
|
||||
parsed_url->query_string = (char *) malloc(sizeof(char) * (strlen(token) + 1));
|
||||
strncpy(parsed_url->query_string, token, strlen(token));
|
||||
} else {
|
||||
parsed_url->query_string = NULL;
|
||||
}
|
||||
|
||||
token = strtok_r(NULL, "?", &token_ptr);
|
||||
assert(token == NULL);
|
||||
|
||||
free(local_url);
|
||||
free(host_port);
|
||||
return 0;
|
||||
}
|
@ -1,209 +0,0 @@
|
||||
/* zpipe.c: example of proper use of zlib's inflate() and deflate()
|
||||
Not copyrighted -- provided to the public domain
|
||||
Version 1.4 11 December 2005 Mark Adler */
|
||||
|
||||
/* Version history:
|
||||
1.0 30 Oct 2004 First version
|
||||
1.1 8 Nov 2004 Add void casting for unused return values
|
||||
Use switch statement for inflate() return values
|
||||
1.2 9 Nov 2004 Add assertions to document zlib guarantees
|
||||
1.3 6 Apr 2005 Remove incorrect assertion in inf()
|
||||
1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions
|
||||
Avoid some compiler warnings for input and output buffers
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "miniz.h"
|
||||
|
||||
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
|
||||
# include <fcntl.h>
|
||||
# include <io.h>
|
||||
# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
|
||||
#else
|
||||
# define SET_BINARY_MODE(file)
|
||||
#endif
|
||||
|
||||
#define CHUNK 16384
|
||||
|
||||
/* Compress from file source to file dest until EOF on source.
|
||||
def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
|
||||
allocated for processing, Z_STREAM_ERROR if an invalid compression
|
||||
level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
|
||||
version of the library linked do not match, or Z_ERRNO if there is
|
||||
an error reading or writing the files. */
|
||||
int def(FILE *source, FILE *dest, int level)
|
||||
{
|
||||
int ret, flush;
|
||||
unsigned have;
|
||||
z_stream strm;
|
||||
unsigned char in[CHUNK];unsigned char out[CHUNK];
|
||||
|
||||
/* allocate deflate state */
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
ret = deflateInit(&strm, level);
|
||||
if (ret != Z_OK)
|
||||
return ret;
|
||||
|
||||
/* compress until end of file */
|
||||
do {
|
||||
strm.avail_in = fread(in, 1, CHUNK, source);
|
||||
if (ferror(source)) {
|
||||
(void)deflateEnd(&strm);
|
||||
return Z_ERRNO;
|
||||
}
|
||||
flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
|
||||
strm.next_in = in;
|
||||
|
||||
/* run deflate() on input until output buffer not full, finish
|
||||
compression if all of source has been read in */
|
||||
do {
|
||||
strm.avail_out = CHUNK;
|
||||
strm.next_out = out;
|
||||
ret = deflate(&strm, flush); /* no bad return value */
|
||||
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
||||
have = CHUNK - strm.avail_out;
|
||||
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
|
||||
(void)deflateEnd(&strm);
|
||||
return Z_ERRNO;
|
||||
}
|
||||
} while (strm.avail_out == 0);
|
||||
assert(strm.avail_in == 0); /* all input will be used */
|
||||
|
||||
/* done when last data in file processed */
|
||||
} while (flush != Z_FINISH);
|
||||
assert(ret == Z_STREAM_END); /* stream will be complete */
|
||||
|
||||
/* clean up and return */
|
||||
(void)deflateEnd(&strm);
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
/* Decompress from file source to file dest until stream ends or EOF.
|
||||
inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
|
||||
allocated for processing, Z_DATA_ERROR if the deflate data is
|
||||
invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
|
||||
the version of the library linked do not match, or Z_ERRNO if there
|
||||
is an error reading or writing the files. */
|
||||
int inf(FILE *source, FILE *dest)
|
||||
{
|
||||
int ret;
|
||||
unsigned have;
|
||||
z_stream strm;
|
||||
unsigned char in[CHUNK];
|
||||
unsigned char out[CHUNK];
|
||||
|
||||
/* allocate inflate state */
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = 0;
|
||||
strm.next_in = Z_NULL;
|
||||
ret = inflateInit(&strm);
|
||||
if (ret != Z_OK)
|
||||
return ret;
|
||||
|
||||
/* decompress until deflate stream ends or end of file */
|
||||
do {
|
||||
strm.avail_in = fread(in, 1, CHUNK, source);
|
||||
if (ferror(source)) {
|
||||
(void)inflateEnd(&strm);
|
||||
return Z_ERRNO;
|
||||
}
|
||||
if (strm.avail_in == 0)
|
||||
break;
|
||||
strm.next_in = in;
|
||||
|
||||
/* run inflate() on input until output buffer not full */
|
||||
do {
|
||||
strm.avail_out = CHUNK;
|
||||
strm.next_out = out;
|
||||
ret = inflate(&strm, Z_NO_FLUSH);
|
||||
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
||||
switch (ret) {
|
||||
case Z_NEED_DICT:
|
||||
ret = Z_DATA_ERROR; /* and fall through */
|
||||
case Z_DATA_ERROR:
|
||||
case Z_MEM_ERROR:
|
||||
(void)inflateEnd(&strm);
|
||||
return ret;
|
||||
}
|
||||
have = CHUNK - strm.avail_out;
|
||||
if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
|
||||
(void)inflateEnd(&strm);
|
||||
return Z_ERRNO;
|
||||
}
|
||||
} while (strm.avail_out == 0);
|
||||
|
||||
/* done when inflate() says it's done */
|
||||
} while (ret != Z_STREAM_END);
|
||||
|
||||
/* clean up and return */
|
||||
(void)inflateEnd(&strm);
|
||||
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
|
||||
}
|
||||
|
||||
/* report a zlib or i/o error */
|
||||
void zerr(int ret)
|
||||
{
|
||||
fputs("zpipe: ", stderr);
|
||||
switch (ret) {
|
||||
case Z_ERRNO:
|
||||
if (ferror(stdin))
|
||||
fputs("error reading stdin\n", stderr);
|
||||
if (ferror(stdout))
|
||||
fputs("error writing stdout\n", stderr);
|
||||
break;
|
||||
case Z_STREAM_ERROR:
|
||||
fputs("invalid compression level\n", stderr);
|
||||
break;
|
||||
case Z_DATA_ERROR:
|
||||
fputs("invalid or incomplete deflate data\n", stderr);
|
||||
break;
|
||||
case Z_MEM_ERROR:
|
||||
fputs("out of memory\n", stderr);
|
||||
break;
|
||||
case Z_VERSION_ERROR:
|
||||
fputs("zlib version mismatch!\n", stderr);
|
||||
}
|
||||
}
|
||||
|
||||
/* compress or decompress from stdin to stdout */
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* avoid end-of-line conversions */
|
||||
SET_BINARY_MODE(stdin);
|
||||
SET_BINARY_MODE(stdout);
|
||||
|
||||
/* do compression if no arguments */
|
||||
/* Warning: Not compatible with plain libz, dial it back down to
|
||||
* 9 if this is required, uber-level is 10
|
||||
* since we have everything crammed in miniz, we don't depend on
|
||||
* libz at all.
|
||||
*/
|
||||
if (argc == 1) {
|
||||
ret = def(stdin, stdout, MZ_UBER_COMPRESSION);
|
||||
if (ret != Z_OK)
|
||||
zerr(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* do decompression if -d specified */
|
||||
else if (argc == 2 && strcmp(argv[1], "-d") == 0) {
|
||||
ret = inf(stdin, stdout);
|
||||
if (ret != Z_OK)
|
||||
zerr(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* otherwise, report usage */
|
||||
else {
|
||||
fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr);
|
||||
return 1;
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,29 @@
|
||||
//
|
||||
// WindowsManager.swift
|
||||
// lokinet
|
||||
//
|
||||
// Copyright © 2019 Loki. All rights reserved.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
import Foundation
|
||||
|
||||
struct WindowsManager {
|
||||
static func getVC<T: NSViewController>(withIdentifier identifier: String,
|
||||
ofType: T.Type?,
|
||||
storyboard: String = "Main",
|
||||
bundle: Bundle? = nil) -> T? {
|
||||
let storyboard = NSStoryboard(name: storyboard, bundle: bundle)
|
||||
|
||||
guard let vc: T = storyboard.instantiateController(withIdentifier: identifier) as? T else {
|
||||
let alert = NSAlert()
|
||||
alert.alertStyle = .critical
|
||||
alert.messageText = "Error initiating the viewcontroller"
|
||||
alert.runModal()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
return vc
|
||||
}
|
||||
}
|
@ -0,0 +1,641 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 51;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
7B28BD1A232EA8B40073B955 /* DNSManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B28BD19232EA8B40073B955 /* DNSManager.swift */; };
|
||||
7B28BD1C232EB6EF0073B955 /* LokinetRunner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B28BD1B232EB6EF0073B955 /* LokinetRunner.swift */; };
|
||||
7BA4FB642340D5940098E20A /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BA4FB632340D5940098E20A /* Preferences.swift */; };
|
||||
7BA4FB662340DA820098E20A /* StatusMenuExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BA4FB652340DA820098E20A /* StatusMenuExt.swift */; };
|
||||
7BA4FB6C2340F2270098E20A /* WindowsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BA4FB6B2340F2270098E20A /* WindowsManager.swift */; };
|
||||
7BA4FB7023411FF60098E20A /* PrefsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BA4FB6E23411FF60098E20A /* PrefsViewController.swift */; };
|
||||
7BA4FB7323412D700098E20A /* Interfaces.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BA4FB7223412D700098E20A /* Interfaces.swift */; };
|
||||
7BED5B7A232D78D900DF603F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BED5B79232D78D900DF603F /* AppDelegate.swift */; };
|
||||
7BED5B7E232D78DB00DF603F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7BED5B7D232D78DB00DF603F /* Assets.xcassets */; };
|
||||
7BED5B81232D78DB00DF603F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7BED5B7F232D78DB00DF603F /* Main.storyboard */; };
|
||||
7BED5B8D232D78DB00DF603F /* lokinetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BED5B8C232D78DB00DF603F /* lokinetTests.swift */; };
|
||||
7BED5B98232D78DB00DF603F /* lokinetUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BED5B97232D78DB00DF603F /* lokinetUITests.swift */; };
|
||||
7BED5BA6232E7E6600DF603F /* LokinetLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BED5BA5232E7E6600DF603F /* LokinetLog.swift */; };
|
||||
7BED5BA8232E831B00DF603F /* StreamReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BED5BA7232E831B00DF603F /* StreamReader.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
7BED5B89232D78DB00DF603F /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 7BED5B6E232D78D900DF603F /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 7BED5B75232D78D900DF603F;
|
||||
remoteInfo = lokinet;
|
||||
};
|
||||
7BED5B94232D78DB00DF603F /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 7BED5B6E232D78D900DF603F /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 7BED5B75232D78D900DF603F;
|
||||
remoteInfo = lokinet;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
7B28BD19232EA8B40073B955 /* DNSManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DNSManager.swift; sourceTree = "<group>"; };
|
||||
7B28BD1B232EB6EF0073B955 /* LokinetRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LokinetRunner.swift; sourceTree = "<group>"; };
|
||||
7BA4FB632340D5940098E20A /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
|
||||
7BA4FB652340DA820098E20A /* StatusMenuExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusMenuExt.swift; sourceTree = "<group>"; };
|
||||
7BA4FB6B2340F2270098E20A /* WindowsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowsManager.swift; sourceTree = "<group>"; };
|
||||
7BA4FB6E23411FF60098E20A /* PrefsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrefsViewController.swift; sourceTree = "<group>"; };
|
||||
7BA4FB7223412D700098E20A /* Interfaces.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Interfaces.swift; sourceTree = "<group>"; };
|
||||
7BED5B76232D78D900DF603F /* lokinet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = lokinet.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7BED5B79232D78D900DF603F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
7BED5B7D232D78DB00DF603F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
7BED5B80232D78DB00DF603F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
7BED5B82232D78DB00DF603F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
7BED5B83232D78DB00DF603F /* lokinet.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = lokinet.entitlements; sourceTree = "<group>"; };
|
||||
7BED5B88232D78DB00DF603F /* lokinetTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = lokinetTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7BED5B8C232D78DB00DF603F /* lokinetTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = lokinetTests.swift; sourceTree = "<group>"; };
|
||||
7BED5B8E232D78DB00DF603F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
7BED5B93232D78DB00DF603F /* lokinetUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = lokinetUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7BED5B97232D78DB00DF603F /* lokinetUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = lokinetUITests.swift; sourceTree = "<group>"; };
|
||||
7BED5B99232D78DB00DF603F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
7BED5BA5232E7E6600DF603F /* LokinetLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LokinetLog.swift; sourceTree = "<group>"; };
|
||||
7BED5BA7232E831B00DF603F /* StreamReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamReader.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
7BED5B73232D78D900DF603F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
7BED5B85232D78DB00DF603F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
7BED5B90232D78DB00DF603F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
7BED5B6D232D78D900DF603F = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7BA4FB6B2340F2270098E20A /* WindowsManager.swift */,
|
||||
7BED5B78232D78D900DF603F /* lokinet */,
|
||||
7BED5B8B232D78DB00DF603F /* lokinetTests */,
|
||||
7BED5B96232D78DB00DF603F /* lokinetUITests */,
|
||||
7BED5B77232D78D900DF603F /* Products */,
|
||||
7BED5BA9232E993E00DF603F /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7BED5B77232D78D900DF603F /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7BED5B76232D78D900DF603F /* lokinet.app */,
|
||||
7BED5B88232D78DB00DF603F /* lokinetTests.xctest */,
|
||||
7BED5B93232D78DB00DF603F /* lokinetUITests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7BED5B78232D78D900DF603F /* lokinet */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7BED5B79232D78D900DF603F /* AppDelegate.swift */,
|
||||
7BA4FB652340DA820098E20A /* StatusMenuExt.swift */,
|
||||
7BA4FB632340D5940098E20A /* Preferences.swift */,
|
||||
7BA4FB6E23411FF60098E20A /* PrefsViewController.swift */,
|
||||
7BED5B7D232D78DB00DF603F /* Assets.xcassets */,
|
||||
7BED5B7F232D78DB00DF603F /* Main.storyboard */,
|
||||
7BED5B82232D78DB00DF603F /* Info.plist */,
|
||||
7BED5B83232D78DB00DF603F /* lokinet.entitlements */,
|
||||
7BED5BA5232E7E6600DF603F /* LokinetLog.swift */,
|
||||
7B28BD19232EA8B40073B955 /* DNSManager.swift */,
|
||||
7BED5BA7232E831B00DF603F /* StreamReader.swift */,
|
||||
7B28BD1B232EB6EF0073B955 /* LokinetRunner.swift */,
|
||||
7BA4FB7223412D700098E20A /* Interfaces.swift */,
|
||||
);
|
||||
path = lokinet;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7BED5B8B232D78DB00DF603F /* lokinetTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7BED5B8C232D78DB00DF603F /* lokinetTests.swift */,
|
||||
7BED5B8E232D78DB00DF603F /* Info.plist */,
|
||||
);
|
||||
path = lokinetTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7BED5B96232D78DB00DF603F /* lokinetUITests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
7BED5B97232D78DB00DF603F /* lokinetUITests.swift */,
|
||||
7BED5B99232D78DB00DF603F /* Info.plist */,
|
||||
);
|
||||
path = lokinetUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7BED5BA9232E993E00DF603F /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
7BED5B75232D78D900DF603F /* lokinet */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 7BED5B9C232D78DB00DF603F /* Build configuration list for PBXNativeTarget "lokinet" */;
|
||||
buildPhases = (
|
||||
7BED5B72232D78D900DF603F /* Sources */,
|
||||
7BED5B73232D78D900DF603F /* Frameworks */,
|
||||
7BED5B74232D78D900DF603F /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = lokinet;
|
||||
productName = lokinet;
|
||||
productReference = 7BED5B76232D78D900DF603F /* lokinet.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
7BED5B87232D78DB00DF603F /* lokinetTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 7BED5B9F232D78DB00DF603F /* Build configuration list for PBXNativeTarget "lokinetTests" */;
|
||||
buildPhases = (
|
||||
7BED5B84232D78DB00DF603F /* Sources */,
|
||||
7BED5B85232D78DB00DF603F /* Frameworks */,
|
||||
7BED5B86232D78DB00DF603F /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
7BED5B8A232D78DB00DF603F /* PBXTargetDependency */,
|
||||
);
|
||||
name = lokinetTests;
|
||||
productName = lokinetTests;
|
||||
productReference = 7BED5B88232D78DB00DF603F /* lokinetTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
7BED5B92232D78DB00DF603F /* lokinetUITests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 7BED5BA2232D78DB00DF603F /* Build configuration list for PBXNativeTarget "lokinetUITests" */;
|
||||
buildPhases = (
|
||||
7BED5B8F232D78DB00DF603F /* Sources */,
|
||||
7BED5B90232D78DB00DF603F /* Frameworks */,
|
||||
7BED5B91232D78DB00DF603F /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
7BED5B95232D78DB00DF603F /* PBXTargetDependency */,
|
||||
);
|
||||
name = lokinetUITests;
|
||||
productName = lokinetUITests;
|
||||
productReference = 7BED5B93232D78DB00DF603F /* lokinetUITests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.ui-testing";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
7BED5B6E232D78D900DF603F /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1020;
|
||||
LastUpgradeCheck = 1020;
|
||||
ORGANIZATIONNAME = Loki;
|
||||
TargetAttributes = {
|
||||
7BED5B75232D78D900DF603F = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
SystemCapabilities = {
|
||||
com.apple.ApplicationGroups.Mac = {
|
||||
enabled = 0;
|
||||
};
|
||||
com.apple.NetworkExtensions = {
|
||||
enabled = 0;
|
||||
};
|
||||
com.apple.Sandbox = {
|
||||
enabled = 0;
|
||||
};
|
||||
};
|
||||
};
|
||||
7BED5B87232D78DB00DF603F = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
TestTargetID = 7BED5B75232D78D900DF603F;
|
||||
};
|
||||
7BED5B92232D78DB00DF603F = {
|
||||
CreatedOnToolsVersion = 10.2.1;
|
||||
TestTargetID = 7BED5B75232D78D900DF603F;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 7BED5B71232D78D900DF603F /* Build configuration list for PBXProject "lokinet" */;
|
||||
compatibilityVersion = "Xcode 10.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 7BED5B6D232D78D900DF603F;
|
||||
productRefGroup = 7BED5B77232D78D900DF603F /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
7BED5B75232D78D900DF603F /* lokinet */,
|
||||
7BED5B87232D78DB00DF603F /* lokinetTests */,
|
||||
7BED5B92232D78DB00DF603F /* lokinetUITests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
7BED5B74232D78D900DF603F /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7BED5B7E232D78DB00DF603F /* Assets.xcassets in Resources */,
|
||||
7BED5B81232D78DB00DF603F /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
7BED5B86232D78DB00DF603F /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
7BED5B91232D78DB00DF603F /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
7BED5B72232D78D900DF603F /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7BED5BA8232E831B00DF603F /* StreamReader.swift in Sources */,
|
||||
7BA4FB7023411FF60098E20A /* PrefsViewController.swift in Sources */,
|
||||
7BED5BA6232E7E6600DF603F /* LokinetLog.swift in Sources */,
|
||||
7BA4FB662340DA820098E20A /* StatusMenuExt.swift in Sources */,
|
||||
7B28BD1A232EA8B40073B955 /* DNSManager.swift in Sources */,
|
||||
7B28BD1C232EB6EF0073B955 /* LokinetRunner.swift in Sources */,
|
||||
7BA4FB6C2340F2270098E20A /* WindowsManager.swift in Sources */,
|
||||
7BA4FB7323412D700098E20A /* Interfaces.swift in Sources */,
|
||||
7BA4FB642340D5940098E20A /* Preferences.swift in Sources */,
|
||||
7BED5B7A232D78D900DF603F /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
7BED5B84232D78DB00DF603F /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7BED5B8D232D78DB00DF603F /* lokinetTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
7BED5B8F232D78DB00DF603F /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7BED5B98232D78DB00DF603F /* lokinetUITests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
7BED5B8A232D78DB00DF603F /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 7BED5B75232D78D900DF603F /* lokinet */;
|
||||
targetProxy = 7BED5B89232D78DB00DF603F /* PBXContainerItemProxy */;
|
||||
};
|
||||
7BED5B95232D78DB00DF603F /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 7BED5B75232D78D900DF603F /* lokinet */;
|
||||
targetProxy = 7BED5B94232D78DB00DF603F /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
7BED5B7F232D78DB00DF603F /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
7BED5B80232D78DB00DF603F /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
7BED5B9A232D78DB00DF603F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEVELOPMENT_TEAM = 23TKR8Q2XE;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7BED5B9B232D78DB00DF603F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
DEVELOPMENT_TEAM = 23TKR8Q2XE;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
7BED5B9D232D78DB00DF603F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = lokinet/lokinet.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = 23TKR8Q2XE;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
INFOPLIST_FILE = lokinet/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = loki.lokinet;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7BED5B9E232D78DB00DF603F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CODE_SIGN_ENTITLEMENTS = lokinet/lokinet.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = 23TKR8Q2XE;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
INFOPLIST_FILE = lokinet/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = loki.lokinet;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
7BED5BA0232D78DB00DF603F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = lokinetTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = loki.lokinetTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/lokinet.app/Contents/MacOS/lokinet";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7BED5BA1232D78DB00DF603F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = lokinetTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = loki.lokinetTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/lokinet.app/Contents/MacOS/lokinet";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
7BED5BA3232D78DB00DF603F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = lokinetUITests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = loki.lokinetUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_TARGET_NAME = lokinet;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7BED5BA4232D78DB00DF603F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = lokinetUITests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = loki.lokinetUITests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_TARGET_NAME = lokinet;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
7BED5B71232D78D900DF603F /* Build configuration list for PBXProject "lokinet" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7BED5B9A232D78DB00DF603F /* Debug */,
|
||||
7BED5B9B232D78DB00DF603F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
7BED5B9C232D78DB00DF603F /* Build configuration list for PBXNativeTarget "lokinet" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7BED5B9D232D78DB00DF603F /* Debug */,
|
||||
7BED5B9E232D78DB00DF603F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
7BED5B9F232D78DB00DF603F /* Build configuration list for PBXNativeTarget "lokinetTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7BED5BA0232D78DB00DF603F /* Debug */,
|
||||
7BED5BA1232D78DB00DF603F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
7BED5BA2232D78DB00DF603F /* Build configuration list for PBXNativeTarget "lokinetUITests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7BED5BA3232D78DB00DF603F /* Debug */,
|
||||
7BED5BA4232D78DB00DF603F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 7BED5B6E232D78D900DF603F /* Project object */;
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,112 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7BED5B75232D78D900DF603F"
|
||||
BuildableName = "lokinet.app"
|
||||
BlueprintName = "lokinet"
|
||||
ReferencedContainer = "container:lokinet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7BED5B87232D78DB00DF603F"
|
||||
BuildableName = "lokinetTests.xctest"
|
||||
BlueprintName = "lokinetTests"
|
||||
ReferencedContainer = "container:lokinet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7BED5B92232D78DB00DF603F"
|
||||
BuildableName = "lokinetUITests.xctest"
|
||||
BlueprintName = "lokinetUITests"
|
||||
ReferencedContainer = "container:lokinet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7BED5B75232D78D900DF603F"
|
||||
BuildableName = "lokinet.app"
|
||||
BlueprintName = "lokinet"
|
||||
ReferencedContainer = "container:lokinet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
debugAsWhichUser = "root"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7BED5B75232D78D900DF603F"
|
||||
BuildableName = "lokinet.app"
|
||||
BlueprintName = "lokinet"
|
||||
ReferencedContainer = "container:lokinet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "7BED5B75232D78D900DF603F"
|
||||
BuildableName = "lokinet.app"
|
||||
BlueprintName = "lokinet"
|
||||
ReferencedContainer = "container:lokinet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
@ -0,0 +1,155 @@
|
||||
//
|
||||
// AppDelegate.swift
|
||||
// lokinet
|
||||
//
|
||||
// Copyright © 2019 Loki. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
let LOG_WINDOW_CONTROLLER: NSWindowController = NSWindowController(window: nil)
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
var lokinet: LokinetRunner? = nil
|
||||
var appender: Appendable? = nil
|
||||
|
||||
var statusBarItem: NSStatusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
|
||||
|
||||
func applicationWillFinishLaunching(_ notification: Notification) {
|
||||
if (!Preferences.firstRunDone) {
|
||||
Preferences.firstRunDone = true
|
||||
Preferences.restore()
|
||||
}
|
||||
}
|
||||
|
||||
func applicationDidFinishLaunching(_ aNotification: Notification) {
|
||||
guard let statusButton = statusBarItem.button else { return }
|
||||
statusButton.title = "LokiNet"
|
||||
let statusMenu: NSMenu = NSMenu()
|
||||
statusMenu.autoenablesItems = false
|
||||
statusMenu.addItem(withTitle: "LokiNet", action: nil, keyEquivalent: "")
|
||||
|
||||
let runItem: NSMenuItem = {
|
||||
let item = NSMenuItem(
|
||||
title: "Run",
|
||||
action: #selector(runLokinet),
|
||||
keyEquivalent: "r"
|
||||
)
|
||||
item.target = self
|
||||
|
||||
return item
|
||||
}()
|
||||
|
||||
let stopItem: NSMenuItem = {
|
||||
let item = NSMenuItem(
|
||||
title: "Stop",
|
||||
action: #selector(stopLokinet),
|
||||
keyEquivalent: "s"
|
||||
|
||||
)
|
||||
item.isEnabled = false
|
||||
item.target = self
|
||||
|
||||
return item
|
||||
}()
|
||||
|
||||
let showWindowItem: NSMenuItem = {
|
||||
let item = NSMenuItem(
|
||||
title: "Show Window",
|
||||
action: #selector(showWindow),
|
||||
keyEquivalent: "w"
|
||||
)
|
||||
item.target = self
|
||||
|
||||
return item
|
||||
}()
|
||||
|
||||
let quitApplicationItem: NSMenuItem = {
|
||||
let item = NSMenuItem(
|
||||
title: "Quit",
|
||||
action: #selector(terminate),
|
||||
keyEquivalent: "q")
|
||||
item.target = self
|
||||
|
||||
return item
|
||||
}()
|
||||
|
||||
statusMenu.addItems(
|
||||
.separator(),
|
||||
runItem,
|
||||
stopItem,
|
||||
.separator(),
|
||||
showWindowItem,
|
||||
.separator(),
|
||||
quitApplicationItem
|
||||
)
|
||||
|
||||
statusBarItem.menu = statusMenu
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ aNotification: Notification) {
|
||||
lokinet?.stop()
|
||||
}
|
||||
}
|
||||
|
||||
extension AppDelegate {
|
||||
@objc
|
||||
func showWindow(sender: NSMenuItem) {
|
||||
if let vc = WindowsManager.getVC(withIdentifier: "LokinetLogController", ofType: LokinetLogController.self) {
|
||||
appender = vc.log
|
||||
let window: NSWindow = {
|
||||
let w = NSWindow(contentViewController: vc)
|
||||
|
||||
w.styleMask.remove(.fullScreen)
|
||||
w.styleMask.remove(.resizable)
|
||||
w.styleMask.remove(.miniaturizable)
|
||||
|
||||
w.level = .floating
|
||||
|
||||
return w
|
||||
}()
|
||||
|
||||
lokinet?.logAppender = vc.log
|
||||
|
||||
if LOG_WINDOW_CONTROLLER.window == nil {
|
||||
LOG_WINDOW_CONTROLLER.window = window
|
||||
}
|
||||
|
||||
LOG_WINDOW_CONTROLLER.showWindow(window)
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
func runLokinet(sender: NSMenuItem) {
|
||||
if lokinet == nil {
|
||||
lokinet = LokinetRunner(interface: Preferences.interfaceName, path: Preferences.lokinetPath)
|
||||
lokinet?.logAppender = appender
|
||||
lokinet?.start()
|
||||
}
|
||||
|
||||
sender.isEnabled = false;
|
||||
|
||||
if let menu = statusBarItem.menu, let stop = menu.item(withTitle: "Stop") {
|
||||
stop.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
func stopLokinet(_ sender: NSMenuItem) {
|
||||
lokinet?.stop()
|
||||
lokinet = nil
|
||||
|
||||
sender.isEnabled = false;
|
||||
|
||||
if let menu = statusBarItem.menu, let start = menu.item(withTitle: "Run") {
|
||||
start.isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
@objc
|
||||
func terminate(_ sender: NSMenuItem) {
|
||||
NSApp.terminate(sender)
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
@ -0,0 +1,238 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Application-->
|
||||
<scene sceneID="JPo-4y-FX3">
|
||||
<objects>
|
||||
<application id="hnw-xV-0zn" sceneMemberID="viewController">
|
||||
<menu key="mainMenu" title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="lokinet" id="1Xt-HY-uBw">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="lokinet" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About lokinet" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="Ady-hI-5gd" id="Exp-CZ-Vem"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
||||
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW">
|
||||
<connections>
|
||||
<segue destination="I5t-b2-LMF" kind="show" id="DG8-M4-AZh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
|
||||
<menuItem title="Services" id="NMo-om-nkz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||
<menuItem title="Hide lokinet" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<connections>
|
||||
<action selector="hide:" target="Ady-hI-5gd" id="PnN-Uc-m68"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="Ady-hI-5gd" id="VT4-aY-XCT"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="Ady-hI-5gd" id="Dhg-Le-xox"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||
<menuItem title="Quit lokinet" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="Ady-hI-5gd" id="Te7-pn-YzF"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="View" id="H8h-7b-M4v">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="View" id="HyV-fh-RgO">
|
||||
<items>
|
||||
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
|
||||
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="toggleFullScreen:" target="Ady-hI-5gd" id="dU3-MA-1Rq"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="Ady-hI-5gd" id="VwT-WD-YPe"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="Ady-hI-5gd" id="DIl-cC-cCs"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="Ady-hI-5gd" id="DRN-fu-gQh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Help" id="wpr-3q-Mcd">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
|
||||
<items>
|
||||
<menuItem title="lokinet Help" keyEquivalent="?" id="FKE-Sm-Kum">
|
||||
<connections>
|
||||
<action selector="showHelp:" target="Ady-hI-5gd" id="y7X-2Q-9no"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="PrD-fu-P6m"/>
|
||||
</connections>
|
||||
</application>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="lokinet" customModuleProvider="target"/>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<customObject id="Ady-hI-5gd" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="123" y="-201"/>
|
||||
</scene>
|
||||
<!--lokinet-->
|
||||
<scene sceneID="KyO-ZK-znh">
|
||||
<objects>
|
||||
<viewController title="lokinet" storyboardIdentifier="LokinetLogController" id="Bom-14-aTM" customClass="LokinetLogController" customModule="lokinet" sceneMemberID="viewController">
|
||||
<view key="view" id="vMu-xc-OqT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pjx-TF-AEF">
|
||||
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="LWK-yZ-W61">
|
||||
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textView ambiguous="YES" editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" id="Iv9-j0-Ji1" customClass="LokinetLog" customModule="lokinet" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="textColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="systemGrayColor" catalog="System" colorSpace="catalog"/>
|
||||
<size key="minSize" width="450" height="300"/>
|
||||
<size key="maxSize" width="498" height="10000000"/>
|
||||
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
</clipView>
|
||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="2H0-hl-PSz">
|
||||
<rect key="frame" x="-100" y="-100" width="240" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="0vF-TP-EGb">
|
||||
<rect key="frame" x="434" y="0.0" width="16" height="300"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</scroller>
|
||||
</scrollView>
|
||||
</subviews>
|
||||
</view>
|
||||
</viewController>
|
||||
<customObject id="4KZ-DK-tjg" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
<!--Preferences-->
|
||||
<scene sceneID="DWQ-D6-m8l">
|
||||
<objects>
|
||||
<viewController title="Preferences" id="I5t-b2-LMF" customClass="PrefsViewController" customModule="lokinet" sceneMemberID="viewController">
|
||||
<view key="view" id="KZz-Tr-Jig">
|
||||
<rect key="frame" x="0.0" y="0.0" width="450" height="300"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<box fixedFrame="YES" title="Options" translatesAutoresizingMaskIntoConstraints="NO" id="Mbe-YJ-q14">
|
||||
<rect key="frame" x="-3" y="-4" width="456" height="304"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<view key="contentView" id="tbu-Pf-Pbq">
|
||||
<rect key="frame" x="3" y="3" width="450" height="286"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="keI-0V-OFa">
|
||||
<rect key="frame" x="0.0" y="226" width="450" height="5"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
</box>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NuC-QX-tDB">
|
||||
<rect key="frame" x="18" y="269" width="414" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Lokinet Path" id="J0z-ru-wAJ">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Faq-SR-HLK">
|
||||
<rect key="frame" x="18" y="201" width="414" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="clipping" title="Network Interface" id="EAM-Cf-Ujw">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<comboBox identifier="lokinetInterface" verticalHuggingPriority="750" fixedFrame="YES" tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="S5U-xg-7pX">
|
||||
<rect key="frame" x="20" y="169" width="413" height="26"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" numberOfVisibleItems="7" id="f1D-GI-o0g">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</comboBoxCell>
|
||||
<connections>
|
||||
<action selector="comboAction:" target="I5t-b2-LMF" id="Bji-8L-xCR"/>
|
||||
</connections>
|
||||
</comboBox>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="esl-Vn-YX2">
|
||||
<rect key="frame" x="20" y="239" width="410" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" id="WCQ-qF-r0o">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
</view>
|
||||
</box>
|
||||
</subviews>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="interfaceEntry" destination="S5U-xg-7pX" id="OaG-RT-28K"/>
|
||||
<outlet property="pathEntry" destination="WCQ-qF-r0o" id="aVf-iB-WbW"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<customObject id="ncN-3l-Dyn" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="845" y="227"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
@ -0,0 +1,79 @@
|
||||
//
|
||||
// DNSManager.swift
|
||||
// lokinet
|
||||
//
|
||||
// Copyright © 2019 Loki. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
func split(str: String?) -> [String] {
|
||||
let res = str?.components(separatedBy: NSCharacterSet.whitespacesAndNewlines) ?? []
|
||||
return res.filter({!$0.isEmpty})
|
||||
}
|
||||
|
||||
class DNSManager {
|
||||
static let netSetup = URL(fileURLWithPath: "/usr/sbin/networksetup")
|
||||
|
||||
let interface: String
|
||||
var oldDNSSettings: [String] = []
|
||||
|
||||
func getOldSettings() -> [String] {
|
||||
let netprocess = Process()
|
||||
netprocess.executableURL = DNSManager.netSetup
|
||||
netprocess.arguments = ["-getdnsservers", interface]
|
||||
|
||||
do {
|
||||
let pipe = Pipe()
|
||||
netprocess.standardOutput = pipe
|
||||
try netprocess.run()
|
||||
let data = pipe.fileHandleForReading.readDataToEndOfFile()
|
||||
let asStr = String(data: data, encoding: .ascii)
|
||||
|
||||
if asStr?.contains("There aren't any DNS Servers") ?? true {
|
||||
return []
|
||||
} else {
|
||||
return split(str: asStr).filter({$0 != "127.0.0.1"})
|
||||
}
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
func setNewSettings() throws {
|
||||
self.oldDNSSettings = getOldSettings()
|
||||
print("Overriding DNS Settings of \(self.oldDNSSettings)")
|
||||
|
||||
let netprocess = Process()
|
||||
netprocess.executableURL = DNSManager.netSetup
|
||||
|
||||
netprocess.arguments = ["-setdnsservers", self.interface, "127.0.0.1"]
|
||||
|
||||
try netprocess.run()
|
||||
}
|
||||
|
||||
func restoreOldSettings() {
|
||||
let netprocess = Process()
|
||||
netprocess.executableURL = DNSManager.netSetup
|
||||
|
||||
netprocess.arguments = ["-setdnsservers", self.interface]
|
||||
|
||||
if oldDNSSettings.isEmpty {
|
||||
// networkmsetup uses "networksetup -setdnsservers <interface> Empty" to reset
|
||||
netprocess.arguments?.append("Empty")
|
||||
} else {
|
||||
netprocess.arguments?.append(contentsOf: oldDNSSettings)
|
||||
}
|
||||
|
||||
do {
|
||||
try netprocess.run()
|
||||
print("Resetting DNS Settings to \(self.oldDNSSettings)")
|
||||
} catch {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
init(interface: String) {
|
||||
self.interface = interface
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.productivity</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2019 Loki. All rights reserved.</string>
|
||||
<key>NSMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,37 @@
|
||||
//
|
||||
// LokinetLog.swift
|
||||
// lokinet
|
||||
//
|
||||
// Copyright © 2019 Loki. All rights reserved.
|
||||
//
|
||||
|
||||
import AppKit
|
||||
|
||||
class LokinetLogController : NSViewController {
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
var log: LokinetLog {
|
||||
get {
|
||||
// this is walking down the UI stack.
|
||||
// TODO: work out a better way of doing this
|
||||
let scroll = self.view.subviews[0] as! NSScrollView
|
||||
let clip = scroll.subviews[0] as! NSClipView
|
||||
let log = clip.subviews[0] as! LokinetLog
|
||||
return log
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protocol Appendable {
|
||||
func append(string: String)
|
||||
}
|
||||
|
||||
final class LokinetLog : NSTextView, Appendable {
|
||||
func append(string: String) {
|
||||
self.textStorage?.append(NSAttributedString(string: string + "\n"))
|
||||
self.scrollToEndOfDocument(nil)
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
//
|
||||
// LokinetRunner.swift
|
||||
// lokinet
|
||||
//
|
||||
// Copyright © 2019 Loki. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Cocoa
|
||||
|
||||
class LokinetRunner {
|
||||
let dnsManager: DNSManager
|
||||
let lokinetPath: URL
|
||||
var process = Process()
|
||||
|
||||
var logAppender: Appendable? = nil
|
||||
|
||||
init(interface: String, path: String) {
|
||||
self.lokinetPath = URL(fileURLWithPath: path)
|
||||
self.dnsManager = DNSManager(interface: interface)
|
||||
}
|
||||
|
||||
func start() {
|
||||
process.executableURL = self.lokinetPath
|
||||
process.arguments = ["--colour=false"]
|
||||
let outputPipe = Pipe()
|
||||
process.standardOutput = outputPipe
|
||||
process.standardError = outputPipe
|
||||
|
||||
do {
|
||||
try self.dnsManager.setNewSettings()
|
||||
try process.run()
|
||||
} catch {
|
||||
NSApp.presentError(error)
|
||||
}
|
||||
|
||||
guard let reader = StreamReader(fh: outputPipe.fileHandleForReading) else {
|
||||
let err = NSError(domain: "lokinet", code: 0, userInfo: ["msg": "Failed to read from filehandle"])
|
||||
NSApp.presentError(err)
|
||||
return
|
||||
}
|
||||
|
||||
DispatchQueue.global(qos: .background).async {
|
||||
for line in reader {
|
||||
print(line)
|
||||
DispatchQueue.main.async {
|
||||
self.logAppender?.append(string: line)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func stop() {
|
||||
if process.isRunning {
|
||||
process.terminate()
|
||||
process.waitUntilExit()
|
||||
}
|
||||
dnsManager.restoreOldSettings()
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
//
|
||||
// StreamReader.swift
|
||||
// lokinet
|
||||
//
|
||||
// Copyright © 2019 Loki. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final class StreamReader {
|
||||
let encoding : String.Encoding
|
||||
let chunkSize : Int
|
||||
|
||||
var fileHandle : FileHandle!
|
||||
var buffer : Data
|
||||
let delimData : Data
|
||||
var atEof : Bool = false
|
||||
|
||||
init?(fh: FileHandle, delimiter: String = "\n", encoding : String.Encoding = .utf8, chunkSize : Int = 4096) {
|
||||
self.chunkSize = chunkSize
|
||||
self.encoding = encoding
|
||||
self.fileHandle = fh
|
||||
|
||||
guard let delimData = delimiter.data(using: encoding) else {
|
||||
return nil
|
||||
}
|
||||
self.delimData = delimData
|
||||
self.buffer = Data(capacity: chunkSize)
|
||||
}
|
||||
|
||||
/// Return next line, or nil on EOF.
|
||||
func nextLine() -> String? {
|
||||
precondition(fileHandle != nil, "Attempt to read from closed file")
|
||||
|
||||
if atEof {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Read data chunks from file until a line delimiter is found:
|
||||
while !atEof {
|
||||
if let range = buffer.range(of: delimData) {
|
||||
// Convert complete line (excluding the delimiter) to a string:
|
||||
let line = String(data: buffer.subdata(in: 0..<range.lowerBound), encoding: encoding)
|
||||
// Remove line (and the delimiter) from the buffer:
|
||||
buffer.removeSubrange(0..<range.upperBound)
|
||||
return line
|
||||
}
|
||||
let tmpData = fileHandle.readData(ofLength: chunkSize)
|
||||
if tmpData.count > 0 {
|
||||
buffer.append(tmpData)
|
||||
} else {
|
||||
// EOF or read error.
|
||||
atEof = true
|
||||
if buffer.count > 0 {
|
||||
// Buffer contains last line in file (not terminated by delimiter).
|
||||
let line = String(data: buffer as Data, encoding: encoding)
|
||||
buffer.count = 0
|
||||
return line
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
extension StreamReader : Sequence {
|
||||
func makeIterator() -> AnyIterator<String> {
|
||||
return AnyIterator {
|
||||
return self.nextLine()
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array/>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,33 @@
|
||||
//
|
||||
// lokinetTests.swift
|
||||
// lokinetTests
|
||||
//
|
||||
// Copyright © 2019 Loki. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import lokinet
|
||||
|
||||
class lokinetTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measure {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,8 @@
|
||||
mbedtls*.tgz*
|
||||
mbedtls-*/
|
||||
curl*.tar.xz*
|
||||
curl-*/
|
||||
include/
|
||||
lib/
|
||||
*.pem
|
||||
LICENSE
|
Binary file not shown.
@ -0,0 +1,50 @@
|
||||
# Makefile for windows install pkg and helper library
|
||||
|
||||
CC=i686-w64-mingw32-gcc
|
||||
CXX=i686-w64-mingw32-g++
|
||||
CFLAGS=-Ofast -march=nocona -mfpmath=sse
|
||||
LIBS=-lws2_32
|
||||
LDFLAGS=-static
|
||||
|
||||
ifndef RELEASE
|
||||
all: regdbhelper.dll lokinet-bootstrap.exe
|
||||
default: all
|
||||
|
||||
regdbhelper.dll:
|
||||
i686-w64-mingw32-gcc regdb_helper.c -o $@ -shared -Os -s
|
||||
|
||||
mbedtls:
|
||||
wget https://tls.mbed.org/download/mbedtls-2.16.3-apache.tgz
|
||||
tar xvf mbedtls-2.16.3-apache.tgz
|
||||
patch -p0 -d mbedtls-2.16.3 < mbedtls-win32.patch
|
||||
$(MAKE) -j4 -C mbedtls-2.16.3/library CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS)" LDFLAGS=$(LIBS)
|
||||
mkdir -p lib; mkdir -p include
|
||||
cp mbedtls-2.16.3/library/*.a lib
|
||||
cp -r mbedtls-2.16.3/include/mbedtls include
|
||||
|
||||
curl:
|
||||
wget https://curl.haxx.se/download/curl-7.66.0.tar.xz
|
||||
tar xvf curl-7.66.0.tar.xz
|
||||
patch -p1 < curl-win32.patch
|
||||
cd curl-7.66.0; ./configure --host=i686-w64-mingw32 --target=i686-w64-mingw32 CC=$(CC) CXX=$(CXX) CFLAGS="$(CFLAGS)" LIBS=$(LIBS) --disable-shared --without-zlib --without-ssl --with-mbedtls=$(PWD) --enable-optimize --enable-http --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --enable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --enable-manual
|
||||
$(MAKE) -j4 -C curl-7.66.0
|
||||
|
||||
lokinet-bootstrap.exe: mbedtls curl
|
||||
cp curl-7.66.0/src/curl.exe $@
|
||||
wget -O rootcerts.pem https://curl.haxx.se/ca/cacert.pem
|
||||
cp ../LICENSE .;unix2dos LICENSE LICENSE
|
||||
else
|
||||
|
||||
all: regdbhelper.dll lokinet-bootstrap.exe
|
||||
|
||||
regdbhelper.dll:
|
||||
scp despair@10.10.10.6:loki-network/win32-setup/*.dll .
|
||||
|
||||
lokinet-bootstrap.exe:
|
||||
scp despair@10.10.10.6:loki-network/win32-setup/*.exe .
|
||||
wget -O rootcerts.pem https://curl.haxx.se/ca/cacert.pem
|
||||
cp ../LICENSE .;unix2dos LICENSE LICENSE
|
||||
endif
|
||||
|
||||
clean:
|
||||
-rm -rf curl-7* include lib mbedtls-2* *.exe *.dll *.pem
|
@ -0,0 +1,82 @@
|
||||
diff --git a/curl-7.66.0/include/curl/curl.h b/curl-patched/include/curl/curl.h
|
||||
index ff0c7749..4d3fdbb5 100644
|
||||
--- a/curl-7.66.0/include/curl/curl.h
|
||||
+++ b/curl-patched/include/curl/curl.h
|
||||
@@ -65,6 +65,7 @@
|
||||
included, since they can't co-exist without problems */
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
+#include <wspiapi.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
diff --git a/curl-7.66.0/include/curl/system.h b/curl-patched/include/curl/system.h
|
||||
index cd37c2bf..b96cfd8c 100644
|
||||
--- a/curl-7.66.0/include/curl/system.h
|
||||
+++ b/curl-patched/include/curl/system.h
|
||||
@@ -411,6 +411,7 @@
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
# include <ws2tcpip.h>
|
||||
+# include <wspiapi.h>
|
||||
#endif
|
||||
|
||||
/* CURL_PULL_SYS_TYPES_H is defined above when inclusion of header file */
|
||||
diff --git a/curl-7.66.0/lib/curl_setup.h b/curl-patched/lib/curl_setup.h
|
||||
index 13af8cde..a0408d5c 100644
|
||||
--- a/curl-7.66.0/lib/curl_setup.h
|
||||
+++ b/curl-patched/lib/curl_setup.h
|
||||
@@ -255,6 +255,7 @@
|
||||
# include <winsock2.h>
|
||||
# ifdef HAVE_WS2TCPIP_H
|
||||
# include <ws2tcpip.h>
|
||||
+# include <wspiapi.h>
|
||||
# endif
|
||||
# else
|
||||
# ifdef HAVE_WINSOCK_H
|
||||
diff --git a/curl-7.66.0/lib/inet_pton.h b/curl-patched/lib/inet_pton.h
|
||||
index 0209b9b7..67774fb9 100644
|
||||
--- a/curl-7.66.0/lib/inet_pton.h
|
||||
+++ b/curl-patched/lib/inet_pton.h
|
||||
@@ -32,6 +32,7 @@ int Curl_inet_pton(int, const char *, void *);
|
||||
#elif defined(HAVE_WS2TCPIP_H)
|
||||
/* inet_pton() exists in Vista or later */
|
||||
#include <ws2tcpip.h>
|
||||
+#include <wspiapi.h>
|
||||
#endif
|
||||
#define Curl_inet_pton(x,y,z) inet_pton(x,y,z)
|
||||
#endif
|
||||
diff --git a/curl-7.66.0/src/tool_util.c b/curl-patched/src/tool_util.c
|
||||
index 9990a463..8ea37f37 100644
|
||||
--- a/curl-7.66.0/src/tool_util.c
|
||||
+++ b/curl-patched/src/tool_util.c
|
||||
@@ -40,12 +40,7 @@ struct timeval tvnow(void)
|
||||
** is typically in the range of 10 milliseconds to 16 milliseconds.
|
||||
*/
|
||||
struct timeval now;
|
||||
-#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && \
|
||||
- (!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR))
|
||||
- ULONGLONG milliseconds = GetTickCount64();
|
||||
-#else
|
||||
DWORD milliseconds = GetTickCount();
|
||||
-#endif
|
||||
now.tv_sec = (long)(milliseconds / 1000);
|
||||
now.tv_usec = (long)((milliseconds % 1000) * 1000);
|
||||
return now;
|
||||
diff --git a/curl-7.66.0/tests/server/util.c b/curl-patched/tests/server/util.c
|
||||
index b0613380..00d0b0c3 100644
|
||||
--- a/curl-7.66.0/tests/server/util.c
|
||||
+++ b/curl-patched/tests/server/util.c
|
||||
@@ -415,12 +415,7 @@ static struct timeval tvnow(void)
|
||||
** is typically in the range of 10 milliseconds to 16 milliseconds.
|
||||
*/
|
||||
struct timeval now;
|
||||
-#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600) && \
|
||||
- (!defined(__MINGW32__) || defined(__MINGW64_VERSION_MAJOR))
|
||||
- ULONGLONG milliseconds = GetTickCount64();
|
||||
-#else
|
||||
DWORD milliseconds = GetTickCount();
|
||||
-#endif
|
||||
now.tv_sec = (long)(milliseconds / 1000);
|
||||
now.tv_usec = (long)((milliseconds % 1000) * 1000);
|
||||
return now;
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue