1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

Merge branch 'dev' into dev

This commit is contained in:
Jeff 2019-09-25 10:37:57 -04:00 committed by GitHub
commit 3c2b2ce34d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 1532 additions and 24 deletions

9
.gitignore vendored
View file

@ -60,6 +60,9 @@ GTAGS
GRTAGS
GPATH
version.txt
lokinet-bootstrap.exe
regdbhelper.dll
lokinet-bootstrap.exe
regdbhelper.dll
# xcode
xcuserdata/

View file

@ -2,6 +2,7 @@
#include <llarp.h>
#include <util/fs.hpp>
#include <util/logging/logger.hpp>
#include <util/logging/ostream_logger.hpp>
#include <csignal>
@ -136,6 +137,7 @@ main(int argc, char *argv[])
("g,generate", "generate client config", cxxopts::value<bool>())
("r,router", "generate router config", cxxopts::value<bool>())
("f,force", "overwrite", cxxopts::value<bool>())
("c,colour", "colour output", cxxopts::value<bool>()->default_value("true"))
("d,debug", "debug mode - UNENCRYPTED TRAFFIC", cxxopts::value<bool>())
("config","path to configuration file", cxxopts::value<std::string>());
@ -158,6 +160,12 @@ main(int argc, char *argv[])
llarp::LogDebug("debug logging activated");
}
if(!result["colour"].as< bool >())
{
llarp::LogContext::Instance().logStream =
std::make_unique< llarp::OStreamLogStream >(false, std::cerr);
}
if(result.count("help"))
{
std::cout << options.help() << std::endl;

View file

@ -55,6 +55,7 @@ main(int argc, char* argv[])
options.add_options()
("v,verbose", "Verbose", cxxopts::value<bool>())
("c,colour", "colour output", cxxopts::value<bool>()->default_value("true"))
("h,help", "help", cxxopts::value<bool>())
("j,json", "output in json", cxxopts::value<bool>())
("dump", "dump rc file", cxxopts::value<std::vector<std::string> >(), "FILE");
@ -70,7 +71,8 @@ main(int argc, char* argv[])
{
SetLogLevel(llarp::eLogDebug);
llarp::LogContext::Instance().logStream =
std::make_unique< llarp::OStreamLogStream >(std::cerr);
std::make_unique< llarp::OStreamLogStream >(
result["colour"].as< bool >(), std::cerr);
llarp::LogDebug("debug logging activated");
}

View file

@ -19,7 +19,7 @@ namespace llarp
#define _LOGSTREAM_INIT
#else
using Stream_t = OStreamLogStream;
#define _LOGSTREAM_INIT std::cout
#define _LOGSTREAM_INIT true, std::cout
#endif
#endif

View file

@ -3,7 +3,8 @@
namespace llarp
{
OStreamLogStream::OStreamLogStream(std::ostream& out) : m_Out(out)
OStreamLogStream::OStreamLogStream(bool withColours, std::ostream& out)
: m_withColours(withColours), m_Out(out)
{
}
@ -12,22 +13,25 @@ namespace llarp
const char* fname, int lineno,
const std::string& nodename) const
{
switch(lvl)
if(m_withColours)
{
case eLogNone:
break;
case eLogDebug:
ss << (char)27 << "[0m";
break;
case eLogInfo:
ss << (char)27 << "[1m";
break;
case eLogWarn:
ss << (char)27 << "[1;33m";
break;
case eLogError:
ss << (char)27 << "[1;31m";
break;
switch(lvl)
{
case eLogNone:
break;
case eLogDebug:
ss << (char)27 << "[0m";
break;
case eLogInfo:
ss << (char)27 << "[1m";
break;
case eLogWarn:
ss << (char)27 << "[1;33m";
break;
case eLogError:
ss << (char)27 << "[1;31m";
break;
}
}
ss << "[" << LogLevelToString(lvl) << "] ";
ss << "[" << nodename << "]"
@ -38,7 +42,9 @@ namespace llarp
void
OStreamLogStream::PostLog(std::stringstream& ss) const
{
ss << (char)27 << "[0;0m" << std::endl;
if(m_withColours)
ss << (char)27 << "[0;0m";
ss << std::endl;
}
void

View file

@ -8,7 +8,7 @@ namespace llarp
{
struct OStreamLogStream : public ILogStream
{
OStreamLogStream(std::ostream& out);
OStreamLogStream(bool withColours, std::ostream& out);
~OStreamLogStream() override = default;
@ -27,6 +27,7 @@ namespace llarp
}
private:
bool m_withColours;
std::ostream& m_Out;
};
} // namespace llarp

View file

@ -8,7 +8,7 @@ static short old_attrs;
namespace llarp
{
Win32LogStream::Win32LogStream(std::ostream& out)
: OStreamLogStream(out), m_Out(out)
: OStreamLogStream(true, out), m_Out(out)
{
// Attempt to use ANSI escapes directly
// if the modern console is active.

View file

@ -0,0 +1,621 @@
// !$*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 */; };
7BED5B7A232D78D900DF603F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BED5B79232D78D900DF603F /* AppDelegate.swift */; };
7BED5B7C232D78D900DF603F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BED5B7B232D78D900DF603F /* ViewController.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>"; };
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>"; };
7BED5B7B232D78D900DF603F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.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 = (
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 */,
7BED5B7B232D78D900DF603F /* ViewController.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 */,
);
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 */,
7BED5B7C232D78D900DF603F /* ViewController.swift in Sources */,
7BED5BA6232E7E6600DF603F /* LokinetLog.swift in Sources */,
7B28BD1A232EA8B40073B955 /* DNSManager.swift in Sources */,
7B28BD1C232EB6EF0073B955 /* LokinetRunner.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_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_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;
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;
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 */;
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:lokinet.xcodeproj">
</FileRef>
</Workspace>

View file

@ -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>

View file

@ -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>

View file

@ -0,0 +1,23 @@
//
// AppDelegate.swift
// lokinet
//
// Copyright © 2019 Loki. All rights reserved.
//
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
}

View file

@ -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"
}
}

View file

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View file

@ -0,0 +1,226 @@
<?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" initialViewController="B8D-0N-5wS">
<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"/>
<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="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="toggleToolbarShown:" target="Ady-hI-5gd" id="BXY-wc-z0C"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runToolbarCustomizationPalette:" target="Ady-hI-5gd" id="pQI-g3-MTW"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleSidebar:" target="Ady-hI-5gd" id="iwa-gc-5KM"/>
</connections>
</menuItem>
<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="75" y="0.0"/>
</scene>
<!--Window Controller-->
<scene sceneID="R2V-B0-nI4">
<objects>
<windowController id="B8D-0N-5wS" sceneMemberID="viewController">
<window key="window" title="lokinet" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="IQv-IB-iLA" userLabel="lokinet">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
<toolbar key="toolbar" implicitIdentifier="15556861-12B2-41A2-94F3-EC481E1D2BCA" autosavesConfiguration="NO" displayMode="iconAndLabel" sizeMode="regular" id="m54-Gk-RXu">
<allowedToolbarItems>
<toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="YLq-u5-F2C"/>
<toolbarItem implicitItemIdentifier="D19F1556-B143-4AE3-8753-40097BAF14EB" label="Start" paletteLabel="Start Item" tag="-1" image="NSGoForwardTemplate" id="RL6-BS-Pmv">
<size key="minSize" width="4" height="15"/>
<size key="maxSize" width="4" height="15"/>
</toolbarItem>
<toolbarItem implicitItemIdentifier="59F36847-628F-4613-A690-9E9C3CA18DC3" label="Stop" paletteLabel="Stop Item" tag="-1" image="NSStopProgressTemplate" id="KxD-EA-GZ9">
<size key="minSize" width="11" height="11"/>
<size key="maxSize" width="11" height="11"/>
</toolbarItem>
</allowedToolbarItems>
<defaultToolbarItems>
<toolbarItem reference="RL6-BS-Pmv"/>
<toolbarItem reference="YLq-u5-F2C"/>
<toolbarItem reference="KxD-EA-GZ9"/>
</defaultToolbarItems>
</toolbar>
<connections>
<outlet property="delegate" destination="B8D-0N-5wS" id="98r-iN-zZc"/>
</connections>
</window>
<connections>
<segue destination="XfG-lQ-9wD" kind="relationship" relationship="window.shadowedContentViewController" id="cq2-FE-JQM"/>
</connections>
</windowController>
<customObject id="Oky-zY-oP4" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="250"/>
</scene>
<!--View Controller-->
<scene sceneID="hIz-AP-VOD">
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="lokinet" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" horizontalScrollElasticity="allowed" verticalScrollElasticity="allowed" translatesAutoresizingMaskIntoConstraints="NO" id="h6o-Zr-Gxr">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="rbl-Lx-Aom">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView identifier="logView" ambiguous="YES" editable="NO" importsGraphics="NO" verticallyResizable="YES" findStyle="bar" incrementalSearchingEnabled="YES" smartInsertDelete="YES" id="L9a-we-bXA" customClass="LokinetLog" customModule="lokinet">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="textColor" name="systemGreenColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="systemGrayColor" catalog="System" colorSpace="catalog"/>
<size key="minSize" width="480" height="270"/>
<size key="maxSize" width="797" height="10000000"/>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
</subviews>
<color key="backgroundColor" name="textColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="3eM-L0-C72">
<rect key="frame" x="0.0" y="262" width="480" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="9e5-C6-MIV">
<rect key="frame" x="464" y="0.0" width="16" height="270"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
</view>
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
</scene>
</scenes>
<resources>
<image name="NSGoForwardTemplate" width="9" height="12"/>
<image name="NSStopProgressTemplate" width="11" height="11"/>
</resources>
</document>

View file

@ -0,0 +1,72 @@
//
// 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 oldDNSSettings: [String]
let interface: String
static func getOldSettings(interface: String) -> [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)
return split(str: asStr).filter({$0 != "127.0.0.1"})
} catch {
return []
}
}
func setNewSettings() throws {
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]
netprocess.arguments?.append(contentsOf: oldDNSSettings)
do {
try netprocess.run()
print("Overriding DNS Settings of \(self.oldDNSSettings)")
} catch {
// do nothing
}
}
init(interface: String) {
self.interface = interface
self.oldDNSSettings = DNSManager.getOldSettings(interface: interface)
print("Overriding DNS Settings of \(self.oldDNSSettings)")
}
deinit {
restoreOldSettings()
}
}

View file

@ -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>

View file

@ -0,0 +1,32 @@
//
// LokinetLog.swift
// lokinet
//
// Copyright © 2019 Loki. All rights reserved.
//
import AppKit
final class LokinetLog : NSTextView {
var runner: LokinetRunner?
override init(frame: NSRect, textContainer: NSTextContainer?) {
super.init(frame: frame, textContainer: textContainer)
self.runner = LokinetRunner(window: self, interface: "Wi-Fi")
self.runner?.start()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
self.runner = LokinetRunner(window: self, interface: "Wi-Fi")
self.runner?.start()
}
func append(string: String) {
self.textStorage?.append(NSAttributedString(string: string + "\n"))
self.scrollToEndOfDocument(nil)
}
}

View file

@ -0,0 +1,76 @@
//
// LokinetRunner.swift
// lokinet
//
// Copyright © 2019 Loki. All rights reserved.
//
import Foundation
class LokinetRunner {
static let PATH_KEY = "lokinetPath"
static let DEFAULT_PATH = URL(fileURLWithPath: "/usr/local/bin/lokinet")
var lokinetPath: URL?
var process = Process()
let dnsManager: DNSManager
weak var window: LokinetLog?
init(window: LokinetLog, interface: String) {
self.dnsManager = DNSManager(interface: interface)
self.window = window
configure()
}
func configure() {
let defaults = UserDefaults.standard;
self.lokinetPath = defaults.url(forKey: LokinetRunner.PATH_KEY) ?? LokinetRunner.DEFAULT_PATH
defaults.set(self.lokinetPath, forKey: LokinetRunner.PATH_KEY)
}
func enableDNS() {
do {
try dnsManager.setNewSettings()
} catch {
self.window?.presentError(error)
}
}
func start() {
process.executableURL = self.lokinetPath
process.arguments = ["--colour=false"]
let outputPipe = Pipe()
process.standardOutput = outputPipe
process.standardError = outputPipe
do {
try process.run()
} catch {
self.window?.presentError(error)
}
guard let reader = StreamReader(fh: outputPipe.fileHandleForReading) else {
let err = NSError(domain: "lokinet", code: 0, userInfo: ["msg": "Failed to read from filehandle"])
self.window?.presentError(err)
return
}
DispatchQueue.global(qos: .background).async {
for line in reader {
DispatchQueue.main.async {
self.window?.append(string: line)
}
}
}
enableDNS()
}
deinit {
if process.isRunning {
process.terminate()
process.waitUntilExit()
}
}
}

View file

@ -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()
}
}
}

View file

@ -0,0 +1,22 @@
//
// ViewController.swift
// lokinet
//
// Copyright © 2019 Loki. All rights reserved.
//
import Cocoa
class ViewController: NSViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
}

View file

@ -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>

View file

@ -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>

View file

@ -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.
}
}
}

View file

@ -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>

View file

@ -0,0 +1,33 @@
//
// lokinetUITests.swift
// lokinetUITests
//
// Copyright © 2019 Loki. All rights reserved.
//
import XCTest
class lokinetUITests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
// In UI tests its important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}