mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-24 18:25:20 +00:00
Compare commits
111 Commits
Author | SHA1 | Date | |
---|---|---|---|
43b2bf6c16 | |||
aceb938e07 | |||
68f44fb932 | |||
e38619dd02 | |||
4ec7cd2760 | |||
b0277ab904 | |||
87b26b0aaf | |||
01d13c153d | |||
c17082a4f8 | |||
9acfd3eb73 | |||
0ad84b8723 | |||
3f912eb4ad | |||
f1b45f7df0 | |||
29c18d4bde | |||
33728840ec | |||
cd339486b7 | |||
e54a34d8dd | |||
d24b192f8c | |||
0442d7e2d6 | |||
5b97bb247e | |||
8a7486577a | |||
6d17993eb6 | |||
d0e5da2884 | |||
d5b50ee466 | |||
8031fe00c7 | |||
3f6152806f | |||
7fdca150a9 | |||
165de71754 | |||
6b1a4b6e64 | |||
aaf0ef6b19 | |||
fb2745ba3b | |||
d452ed7db8 | |||
8f5cd0a361 | |||
d7bc3c6f4a | |||
d04e5a1fe0 | |||
bf5f09a0c7 | |||
a154d660d9 | |||
7a49d50187 | |||
ce0bd93289 | |||
0fdefdf7a4 | |||
8236f20759 | |||
e16b2a8831 | |||
f7fbc6f633 | |||
3a9b0cf132 | |||
2a3e646b94 | |||
64231aa3f0 | |||
117e6fb356 | |||
03ea06fa84 | |||
525ab3faa9 | |||
490e86dde3 | |||
6e076e77d8 | |||
d75f2f7051 | |||
aa1be9fcad | |||
17796aaed4 | |||
2355fa973e | |||
694e9f2bdc | |||
372566295e | |||
4e85213473 | |||
d6a346ca6e | |||
8b65b3e6d7 | |||
ffffc0179f | |||
f80ec871f6 | |||
e0cb5caef2 | |||
afbbf61588 | |||
28665079a0 | |||
80997f652b | |||
9d67a02b5f | |||
22efa1ab53 | |||
f19d1e253a | |||
b65f7f7895 | |||
fb49d2ced9 | |||
434ce96f2c | |||
6ae2c5f5c7 | |||
6f4e494e06 | |||
eb554a504d | |||
8771418170 | |||
2f37ea842f | |||
9232ba1da0 | |||
a0916b926f | |||
2da6a7570b | |||
2498ecbc84 | |||
4935fdf6e4 | |||
370dd6c4da | |||
06ca24e8e2 | |||
c4425c836a | |||
f0dd90d9d7 | |||
6bc5a84a2d | |||
3375363d93 | |||
fbb40b98ad | |||
a365a0e3ba | |||
45c5b66e9e | |||
f303c24d3c | |||
3d4762eab3 | |||
a5896264fa | |||
4d1cca1150 | |||
092e6e947e | |||
07f505971c | |||
7eccc5ebf2 | |||
dab124dfb9 | |||
8be664cca9 | |||
866edd41a7 | |||
412f93122d | |||
3201d1d493 | |||
9df7f65dd5 | |||
e23be8c91a | |||
99c384e110 | |||
49076d406e | |||
9e491decc0 | |||
ad77d9b014 | |||
4788d911ad | |||
80ea7db9c0 |
24
.gitignore
vendored
24
.gitignore
vendored
@ -9,19 +9,13 @@
|
||||
/netconf-service/netconf-test
|
||||
/netconf-service/netconf.service
|
||||
/ipch
|
||||
/ZeroTierOne.sdf
|
||||
/ZeroTierOne.v11.suo
|
||||
/vsprojects/SelfTest/Debug
|
||||
/vsprojects/SelfTest/Release
|
||||
/vsprojects/ZeroTierOne/Debug
|
||||
/vsprojects/ZeroTierOne/Release
|
||||
/vsprojects/ZeroTierOne/x64
|
||||
/vsprojects/TapDriver/Win32
|
||||
/vsprojects/TapDriver/x64
|
||||
/vsprojects/InstallerUpdater/obj
|
||||
/vsprojects/Service/obj
|
||||
/vsprojects/SelfTest/SelfTest.aps
|
||||
/Build/*
|
||||
/windows/ZeroTierOne.sdf
|
||||
/windows/ZeroTierOne.v11.suo
|
||||
/windows/*/x64
|
||||
/windows/*/Win32
|
||||
/windows/ZeroTierOneService/obj
|
||||
/windows/ZeroTierOneService/bin
|
||||
/windows/Build
|
||||
*.log
|
||||
*.opensdf
|
||||
*.user
|
||||
@ -32,3 +26,7 @@
|
||||
/ZeroTierOneInstaller-*
|
||||
.qmake.stash
|
||||
*.autosave
|
||||
/ZeroTier One.zip
|
||||
/ZeroTier One.dmg
|
||||
/windows/x64
|
||||
/windows/ZeroTierOneInstaller/ZeroTierOneInstaller
|
||||
|
BIN
ZeroTierUI/ZT1GUI.png
Normal file
BIN
ZeroTierUI/ZT1GUI.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
ZeroTierUI/ZT1GUI.xcf
Normal file
BIN
ZeroTierUI/ZT1GUI.xcf
Normal file
Binary file not shown.
@ -3,99 +3,118 @@ TARGET = "ZeroTier One"
|
||||
TEMPLATE = app
|
||||
|
||||
win32:RC_FILE = ZeroTierUI.rc
|
||||
win32:LIBS += winhttp.lib Iphlpapi.lib ws2_32.lib advapi32.lib Shell32.lib Rpcrt4.lib
|
||||
win32:QMAKE_LFLAGS += /MANIFESTUAC:\"level=\'requireAdministrator\' uiAccess=\'false\'\"
|
||||
|
||||
mac:ICON = zt1icon.icns
|
||||
mac:QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6
|
||||
mac:QMAKE_INFO_PLIST = Info.plist
|
||||
mac:LIBS += -framework Cocoa
|
||||
|
||||
SOURCES += main.cpp\
|
||||
mainwindow.cpp \
|
||||
aboutwindow.cpp \
|
||||
../node/C25519.cpp \
|
||||
../node/CertificateOfMembership.cpp \
|
||||
../node/Defaults.cpp \
|
||||
../node/Demarc.cpp \
|
||||
../node/EthernetTap.cpp \
|
||||
../node/HttpClient.cpp \
|
||||
../node/Identity.cpp \
|
||||
../node/InetAddress.cpp \
|
||||
../node/Logger.cpp \
|
||||
../node/Multicaster.cpp \
|
||||
../node/Network.cpp \
|
||||
../node/NetworkConfig.cpp \
|
||||
../node/Node.cpp \
|
||||
../node/NodeConfig.cpp \
|
||||
../node/Packet.cpp \
|
||||
../node/PacketDecoder.cpp \
|
||||
../node/Peer.cpp \
|
||||
../node/Poly1305.cpp \
|
||||
../node/Salsa20.cpp \
|
||||
../node/Service.cpp \
|
||||
../node/SHA512.cpp \
|
||||
../node/SoftwareUpdater.cpp \
|
||||
../node/Switch.cpp \
|
||||
../node/SysEnv.cpp \
|
||||
../node/Topology.cpp \
|
||||
../node/UdpSocket.cpp \
|
||||
../node/Utils.cpp \
|
||||
../ext/lz4/lz4.c \
|
||||
../ext/lz4/lz4hc.c \
|
||||
networkwidget.cpp \
|
||||
installdialog.cpp
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp \
|
||||
aboutwindow.cpp \
|
||||
../node/C25519.cpp \
|
||||
../node/CertificateOfMembership.cpp \
|
||||
../node/Defaults.cpp \
|
||||
../node/Demarc.cpp \
|
||||
../node/EthernetTap.cpp \
|
||||
../node/HttpClient.cpp \
|
||||
../node/Identity.cpp \
|
||||
../node/InetAddress.cpp \
|
||||
../node/Logger.cpp \
|
||||
../node/Multicaster.cpp \
|
||||
../node/Network.cpp \
|
||||
../node/NetworkConfig.cpp \
|
||||
../node/Node.cpp \
|
||||
../node/NodeConfig.cpp \
|
||||
../node/Packet.cpp \
|
||||
../node/PacketDecoder.cpp \
|
||||
../node/Peer.cpp \
|
||||
../node/Poly1305.cpp \
|
||||
../node/Salsa20.cpp \
|
||||
../node/Service.cpp \
|
||||
../node/SHA512.cpp \
|
||||
../node/SoftwareUpdater.cpp \
|
||||
../node/Switch.cpp \
|
||||
../node/SysEnv.cpp \
|
||||
../node/Topology.cpp \
|
||||
../node/UdpSocket.cpp \
|
||||
../node/Utils.cpp \
|
||||
../ext/lz4/lz4.c \
|
||||
../ext/lz4/lz4hc.c \
|
||||
networkwidget.cpp \
|
||||
installdialog.cpp \
|
||||
licensedialog.cpp \
|
||||
onetimedialog.cpp
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
aboutwindow.h \
|
||||
../node/Node.hpp \
|
||||
../node/Utils.hpp \
|
||||
../node/Defaults.hpp \
|
||||
../node/Address.hpp \
|
||||
../node/Array.hpp \
|
||||
../node/AtomicCounter.hpp \
|
||||
../node/BandwidthAccount.hpp \
|
||||
../node/Buffer.hpp \
|
||||
../node/C25519.hpp \
|
||||
../node/CertificateOfMembership.hpp \
|
||||
../node/CMWC4096.hpp \
|
||||
../node/Condition.hpp \
|
||||
../node/Constants.hpp \
|
||||
../node/Demarc.hpp \
|
||||
../node/Dictionary.hpp \
|
||||
../node/EthernetTap.hpp \
|
||||
../node/HttpClient.hpp \
|
||||
../node/Identity.hpp \
|
||||
../node/InetAddress.hpp \
|
||||
../node/Logger.hpp \
|
||||
../node/MAC.hpp \
|
||||
../node/Multicaster.hpp \
|
||||
../node/MulticastGroup.hpp \
|
||||
../node/Mutex.hpp \
|
||||
../node/Network.hpp \
|
||||
../node/NetworkConfig.hpp \
|
||||
../node/NodeConfig.hpp \
|
||||
../node/NonCopyable.hpp \
|
||||
../node/Packet.hpp \
|
||||
../node/PacketDecoder.hpp \
|
||||
../node/Peer.hpp \
|
||||
../node/Poly1305.hpp \
|
||||
../node/RuntimeEnvironment.hpp \
|
||||
../node/Salsa20.hpp \
|
||||
../node/Service.hpp \
|
||||
../node/SHA512.hpp \
|
||||
../node/SharedPtr.hpp \
|
||||
../node/SoftwareUpdater.hpp \
|
||||
../node/Switch.hpp \
|
||||
../node/SysEnv.hpp \
|
||||
../node/Thread.hpp \
|
||||
../node/Topology.hpp \
|
||||
../node/UdpSocket.hpp \
|
||||
../ext/lz4/lz4.h \
|
||||
../ext/lz4/lz4hc.h \
|
||||
networkwidget.h \
|
||||
installdialog.h
|
||||
aboutwindow.h \
|
||||
../node/Node.hpp \
|
||||
../node/Utils.hpp \
|
||||
../node/Defaults.hpp \
|
||||
../node/Address.hpp \
|
||||
../node/Array.hpp \
|
||||
../node/AtomicCounter.hpp \
|
||||
../node/BandwidthAccount.hpp \
|
||||
../node/Buffer.hpp \
|
||||
../node/C25519.hpp \
|
||||
../node/CertificateOfMembership.hpp \
|
||||
../node/CMWC4096.hpp \
|
||||
../node/Condition.hpp \
|
||||
../node/Constants.hpp \
|
||||
../node/Demarc.hpp \
|
||||
../node/Dictionary.hpp \
|
||||
../node/EthernetTap.hpp \
|
||||
../node/HttpClient.hpp \
|
||||
../node/Identity.hpp \
|
||||
../node/InetAddress.hpp \
|
||||
../node/Logger.hpp \
|
||||
../node/MAC.hpp \
|
||||
../node/Multicaster.hpp \
|
||||
../node/MulticastGroup.hpp \
|
||||
../node/Mutex.hpp \
|
||||
../node/Network.hpp \
|
||||
../node/NetworkConfig.hpp \
|
||||
../node/NodeConfig.hpp \
|
||||
../node/NonCopyable.hpp \
|
||||
../node/Packet.hpp \
|
||||
../node/PacketDecoder.hpp \
|
||||
../node/Peer.hpp \
|
||||
../node/Poly1305.hpp \
|
||||
../node/RuntimeEnvironment.hpp \
|
||||
../node/Salsa20.hpp \
|
||||
../node/Service.hpp \
|
||||
../node/SHA512.hpp \
|
||||
../node/SharedPtr.hpp \
|
||||
../node/SoftwareUpdater.hpp \
|
||||
../node/Switch.hpp \
|
||||
../node/SysEnv.hpp \
|
||||
../node/Thread.hpp \
|
||||
../node/Topology.hpp \
|
||||
../node/UdpSocket.hpp \
|
||||
../ext/lz4/lz4.h \
|
||||
../ext/lz4/lz4hc.h \
|
||||
networkwidget.h \
|
||||
installdialog.h \
|
||||
mac_doprivileged.h \
|
||||
licensedialog.h \
|
||||
main.h \
|
||||
onetimedialog.h
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
aboutwindow.ui \
|
||||
networkwidget.ui \
|
||||
installdialog.ui
|
||||
aboutwindow.ui \
|
||||
networkwidget.ui \
|
||||
installdialog.ui \
|
||||
licensedialog.ui \
|
||||
quickstartdialog.ui \
|
||||
onetimedialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
||||
|
||||
mac:OBJECTIVE_SOURCES += \
|
||||
mac_doprivileged.mm
|
||||
|
||||
OTHER_FILES += \
|
||||
stylesheet.css
|
||||
|
@ -29,7 +29,9 @@
|
||||
#include "ui_aboutwindow.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QFont>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Node.hpp"
|
||||
|
||||
AboutWindow::AboutWindow(QWidget *parent) :
|
||||
@ -37,7 +39,6 @@ AboutWindow::AboutWindow(QWidget *parent) :
|
||||
ui(new Ui::AboutWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->aboutTextLabel->setText(QString("ZeroTier One\nVersion ")+ZeroTier::Node::versionString()+"\nQt Graphical User Interface\n\n(c)2011-2014 ZeroTier Networks LLC\n\nReleased under the terms of the GNU\nGeneral Public License v3.0, see: http://gplv3.fsf.org for terms.\n\nAuthor(s): Adam Ierymenko");
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
|
@ -1,52 +0,0 @@
|
||||
<?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>CFBundleAllowMixedLocalizations</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.zerotier.one.ZeroTierOneMacAuthenticateScript</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>ZeroTier One (Authenticate)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>aplt</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
<dict>
|
||||
<key>x86_64</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) 2013-2014 ZeroTier Networks LLC</string>
|
||||
<key>WindowState</key>
|
||||
<dict>
|
||||
<key>dividerCollapsed</key>
|
||||
<false/>
|
||||
<key>eventLogLevel</key>
|
||||
<integer>-1</integer>
|
||||
<key>name</key>
|
||||
<string>ScriptWindowState</string>
|
||||
<key>positionOfDivider</key>
|
||||
<real>333</real>
|
||||
<key>savedFrame</key>
|
||||
<string>239 124 602 597 0 0 1280 778 </string>
|
||||
<key>selectedTabView</key>
|
||||
<string>event log</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
APPLaplt
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 362 B |
@ -1,4 +0,0 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1265
|
||||
{\fonttbl}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
<?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>CFBundleAllowMixedLocalizations</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>applet</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.zerotier.one.ZeroTierOneMacInstallScript</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>ZeroTier One (Authenticate)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>aplt</string>
|
||||
<key>LSMinimumSystemVersionByArchitecture</key>
|
||||
<dict>
|
||||
<key>x86_64</key>
|
||||
<string>10.6</string>
|
||||
</dict>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) 2013 ZeroTier Networks LLC</string>
|
||||
<key>WindowState</key>
|
||||
<dict>
|
||||
<key>dividerCollapsed</key>
|
||||
<false/>
|
||||
<key>eventLogLevel</key>
|
||||
<integer>-1</integer>
|
||||
<key>name</key>
|
||||
<string>ScriptWindowState</string>
|
||||
<key>positionOfDivider</key>
|
||||
<real>333</real>
|
||||
<key>savedFrame</key>
|
||||
<string>350 166 602 597 0 0 1920 1058 </string>
|
||||
<key>selectedTabView</key>
|
||||
<string>event log</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
APPLaplt
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 362 B |
@ -1,4 +0,0 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1265
|
||||
{\fonttbl}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
}
|
@ -38,9 +38,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "mac_doprivileged.h"
|
||||
#endif
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QMessageBox>
|
||||
#include <QByteArray>
|
||||
@ -50,7 +55,7 @@
|
||||
#include <QProcess>
|
||||
|
||||
InstallDialog::InstallDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::InstallDialog),
|
||||
nam(new QNetworkAccessManager(this)),
|
||||
phase(FETCHING_NFO)
|
||||
@ -103,45 +108,76 @@ void InstallDialog::on_networkReply(QNetworkReply *reply)
|
||||
} break;
|
||||
case FETCHING_INSTALLER: {
|
||||
if (!ZeroTier::SoftwareUpdater::validateUpdate(installerData.data(),installerData.length(),signedBy,signature)) {
|
||||
QMessageBox::critical(this,"Download Failed","Download failed: there is a problem with the software update web site.\nTry agian later. (failed signature check)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QMessageBox::critical(this,"Download Failed","Download failed: there is a problem with the software update web site. Try agian later. (downloaded data failed signature check)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
QString zt1Caches(QDir::homePath() + "/Library/Caches/ZeroTier/One");
|
||||
QDir::root().mkpath(zt1Caches);
|
||||
QString instPath(zt1Caches+"/ZeroTierOneInstaller");
|
||||
{
|
||||
std::string homePath(QDir::homePath().toStdString());
|
||||
QString zt1Caches(QDir::homePath() + "/Library/Caches/ZeroTier/One");
|
||||
QDir::root().mkpath(zt1Caches);
|
||||
std::string instPath((zt1Caches + "/ZeroTierOneInstaller").toStdString());
|
||||
std::string tmpPath((zt1Caches + "/inst.sh").toStdString());
|
||||
|
||||
int outfd = ::open(instPath.toStdString().c_str(),O_CREAT|O_TRUNC|O_WRONLY,0755);
|
||||
if (outfd <= 0) {
|
||||
QMessageBox::critical(this,"Download Failed",QString("Installation failed: unable to write to ")+instPath,QMessageBox::Ok,QMessageBox::NoButton);
|
||||
int outfd = ::open(instPath.c_str(),O_CREAT|O_TRUNC|O_WRONLY,0755);
|
||||
if (outfd <= 0) {
|
||||
QMessageBox::critical(this,"Download Failed",QString("Installation failed: unable to write to ")+instPath.c_str(),QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
if (::write(outfd,installerData.data(),installerData.length()) != installerData.length()) {
|
||||
QMessageBox::critical(this,"Installation Failed",QString("Installation failed: unable to write to ")+instPath.c_str(),QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
::close(outfd);
|
||||
chmod(instPath.c_str(),0755);
|
||||
|
||||
FILE *scr = fopen(tmpPath.c_str(),"w");
|
||||
if (!scr) {
|
||||
QMessageBox::critical(this,"Installation Failed","Cannot write script to temporary Library/Caches/ZeroTier/One folder.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(scr,"#!/bin/bash\n");
|
||||
fprintf(scr,"export PATH=\"/bin:/usr/bin:/sbin:/usr/sbin\"\n");
|
||||
fprintf(scr,"'%s'\n",instPath.c_str());
|
||||
fprintf(scr,"if [ -f '/Library/Application Support/ZeroTier/One/authtoken.secret' ]; then\n");
|
||||
fprintf(scr," mkdir -p '%s/Library/Application Support/ZeroTier/One'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0700 '%s/Library/Application Support/ZeroTier'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier/One'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier/One'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0700 '%s/Library/Application Support/ZeroTier/One'\n",homePath.c_str());
|
||||
fprintf(scr," cp -f '/Library/Application Support/ZeroTier/One/authtoken.secret' '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0600 '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",homePath.c_str());
|
||||
fprintf(scr,"fi\n");
|
||||
fprintf(scr,"exit 0\n");
|
||||
|
||||
fclose(scr);
|
||||
chmod(tmpPath.c_str(),0755);
|
||||
|
||||
macExecutePrivilegedShellCommand((std::string("'")+tmpPath+"' >>/dev/null 2>&1").c_str());
|
||||
|
||||
unlink(tmpPath.c_str());
|
||||
unlink(instPath.c_str());
|
||||
|
||||
// Restart the binary with whatever updates may have occurred
|
||||
std::string appPath(QCoreApplication::applicationFilePath().toStdString());
|
||||
execl(appPath.c_str(),appPath.c_str(),(const char *)0);
|
||||
|
||||
// We only make it here if execl() fails
|
||||
QMessageBox::critical(this,"Re-Launch Failed","An error occurred re-launching ZeroTier One.app. Try launching it manually.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
|
||||
return;
|
||||
}
|
||||
if (::write(outfd,installerData.data(),installerData.length()) != installerData.length()) {
|
||||
QMessageBox::critical(this,"Installation Failed",QString("Installation failed: unable to write to ")+instPath,QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
::close(outfd);
|
||||
::chmod(instPath.toStdString().c_str(),0755);
|
||||
|
||||
QString installHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Install).app/Contents/MacOS/applet");
|
||||
if (!QFile::exists(installHelperPath)) {
|
||||
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate install helper, cannot install service.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Terminate the GUI and execute the install helper instead
|
||||
::execl(installHelperPath.toStdString().c_str(),installHelperPath.toStdString().c_str(),(const char *)0);
|
||||
|
||||
// We only make it here if execl() failed
|
||||
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate install helper, cannot install service.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
|
||||
return;
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifndef INSTALLDIALOG_H
|
||||
#define INSTALLDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMainWindow>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QUrl>
|
||||
#include <QNetworkRequest>
|
||||
@ -42,7 +42,7 @@ namespace Ui {
|
||||
class InstallDialog;
|
||||
}
|
||||
|
||||
class InstallDialog : public QDialog
|
||||
class InstallDialog : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>InstallDialog</class>
|
||||
<widget class="QDialog" name="InstallDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<widget class="QMainWindow" name="InstallDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -20,12 +17,7 @@
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/img/zt1icon.png</normaloff>:/img/zt1icon.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
@ -123,6 +115,7 @@ Please wait while the service downloads, then you will be prompted to enter an a
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
|
42
ZeroTierUI/licensedialog.cpp
Normal file
42
ZeroTierUI/licensedialog.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "licensedialog.h"
|
||||
#include "ui_licensedialog.h"
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
|
||||
LicenseDialog::LicenseDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::LicenseDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
LicenseDialog::~LicenseDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void LicenseDialog::on_buttonBox_accepted()
|
||||
{
|
||||
settings->setValue("acceptedLicenseV1",true);
|
||||
settings->sync();
|
||||
|
||||
this->setResult(QDialog::Accepted);
|
||||
}
|
||||
|
||||
void LicenseDialog::on_buttonBox_rejected()
|
||||
{
|
||||
::exit(0);
|
||||
}
|
27
ZeroTierUI/licensedialog.h
Normal file
27
ZeroTierUI/licensedialog.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef LICENSEDIALOG_H
|
||||
#define LICENSEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class LicenseDialog;
|
||||
}
|
||||
|
||||
class LicenseDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit LicenseDialog(QWidget *parent = 0);
|
||||
~LicenseDialog();
|
||||
|
||||
private slots:
|
||||
void on_buttonBox_accepted();
|
||||
|
||||
void on_buttonBox_rejected();
|
||||
|
||||
private:
|
||||
Ui::LicenseDialog *ui;
|
||||
};
|
||||
|
||||
#endif // LICENSEDIALOG_H
|
256
ZeroTierUI/licensedialog.ui
Normal file
256
ZeroTierUI/licensedialog.ui
Normal file
@ -0,0 +1,256 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LicenseDialog</class>
|
||||
<widget class="QDialog" name="LicenseDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>534</width>
|
||||
<height>333</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ZeroTier One</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/img/zt1icon.png</normaloff>:/img/zt1icon.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do you agree to the terms of the license agreement?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="licenseDisplayTextEdit">
|
||||
<property name="undoRedoEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><title>GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'.Lucida Grande UI'; font-size:13pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:large; font-weight:600;">GNU GENERAL PUBLIC LICENSE</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Version 3, 29 June 2007 </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright © 2007 Free Software Foundation, Inc. &lt;<a href="http://fsf.org/"><span style=" text-decoration: underline; color:#0000ff;">http://fsf.org/</span></a>&gt;</p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="preamble"></a><span style=" font-size:large; font-weight:600;">P</span><span style=" font-size:large; font-weight:600;">reamble</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The GNU General Public License is a free, copyleft license for software and other kinds of works. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The precise terms and conditions for copying, distribution and modification follow. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="terms"></a><span style=" font-size:large; font-weight:600;">T</span><span style=" font-size:large; font-weight:600;">ERMS AND CONDITIONS</span> </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section0"></a><span style=" font-size:medium; font-weight:600;">0</span><span style=" font-size:medium; font-weight:600;">. Definitions.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“This License” refers to version 3 of the GNU General Public License. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A “covered work” means either the unmodified Program or a work based on the Program. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section1"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">. Source Code.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Corresponding Source for a work in source code form is that same work. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section2"></a><span style=" font-size:medium; font-weight:600;">2</span><span style=" font-size:medium; font-weight:600;">. Basic Permissions.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section3"></a><span style=" font-size:medium; font-weight:600;">3</span><span style=" font-size:medium; font-weight:600;">. Protecting Users' Legal Rights From Anti-Circumvention Law.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section4"></a><span style=" font-size:medium; font-weight:600;">4</span><span style=" font-size:medium; font-weight:600;">. Conveying Verbatim Copies.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section5"></a><span style=" font-size:medium; font-weight:600;">5</span><span style=" font-size:medium; font-weight:600;">. Conveying Modified Source Versions.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: </p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a) The work must carry prominent notices stating that you modified it, and giving a relevant date. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. </li></ul>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section6"></a><span style=" font-size:medium; font-weight:600;">6</span><span style=" font-size:medium; font-weight:600;">. Conveying Non-Source Forms.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: </p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. </li>
|
||||
<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. </li></ul>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section7"></a><span style=" font-size:medium; font-weight:600;">7</span><span style=" font-size:medium; font-weight:600;">. Additional Terms.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: </p>
|
||||
<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">d) Limiting the use for publicity purposes of names of licensors or authors of the material; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or </li>
|
||||
<li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. </li></ul>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section8"></a><span style=" font-size:medium; font-weight:600;">8</span><span style=" font-size:medium; font-weight:600;">. Termination.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section9"></a><span style=" font-size:medium; font-weight:600;">9</span><span style=" font-size:medium; font-weight:600;">. Acceptance Not Required for Having Copies.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section10"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">0. Automatic Licensing of Downstream Recipients.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section11"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">1. Patents.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section12"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">2. No Surrender of Others' Freedom.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section13"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">3. Use with the GNU Affero General Public License.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section14"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">4. Revised Versions of this License.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section15"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">5. Disclaimer of Warranty.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section16"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">6. Limitation of Liability.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="section17"></a><span style=" font-size:medium; font-weight:600;">1</span><span style=" font-size:medium; font-weight:600;">7. Interpretation of Sections 15 and 16.</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">END OF TERMS AND CONDITIONS </p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="howto"></a><span style=" font-size:large; font-weight:600;">H</span><span style=" font-size:large; font-weight:600;">ow to Apply These Terms to Your New Programs</span> </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> &lt;one line to give the program's name and a brief idea of what it does.&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> Copyright (C) &lt;year&gt; &lt;name of author&gt;</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> This program is free software: you can redistribute it and/or modify</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> it under the terms of the GNU General Public License as published by</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> the Free Software Foundation, either version 3 of the License, or</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> (at your option) any later version.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> This program is distributed in the hope that it will be useful,</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> GNU General Public License for more details.</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Courier New,courier';"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> You should have received a copy of the GNU General Public License</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;. </span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Also add information on how to contact you by electronic and paper mail. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: </p>
|
||||
<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> &lt;program&gt; Copyright (C) &lt;year&gt; &lt;name of author&gt;</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> This is free software, and you are welcome to redistribute it</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Courier New,courier';"> under certain conditions; type `show c' for details. </span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see &lt;<a href="http://www.gnu.org/licenses/"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/licenses/</span></a>&gt;. </p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read &lt;<a href="http://www.gnu.org/philosophy/why-not-lgpl.html"><span style=" text-decoration: underline; color:#0000ff;">http://www.gnu.org/philosophy/why-not-lgpl.html</span></a>&gt;. </p></body></html></string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>LicenseDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>LicenseDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
12
ZeroTierUI/mac_doprivileged.h
Normal file
12
ZeroTierUI/mac_doprivileged.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef mac_doprivileged_h
|
||||
#define mac_doprivileged_h
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
// commandAndArgs can contain only single-tic quotes and should redirect its
|
||||
// stdout and stderr somewhere...
|
||||
bool macExecutePrivilegedShellCommand(const char *commandAndArgs);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
24
ZeroTierUI/mac_doprivileged.mm
Normal file
24
ZeroTierUI/mac_doprivileged.mm
Normal file
@ -0,0 +1,24 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mac_doprivileged.h"
|
||||
|
||||
#undef slots
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
bool macExecutePrivilegedShellCommand(const char *commandAndArgs)
|
||||
{
|
||||
char tmp[32768];
|
||||
|
||||
snprintf(tmp,sizeof(tmp),"do shell script \"%s\" with administrator privileges\n",commandAndArgs);
|
||||
tmp[32767] = (char)0;
|
||||
|
||||
NSString *scriptApple = [[NSString alloc] initWithUTF8String:tmp];
|
||||
NSAppleScript *as = [[NSAppleScript alloc] initWithSource:scriptApple];
|
||||
NSDictionary *err = nil;
|
||||
[as executeAndReturnError:&err];
|
||||
[as release];
|
||||
[scriptApple release];
|
||||
|
||||
return (err == nil);
|
||||
}
|
@ -26,13 +26,69 @@
|
||||
*/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "installdialog.h"
|
||||
#include "licensedialog.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
QSettings *settings = (QSettings *)0;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
{
|
||||
WSADATA wsaData;
|
||||
WSAStartup(MAKEWORD(2,2),&wsaData);
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
QFile qss(":css/stylesheet.css");
|
||||
qss.open(QFile::ReadOnly);
|
||||
QString style(qss.readAll());
|
||||
a.setStyleSheet(style);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// If service isn't installed, download and install it
|
||||
if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
|
||||
// InstallDialog is an alternative main window. It will re-launch the app
|
||||
// when done.
|
||||
InstallDialog id;
|
||||
id.show();
|
||||
return a.exec();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
{
|
||||
// Put QSettings here because this is one of the writable directories allowed
|
||||
// in Apple's app store sandbox specs. We might end up in app store someday.
|
||||
QString zt1AppSupport(QDir::homePath() + "/Library/Application Support/ZeroTier/One");
|
||||
QDir::root().mkpath(zt1AppSupport);
|
||||
settings = new QSettings(zt1AppSupport + "/ui.ini",QSettings::IniFormat);
|
||||
}
|
||||
#else
|
||||
settings = new QSettings("ZeroTier Networks","ZeroTier One");
|
||||
#endif
|
||||
|
||||
if (!settings->value("acceptedLicenseV1",false).toBool()) {
|
||||
LicenseDialog ld;
|
||||
ld.setStyleSheet(a.styleSheet());
|
||||
ld.exec();
|
||||
}
|
||||
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
9
ZeroTierUI/main.h
Normal file
9
ZeroTierUI/main.h
Normal file
@ -0,0 +1,9 @@
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include <QSettings>
|
||||
#include <QMainWindow>
|
||||
|
||||
extern QSettings *settings;
|
||||
|
||||
#endif // MAIN_H
|
@ -25,12 +25,6 @@
|
||||
* LLC. Start here: http://www.zerotier.com/
|
||||
*/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "aboutwindow.h"
|
||||
#include "networkwidget.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "installdialog.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
@ -50,15 +44,31 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QScrollBar>
|
||||
#include <QEventLoop>
|
||||
#include <QFont>
|
||||
|
||||
QNetworkAccessManager *nam;
|
||||
#include "main.h"
|
||||
#include "mainwindow.h"
|
||||
#include "aboutwindow.h"
|
||||
#include "networkwidget.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "ui_quickstartdialog.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "mac_doprivileged.h"
|
||||
#endif
|
||||
|
||||
// Globally visible
|
||||
ZeroTier::Node::LocalClient *zeroTierClient = (ZeroTier::Node::LocalClient *)0;
|
||||
|
||||
// Main window instance for app
|
||||
static MainWindow *mainWindow = (MainWindow *)0;
|
||||
QMainWindow *mainWindow = (MainWindow *)0;
|
||||
|
||||
// Handles message from ZeroTier One service
|
||||
static void handleZTMessage(void *arg,unsigned long id,const char *line)
|
||||
{
|
||||
static std::map< unsigned long,std::vector<std::string> > ztReplies;
|
||||
@ -71,6 +81,8 @@ static void handleZTMessage(void *arg,unsigned long id,const char *line)
|
||||
} else { // empty lines conclude transmissions
|
||||
std::map< unsigned long,std::vector<std::string> >::iterator r(ztReplies.find(id));
|
||||
if (r != ztReplies.end()) {
|
||||
// The message is packed into an event and sent to the main window where
|
||||
// the actual parsing code lives.
|
||||
MainWindow::ZTMessageEvent *event = new MainWindow::ZTMessageEvent(r->second);
|
||||
ztReplies.erase(r);
|
||||
ztReplies_m.unlock();
|
||||
@ -84,17 +96,34 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui(new Ui::MainWindow),
|
||||
pollServiceTimerId(-1)
|
||||
{
|
||||
mainWindow = this;
|
||||
|
||||
ui->setupUi(this);
|
||||
if (ui->networkListWidget->verticalScrollBar())
|
||||
ui->networkListWidget->verticalScrollBar()->setSingleStep(8);
|
||||
|
||||
#ifdef __APPLE__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets)
|
||||
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
#endif
|
||||
|
||||
mainWindow = this;
|
||||
#ifdef __WINDOWS__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
#endif
|
||||
|
||||
this->pollServiceTimerId = this->startTimer(1000);
|
||||
this->setEnabled(false); // gets enabled when updates are received
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
ui->noNetworksLabel->setText("Connecting to Service...");
|
||||
ui->bottomContainerWidget->setVisible(false);
|
||||
ui->networkListWidget->setVisible(false);
|
||||
|
||||
this->firstTimerTick = true;
|
||||
this->pollServiceTimerId = this->startTimer(200);
|
||||
this->cyclesSinceResponseFromService = 0;
|
||||
}
|
||||
|
||||
@ -106,48 +135,92 @@ MainWindow::~MainWindow()
|
||||
mainWindow = (MainWindow *)0;
|
||||
}
|
||||
|
||||
void MainWindow::timerEvent(QTimerEvent *event)
|
||||
void MainWindow::timerEvent(QTimerEvent *event) // event can be null since code also calls this directly
|
||||
{
|
||||
event->accept();
|
||||
|
||||
if (this->isHidden())
|
||||
return;
|
||||
if (pollServiceTimerId < 0)
|
||||
if (this->pollServiceTimerId < 0)
|
||||
return;
|
||||
|
||||
if (this->firstTimerTick) {
|
||||
this->firstTimerTick = false;
|
||||
this->killTimer(this->pollServiceTimerId);
|
||||
|
||||
if (!settings->value("shown_quickStart",false).toBool()) {
|
||||
on_actionQuick_Start_triggered();
|
||||
settings->setValue("shown_quickStart",true);
|
||||
settings->sync();
|
||||
}
|
||||
|
||||
this->pollServiceTimerId = this->startTimer(1500);
|
||||
}
|
||||
|
||||
if (!zeroTierClient) {
|
||||
std::string authToken;
|
||||
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
|
||||
#ifdef __APPLE__
|
||||
if (QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one")) {
|
||||
QMessageBox::information(this,"Authorization Required","You must authenticate to authorize this user to administrate ZeroTier One on this computer.\n\n(This only needs to be done once.)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QString authHelperPath(QCoreApplication::applicationDirPath() + "/../Resources/helpers/mac/ZeroTier One (Authenticate).app/Contents/MacOS/applet");
|
||||
if (!QFile::exists(authHelperPath)) {
|
||||
QMessageBox::critical(this,"Unable to Locate Helper","Unable to locate authorization helper, cannot obtain authentication token.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
// Authorize user by copying auth token into local home directory
|
||||
QMessageBox::information(this,"Authorization Needed","Administrator privileges are required to allow the current user to control ZeroTier One on this computer. (You only have to do this once.)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
|
||||
std::string homePath(QDir::homePath().toStdString());
|
||||
QString zt1Caches(QDir::homePath() + "/Library/Caches/ZeroTier/One");
|
||||
QDir::root().mkpath(zt1Caches);
|
||||
std::string tmpPath((zt1Caches + "/auth.sh").toStdString());
|
||||
|
||||
FILE *scr = fopen(tmpPath.c_str(),"w");
|
||||
if (!scr) {
|
||||
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Cannot write to temporary Library/Caches/ZeroTier/One folder.)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
QProcess::execute(authHelperPath,QStringList());
|
||||
} else {
|
||||
doInstallDialog();
|
||||
return;
|
||||
|
||||
fprintf(scr,"#!/bin/bash\n");
|
||||
fprintf(scr,"export PATH=\"/bin:/usr/bin:/sbin:/usr/sbin\"\n");
|
||||
fprintf(scr,"if [ -f '/Library/Application Support/ZeroTier/One/authtoken.secret' ]; then\n");
|
||||
fprintf(scr," mkdir -p '%s/Library/Application Support/ZeroTier/One'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0700 '%s/Library/Application Support/ZeroTier'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier/One'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier/One'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0700 '%s/Library/Application Support/ZeroTier/One'\n",homePath.c_str());
|
||||
fprintf(scr," cp -f '/Library/Application Support/ZeroTier/One/authtoken.secret' '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",homePath.c_str());
|
||||
fprintf(scr," chown %d '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",(int)getuid(),homePath.c_str());
|
||||
fprintf(scr," chgrp %d '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",(int)getgid(),homePath.c_str());
|
||||
fprintf(scr," chmod 0600 '%s/Library/Application Support/ZeroTier/One/authtoken.secret'\n",homePath.c_str());
|
||||
fprintf(scr,"fi\n");
|
||||
fprintf(scr,"exit 0\n");
|
||||
|
||||
fclose(scr);
|
||||
chmod(tmpPath.c_str(),0755);
|
||||
|
||||
macExecutePrivilegedShellCommand((std::string("'")+tmpPath+"' >>/dev/null 2>&1").c_str());
|
||||
|
||||
unlink(tmpPath.c_str());
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultUserPath().c_str(),authToken)) {
|
||||
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Did you enter your password correctly?)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
if (!ZeroTier::Utils::readFile(ZeroTier::Node::LocalClient::authTokenDefaultSystemPath().c_str(),authToken)) {
|
||||
QMessageBox::critical(this,"Cannot Authorize","Unable to authorize this user to administrate ZeroTier One. (Did you enter your password correctly?)",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
QApplication::exit(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zeroTierClient = new ZeroTier::Node::LocalClient(authToken.c_str(),0,&handleZTMessage,this);
|
||||
}
|
||||
|
||||
// TODO: do something more user-friendly here... or maybe try to restart
|
||||
// the service?
|
||||
if (++this->cyclesSinceResponseFromService == 4)
|
||||
QMessageBox::critical(this,"No Response from Service","The ZeroTier One service does not appear to be running.",QMessageBox::Ok,QMessageBox::NoButton);
|
||||
if (++this->cyclesSinceResponseFromService >= 3) {
|
||||
if (this->cyclesSinceResponseFromService == 3)
|
||||
QMessageBox::warning(this,"Service Not Running","Can't connect to the ZeroTier One service. Is it running?",QMessageBox::Ok);
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
ui->noNetworksLabel->setText("Connecting to Service...");
|
||||
ui->bottomContainerWidget->setVisible(false);
|
||||
ui->networkListWidget->setVisible(false);
|
||||
}
|
||||
|
||||
zeroTierClient->send("info");
|
||||
zeroTierClient->send("listnetworks");
|
||||
@ -160,14 +233,14 @@ void MainWindow::customEvent(QEvent *event)
|
||||
if (m->ztMessage.size() == 0)
|
||||
return;
|
||||
|
||||
this->cyclesSinceResponseFromService = 0;
|
||||
|
||||
std::vector<std::string> hdr(ZeroTier::Node::LocalClient::splitLine(m->ztMessage[0]));
|
||||
if (hdr.size() < 2)
|
||||
return;
|
||||
if (hdr[0] != "200")
|
||||
return;
|
||||
|
||||
this->cyclesSinceResponseFromService = 0;
|
||||
|
||||
if (hdr[1] == "info") {
|
||||
if (hdr.size() >= 3)
|
||||
this->myAddress = hdr[2].c_str();
|
||||
@ -238,7 +311,15 @@ void MainWindow::customEvent(QEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
ui->noNetworksLabel->setVisible(ui->networkListWidget->count() == 0);
|
||||
if (!ui->networkListWidget->count()) {
|
||||
ui->noNetworksLabel->setText("You Have Not Joined Any Networks");
|
||||
ui->noNetworksLabel->setVisible(true);
|
||||
} else ui->noNetworksLabel->setVisible(false);
|
||||
|
||||
if (!ui->bottomContainerWidget->isVisible())
|
||||
ui->bottomContainerWidget->setVisible(true);
|
||||
if (!ui->networkListWidget->isVisible())
|
||||
ui->networkListWidget->setVisible(true);
|
||||
|
||||
if (this->myAddress.size())
|
||||
ui->addressButton->setText(this->myAddress);
|
||||
@ -251,22 +332,6 @@ void MainWindow::customEvent(QEvent *event)
|
||||
st += QString::number(this->numPeers);
|
||||
st += " direct links to peers";
|
||||
ui->statusLabel->setText(st);
|
||||
|
||||
if (this->myStatus == "ONLINE") {
|
||||
if (!this->isEnabled())
|
||||
this->setEnabled(true);
|
||||
} else {
|
||||
if (this->isEnabled())
|
||||
this->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::showEvent(QShowEvent *event)
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
if (!QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one"))
|
||||
doInstallDialog();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::on_joinNetworkButton_clicked()
|
||||
@ -331,17 +396,11 @@ void MainWindow::on_addressButton_clicked()
|
||||
QApplication::clipboard()->setText(this->myAddress);
|
||||
}
|
||||
|
||||
void MainWindow::doInstallDialog()
|
||||
void MainWindow::on_actionQuick_Start_triggered()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
this->setEnabled(false);
|
||||
if (pollServiceTimerId >= 0) {
|
||||
this->killTimer(pollServiceTimerId);
|
||||
pollServiceTimerId = -1;
|
||||
}
|
||||
|
||||
InstallDialog *id = new InstallDialog(this);
|
||||
id->setModal(true);
|
||||
id->show();
|
||||
#endif
|
||||
Ui::QuickstartDialog qd;
|
||||
QDialog *qdd = new QDialog(this);
|
||||
qd.setupUi(qdd);
|
||||
qdd->setModal(false);
|
||||
qdd->show();
|
||||
}
|
||||
|
@ -33,11 +33,13 @@
|
||||
#include <QString>
|
||||
#include <QShowEvent>
|
||||
#include <QTimerEvent>
|
||||
#include <QSettings>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
#include "../node/Node.hpp"
|
||||
#include "../node/Utils.hpp"
|
||||
|
||||
@ -49,6 +51,9 @@ class MainWindow;
|
||||
// Can be null if not connected, or will point to current
|
||||
extern ZeroTier::Node::LocalClient *zeroTierClient;
|
||||
|
||||
// Globally visible pointer to main app window
|
||||
extern QMainWindow *mainWindow;
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -71,22 +76,21 @@ public:
|
||||
protected:
|
||||
virtual void timerEvent(QTimerEvent *event);
|
||||
virtual void customEvent(QEvent *event);
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
||||
private slots:
|
||||
void on_joinNetworkButton_clicked();
|
||||
void on_actionAbout_triggered();
|
||||
void on_networkIdLineEdit_textChanged(const QString &text);
|
||||
void on_addressButton_clicked();
|
||||
void on_actionQuick_Start_triggered();
|
||||
|
||||
private:
|
||||
void doInstallDialog();
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
QString myAddress;
|
||||
QString myStatus;
|
||||
QString myVersion;
|
||||
bool firstTimerTick;
|
||||
int pollServiceTimerId;
|
||||
unsigned int numPeers;
|
||||
unsigned int cyclesSinceResponseFromService;
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>668</width>
|
||||
<width>720</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -36,43 +36,6 @@
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="noNetworksLabel">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="64">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="64">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>127</red>
|
||||
<green>127</green>
|
||||
<blue>127</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
@ -106,16 +69,6 @@
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QListWidget#networkListWidget {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
QListWidget#networkListWidget::Item {
|
||||
background-color: palette(base);
|
||||
border: 0;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
@ -135,7 +88,7 @@ QListWidget#networkListWidget::Item {
|
||||
<enum>QAbstractItemView::ScrollPerPixel</enum>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>true</bool>
|
||||
@ -161,7 +114,7 @@ QListWidget#networkListWidget::Item {
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addressButton">
|
||||
<widget class="QToolButton" name="addressButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -179,33 +132,14 @@ QListWidget#networkListWidget::Item {
|
||||
<property name="statusTip">
|
||||
<string>Your 10-digit ZeroTier address; click to copy to clipboard.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
border: 0;
|
||||
text-align: left;
|
||||
padding: 0 5px 0 5px;
|
||||
margin: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
QPushButton:focus {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(0,0,0,75);
|
||||
}
|
||||
s</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string notr="true">----------</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextOnly</enum>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">clickToCopy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -225,13 +159,8 @@ s</string>
|
||||
<property name="statusTip">
|
||||
<string>Your network connection status.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding: 0 0.75em 0 0.75em;
|
||||
margin: 0 4px 0 0;
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>STATUS, etc.</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
@ -267,7 +196,7 @@ margin: 0 4px 0 0;
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="joinNetworkButton">
|
||||
<widget class="QToolButton" name="joinNetworkButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
@ -285,33 +214,9 @@ margin: 0 4px 0 0;
|
||||
<property name="statusTip">
|
||||
<string>Join this network.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
padding: 0 0.8em 0 0.8em;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
background-color: rgba(0,0,0,25);
|
||||
}
|
||||
|
||||
QPushButton:focus {
|
||||
background-color: rgba(0,0,0,33);
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: rgba(0,0,0,33);
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(0,0,0,75);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">+</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@ -324,10 +229,15 @@ QPushButton:pressed {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>668</width>
|
||||
<width>720</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
@ -336,6 +246,7 @@ QPushButton:pressed {
|
||||
<string>Help</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
<addaction name="actionQuick_Start"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
@ -350,7 +261,7 @@ QPushButton:pressed {
|
||||
<widget class="QStatusBar" name="statusBar">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
@ -364,6 +275,11 @@ QPushButton:pressed {
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionQuick_Start">
|
||||
<property name="text">
|
||||
<string>Quick Start</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "networkwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui_networkwidget.h"
|
||||
#include "onetimedialog.h"
|
||||
#include "main.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QString>
|
||||
@ -36,23 +38,38 @@
|
||||
#include <QProcess>
|
||||
#include <QList>
|
||||
#include <QMessageBox>
|
||||
#include <QFont>
|
||||
|
||||
#include "../node/Constants.hpp"
|
||||
|
||||
NetworkWidget::NetworkWidget(QWidget *parent,const std::string &nwid) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::NetworkWidget),
|
||||
networkIdStr(nwid)
|
||||
networkIdStr(nwid),
|
||||
publicWarningShown(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->networkIdPushButton->setText(QString(nwid.c_str()));
|
||||
ui->networkIdButton->setText(QString(nwid.c_str()));
|
||||
|
||||
QFontMetrics fm(ui->ipListWidget->font());
|
||||
int lineHeight = ui->ipListWidget->spacing() + fm.height();
|
||||
ui->ipListWidget->setMinimumHeight(lineHeight * 4);
|
||||
ui->ipListWidget->setMaximumHeight(lineHeight * 4);
|
||||
|
||||
#ifdef __APPLE__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget* widget, widgets)
|
||||
widget->setAttribute(Qt::WA_MacShowFocusRect,false);
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NetworkWidget::~NetworkWidget()
|
||||
@ -64,7 +81,7 @@ void NetworkWidget::setStatus(const std::string &status,const std::string &age)
|
||||
{
|
||||
ui->statusLabel->setText(QString(status.c_str()));
|
||||
if (status == "OK")
|
||||
ui->ageLabel->setText(QString("(configuration is ") + age.c_str() + " seconds old)");
|
||||
ui->ageLabel->setText(QString("[") + age.c_str() + "s ago]");
|
||||
else ui->ageLabel->setText(QString());
|
||||
}
|
||||
|
||||
@ -84,9 +101,15 @@ void NetworkWidget::setNetworkType(const std::string &type)
|
||||
ui->networkTypeLabel->setText(QString(type.c_str()));
|
||||
if (type == "?")
|
||||
ui->networkTypeLabel->setStatusTip("Waiting for configuration...");
|
||||
else if (type == "public")
|
||||
else if (type == "public") {
|
||||
if ((!publicWarningShown)&&(!settings->value("shown_publicWarning",false).toBool())) {
|
||||
publicWarningShown = true;
|
||||
OneTimeDialog *d = new OneTimeDialog(mainWindow,"shown_publicWarning","Security Notice","Security Notice:"ZT_EOL_S""ZT_EOL_S"You have joined a public network. Anyone can join these. We recommend making sure that your system's automatic software updates are enabled and turning off any shared network services that you do not want people to access.");
|
||||
d->setModal(false);
|
||||
d->show();
|
||||
}
|
||||
ui->networkTypeLabel->setStatusTip("This network can be joined by anyone in the world.");
|
||||
else if (type == "private")
|
||||
} else if (type == "private")
|
||||
ui->networkTypeLabel->setStatusTip("This network is private; only authorized peers can join.");
|
||||
else ui->networkTypeLabel->setStatusTip("Unknown network type.");
|
||||
}
|
||||
@ -138,13 +161,19 @@ void NetworkWidget::on_leaveNetworkButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkWidget::on_networkIdPushButton_clicked()
|
||||
void NetworkWidget::on_networkIdButton_clicked()
|
||||
{
|
||||
QApplication::clipboard()->setText(ui->networkIdPushButton->text());
|
||||
QApplication::clipboard()->setText(ui->networkIdButton->text());
|
||||
}
|
||||
|
||||
void NetworkWidget::on_ipListWidget_itemActivated(QListWidgetItem *item)
|
||||
{
|
||||
if (item)
|
||||
QApplication::clipboard()->setText(item->text());
|
||||
if (item)
|
||||
QApplication::clipboard()->setText(item->text());
|
||||
}
|
||||
|
||||
void NetworkWidget::on_ipListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||
{
|
||||
if (current)
|
||||
QApplication::clipboard()->setText(current->text());
|
||||
}
|
||||
|
@ -55,12 +55,14 @@ public:
|
||||
|
||||
private slots:
|
||||
void on_leaveNetworkButton_clicked();
|
||||
void on_networkIdPushButton_clicked();
|
||||
void on_networkIdButton_clicked();
|
||||
void on_ipListWidget_itemActivated(QListWidgetItem *item);
|
||||
void on_ipListWidget_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||
|
||||
private:
|
||||
Ui::NetworkWidget *ui;
|
||||
std::string networkIdStr;
|
||||
bool publicWarningShown;
|
||||
};
|
||||
|
||||
#endif // NETWORK_H
|
||||
|
@ -20,7 +20,7 @@
|
||||
<string>Network</string>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string>NetworkWidget</string>
|
||||
<string notr="true">networkListItem</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
@ -57,35 +57,123 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>This network's short name.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>networkname</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="networkIdButton">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier</family>
|
||||
<pointsize>13</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Hexadecimal network ID; click to copy to clipboard.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">----------------</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextOnly</enum>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">clickToCopy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>[</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>13</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>This network's short name.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>networkname</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">networkName</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>14</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>]</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -100,6 +188,9 @@
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="rowWrapPolicy">
|
||||
<enum>QFormLayout::DontWrapRows</enum>
|
||||
</property>
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
@ -107,85 +198,30 @@
|
||||
<set>Qt::AlignHCenter|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Network ID:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="networkIdPushButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Courier</family>
|
||||
<pointsize>14</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Hexadecimal network ID; click to copy to clipboard.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
QPushButton:focus {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(0,0,0,75);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0000000000000000</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Type:</string>
|
||||
</property>
|
||||
@ -194,10 +230,11 @@ QPushButton:pressed {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="networkTypeLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
@ -213,8 +250,13 @@ QPushButton:pressed {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
@ -223,7 +265,22 @@ QPushButton:pressed {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Device:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
@ -257,6 +314,7 @@ QPushButton:pressed {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
@ -282,18 +340,21 @@ QPushButton:pressed {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>How recently did this network refresh its settings?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>(configuration is 0 seconds old)</string>
|
||||
<string>[0s ago]</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -312,20 +373,11 @@ QPushButton:pressed {
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Device:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="deviceLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
@ -381,6 +433,7 @@ QPushButton:pressed {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
<underline>false</underline>
|
||||
</font>
|
||||
</property>
|
||||
@ -388,7 +441,7 @@ QPushButton:pressed {
|
||||
<string notr="true">padding: 0.1em 0 0.1em 0;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP Address Assignments</string>
|
||||
<string>IP Addresses</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
@ -416,17 +469,7 @@ QPushButton:pressed {
|
||||
</font>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Double-click an IP to copy it to the clipboard.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QListWidget {
|
||||
background-color: rgba(0,0,0,10);
|
||||
}
|
||||
|
||||
QListWidget:hover {
|
||||
background-color: rgba(0,0,0,15);
|
||||
}
|
||||
</string>
|
||||
<string>IP addresses assigned to this interface; click to copy to clipboard.</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
@ -446,6 +489,9 @@ QListWidget:hover {
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">ipAddressList</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -480,7 +526,7 @@ QListWidget:hover {
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="leaveNetworkButton">
|
||||
<widget class="QToolButton" name="leaveNetworkButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -490,32 +536,11 @@ QListWidget:hover {
|
||||
<property name="statusTip">
|
||||
<string>Leave this network.</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton {
|
||||
padding: 0.25em;
|
||||
border: 0;
|
||||
margin: 2px 0 2px 0;
|
||||
background-color: rgba(0,0,0,25);
|
||||
}
|
||||
|
||||
QPushButton:focus {
|
||||
background-color: rgba(0,0,0,33);
|
||||
}
|
||||
|
||||
QPushButton:hover {
|
||||
background-color: rgba(0,0,0,33);
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
background-color: rgba(0,0,0,75);
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Leave Network</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
<property name="class" stdset="0">
|
||||
<string notr="true">leaveNetworkButton</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
37
ZeroTierUI/onetimedialog.cpp
Normal file
37
ZeroTierUI/onetimedialog.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "onetimedialog.h"
|
||||
#include "ui_onetimedialog.h"
|
||||
#include "main.h"
|
||||
|
||||
OneTimeDialog::OneTimeDialog(QWidget *parent,const char *propName,const QString &title,const QString &message) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::OneTimeDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->label->setText(message);
|
||||
this->setWindowTitle(title);
|
||||
_propName = propName;
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
QWidgetList widgets = this->findChildren<QWidget*>();
|
||||
foreach(QWidget *widget, widgets) {
|
||||
QFont font(widget->font());
|
||||
font.setPointSizeF(font.pointSizeF() * 0.75);
|
||||
widget->setFont(font);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
OneTimeDialog::~OneTimeDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void OneTimeDialog::on_pushButton_clicked()
|
||||
{
|
||||
if (_propName) {
|
||||
settings->setValue(_propName,ui->checkBox->isChecked());
|
||||
settings->sync();
|
||||
}
|
||||
this->close();
|
||||
}
|
26
ZeroTierUI/onetimedialog.h
Normal file
26
ZeroTierUI/onetimedialog.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef ONETIMEDIALOG_H
|
||||
#define ONETIMEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class OneTimeDialog;
|
||||
}
|
||||
|
||||
class OneTimeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OneTimeDialog(QWidget *parent = 0,const char *propName = (const char *)0,const QString &title = QString(),const QString &message = QString());
|
||||
~OneTimeDialog();
|
||||
|
||||
private slots:
|
||||
void on_pushButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OneTimeDialog *ui;
|
||||
const char *_propName;
|
||||
};
|
||||
|
||||
#endif // ONETIMEDIALOG_H
|
99
ZeroTierUI/onetimedialog.ui
Normal file
99
ZeroTierUI/onetimedialog.ui
Normal file
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>OneTimeDialog</class>
|
||||
<widget class="QDialog" name="OneTimeDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>496</width>
|
||||
<height>197</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Don't Show This Message Again</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
170
ZeroTierUI/quickstartdialog.ui
Normal file
170
ZeroTierUI/quickstartdialog.ui
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QuickstartDialog</class>
|
||||
<widget class="QDialog" name="QuickstartDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Quick Start</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>785</width>
|
||||
<height>800</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: #000000;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/img/ZT1GUI.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Help -> Quick Start to see this screen again.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::NoTextInteraction</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>702</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="okButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>QuickstartDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>753</x>
|
||||
<y>457</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>399</x>
|
||||
<y>239</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -1,5 +1,9 @@
|
||||
<RCC>
|
||||
<qresource prefix="/img">
|
||||
<file>zt1icon.png</file>
|
||||
<file>ZT1GUI.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/css">
|
||||
<file>stylesheet.css</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
106
ZeroTierUI/stylesheet.css
Normal file
106
ZeroTierUI/stylesheet.css
Normal file
@ -0,0 +1,106 @@
|
||||
QToolButton {
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
text-align: center;
|
||||
background: palette(button);
|
||||
color: palette(button-text);
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
QToolButton:focus {
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
QToolButton:hover {
|
||||
background: palette(highlight);
|
||||
color: palette(highlight-text);
|
||||
}
|
||||
QToolButton:pressed {
|
||||
border: 1px solid #000000;
|
||||
}
|
||||
|
||||
QToolButton.clickToCopy {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: palette(link);
|
||||
}
|
||||
QToolButton.clickToCopy:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
QToolButton.clickToCopy:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
QToolButton.clickToCopy:pressed {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
QToolButton.leaveNetworkButton {
|
||||
margin: 0 4px 3px 0;
|
||||
}
|
||||
|
||||
QMainWindow {
|
||||
background: palette(dark);
|
||||
}
|
||||
|
||||
QListWidget {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
}
|
||||
QListWidget::item {
|
||||
background: palette(base);
|
||||
margin: 1px 0 1px 0;
|
||||
}
|
||||
|
||||
QListWidget.ipAddressList {
|
||||
background: palette(button);
|
||||
margin: 0 4px 4px 0;
|
||||
}
|
||||
QListWidget.ipAddressList::item {
|
||||
background: transparent;
|
||||
color: palette(link);
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
QListWidget.ipAddressList::item:selected {
|
||||
background: transparent;
|
||||
border-top: 0;
|
||||
border-left: 0;
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
QListWidget.ipAddressList::item:hover {
|
||||
border-bottom: 1px solid palette(link);
|
||||
}
|
||||
|
||||
QStatusBar {
|
||||
background: palette(button);
|
||||
}
|
||||
|
||||
QLabel.networkName {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#networkIdButton {
|
||||
padding: 0.2em 0 0 0;
|
||||
}
|
||||
|
||||
#joinNetworkButton {
|
||||
margin: 1px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#noNetworksLabel {
|
||||
background: transparent;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
#networkListWidget {
|
||||
background: palette(dark);
|
||||
margin: 0 0 2px 0;
|
||||
}
|
||||
|
||||
#bottomContainerWidget {
|
||||
background: palette(base);
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# This script signs an installer, creates its .NFO file, and
|
||||
# copies it to a destination directory. This in turn can be
|
||||
# uploaded to the official ZeroTier Networks update site for
|
||||
# auto-updating binary distribution users.
|
||||
#
|
||||
# It's in attic/ because end-users won't find it particularly
|
||||
# useful. You must have the ZeroTier One official signing
|
||||
# identity secret keys to sign binary releases for auto-update,
|
||||
# and of course you'd also have to upload it to our servers.
|
||||
#
|
||||
|
||||
# Build the app and the installer, then run this from the root
|
||||
# of the source tree. It'll need the zerotier-idtool symlink
|
||||
# that will be placed there after a build, too.
|
||||
|
||||
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <path to secret signing identity>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -e zerotier-idtool ]; then
|
||||
echo "Unable to find zerotier-idtool in current directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
secret="$1"
|
||||
|
||||
if [ ! -e "$secret" ]; then
|
||||
echo "Can't find $secret"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f *.nfo
|
||||
|
||||
for inst in `ls ZeroTierOneInstaller-*-*-*_*_*`; do
|
||||
echo "Found installer: $inst"
|
||||
nfo="$inst.nfo"
|
||||
rm -f "$nfo"
|
||||
echo "tss=`date`" >>"$nfo"
|
||||
echo "vMajor=`echo $inst | cut -d - -f 4 | cut -d _ -f 1`" >>"$nfo"
|
||||
echo "vMinor=`echo $inst | cut -d - -f 4 | cut -d _ -f 2`" >>"$nfo"
|
||||
echo "vRevision=`echo $inst | cut -d - -f 4 | cut -d _ -f 3`" >>"$nfo"
|
||||
echo "signedBy=`cat $secret | cut -d : -f 1`" >>"$nfo"
|
||||
echo "ed25519=`./zerotier-idtool sign $secret $inst`" >>"$nfo"
|
||||
echo "url=http://download.zerotier.com/$inst" >>"$nfo"
|
||||
done
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Completely useless to outsiders. :)
|
||||
|
||||
scp ZeroTierOneInstaller-*-*-*_*_* nyarlathotep.zerotier.com:/www/download.zerotier.com/htdocs
|
@ -48,8 +48,9 @@ case "$system" in
|
||||
mkdir -p 'build-installer/var/lib/zerotier-one'
|
||||
cp -fp 'ext/installfiles/linux/uninstall.sh' 'build-installer/var/lib/zerotier-one'
|
||||
cp -fp 'zerotier-one' 'build-installer/var/lib/zerotier-one'
|
||||
mkdir -p 'build-installer/etc/init.d'
|
||||
cp -fp 'ext/installfiles/linux/init.d/zerotier-one' 'build-installer/etc/init.d'
|
||||
mkdir -p 'build-installer/tmp'
|
||||
cp -fp 'ext/installfiles/linux/init.d/zerotier-one' 'build-installer/tmp/init.d_zerotier-one'
|
||||
cp -fp 'ext/installfiles/linux/systemd/zerotier-one.service' 'build-installer/tmp/systemd_zerotier-one.service'
|
||||
|
||||
targ="ZeroTierOneInstaller-linux-${machine}-${vmajor}_${vminor}_${revision}"
|
||||
# Use gzip in Linux since some minimal Linux systems do not have bunzip2
|
||||
|
@ -1,36 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>tap</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.zerotier.tap</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>tap</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>KEXT</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>20131028</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>OSBundleLibraries</key>
|
||||
<dict>
|
||||
<key>com.apple.kpi.mach</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.bsd</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.libkern</key>
|
||||
<string>8.0</string>
|
||||
<key>com.apple.kpi.unsupported</key>
|
||||
<string>8.0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ext/bin/tap-windows/x64/WdfCoinstaller01011.dll
Normal file
BIN
ext/bin/tap-windows/x64/WdfCoinstaller01011.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
ext/bin/tap-windows/x64/zttap200.cat
Normal file
BIN
ext/bin/tap-windows/x64/zttap200.cat
Normal file
Binary file not shown.
@ -3,39 +3,40 @@ Signature="$WINDOWS NT$"
|
||||
Class=Net
|
||||
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider=%Provider%
|
||||
CatalogFile=ztTap100.cat
|
||||
|
||||
CatalogFile=zttap200.cat
|
||||
DriverVer=01/23/2014,15.19.17.816
|
||||
|
||||
[Strings]
|
||||
DeviceDescription = "ZeroTier One Ethernet Tap"
|
||||
Provider = "ZeroTier Networks"
|
||||
DeviceDescription = "ZeroTier One Virtual Network Port"
|
||||
Provider = "ZeroTier Networks LLC"
|
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
|
||||
[Manufacturer]
|
||||
%Provider%=ztTap100,NTamd64
|
||||
%Provider%=zttap200,NTamd64
|
||||
|
||||
[ztTap100]
|
||||
%DeviceDescription%=ztTap100.ndi,ztTap100
|
||||
[zttap200]
|
||||
%DeviceDescription%=zttap200.ndi,zttap200
|
||||
|
||||
[ztTap100.NTamd64]
|
||||
%DeviceDescription%=ztTap100.ndi,ztTap100
|
||||
[ztTap200.NTamd64]
|
||||
%DeviceDescription%=zttap200.ndi,zttap200
|
||||
|
||||
[ztTap100.ndi]
|
||||
CopyFiles = ztTap100.driver,ztTap100.files
|
||||
AddReg = ztTap100.reg
|
||||
AddReg = ztTap100.params.reg
|
||||
[zttap200.ndi]
|
||||
CopyFiles = zttap200.driver,zttap200.files
|
||||
AddReg = zttap200.reg
|
||||
AddReg = zttap200.params.reg
|
||||
Characteristics = 0x81
|
||||
|
||||
[ztTap100.ndi.Services]
|
||||
AddService = ztTap100, 2, ztTap100.service
|
||||
[zttap200.ndi.Services]
|
||||
AddService = zttap200, 2, zttap200.service
|
||||
|
||||
[ztTap100.reg]
|
||||
HKR, Ndi, Service, 0, "ztTap100"
|
||||
[zttap200.reg]
|
||||
HKR, Ndi, Service, 0, "zttap200"
|
||||
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
|
||||
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
|
||||
HKR, , Manufacturer, 0, "%Provider%"
|
||||
HKR, , ProductName, 0, "%DeviceDescription%"
|
||||
|
||||
[ztTap100.params.reg]
|
||||
[zttap200.params.reg]
|
||||
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
|
||||
HKR, Ndi\params\MTU, Type, 0, "int"
|
||||
HKR, Ndi\params\MTU, Default, 0, "2800"
|
||||
@ -52,33 +53,27 @@ HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
|
||||
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
|
||||
HKR, Ndi\params\MAC, Type, 0, "edit"
|
||||
HKR, Ndi\params\MAC, Optional, 0, "1"
|
||||
HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
|
||||
HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
|
||||
HKR, Ndi\params\AllowNonAdmin, Default, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
|
||||
|
||||
[ztTap100.service]
|
||||
[zttap200.service]
|
||||
DisplayName = %DeviceDescription%
|
||||
ServiceType = 1
|
||||
StartType = 3
|
||||
ErrorControl = 1
|
||||
LoadOrderGroup = NDIS
|
||||
ServiceBinary = %12%\ztTap100.sys
|
||||
ServiceBinary = %12%\zttap200.sys
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DeviceDescription%, ztTap100.sys
|
||||
1 = %DeviceDescription%, zttap200.sys
|
||||
|
||||
[SourceDisksFiles]
|
||||
ztTap100.sys = 1
|
||||
zttap200.sys = 1
|
||||
|
||||
[DestinationDirs]
|
||||
ztTap100.files = 11
|
||||
ztTap100.driver = 12
|
||||
zttap200.files = 11
|
||||
zttap200.driver = 12
|
||||
|
||||
[ztTap100.files]
|
||||
[zttap200.files]
|
||||
;
|
||||
|
||||
[ztTap100.driver]
|
||||
ztTap100.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
||||
[zttap200.driver]
|
||||
zttap200.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
BIN
ext/bin/tap-windows/x64/zttap200.sys
Normal file
BIN
ext/bin/tap-windows/x64/zttap200.sys
Normal file
Binary file not shown.
BIN
ext/bin/tap-windows/x86/WdfCoinstaller01011.dll
Normal file
BIN
ext/bin/tap-windows/x86/WdfCoinstaller01011.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
ext/bin/tap-windows/x86/zttap200.cat
Normal file
BIN
ext/bin/tap-windows/x86/zttap200.cat
Normal file
Binary file not shown.
@ -3,40 +3,37 @@ Signature="$WINDOWS NT$"
|
||||
Class=Net
|
||||
ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318}
|
||||
Provider=%Provider%
|
||||
CatalogFile=ztTap100.cat
|
||||
DriverVer=08/24/2013,16.12.30.608
|
||||
|
||||
CatalogFile=zttap200.cat
|
||||
DriverVer=01/24/2014,17.25.51.226
|
||||
|
||||
[Strings]
|
||||
DeviceDescription = "ZeroTier One Ethernet Tap"
|
||||
Provider = "ZeroTier Networks"
|
||||
DeviceDescription = "ZeroTier One Virtual Network Port"
|
||||
Provider = "ZeroTier Networks LLC"
|
||||
|
||||
; To build for x86, take NTamd64 off this and off the named section manually, build, then put it back!
|
||||
[Manufacturer]
|
||||
%Provider%=ztTap100,NTamd64
|
||||
%Provider%=zttap200
|
||||
|
||||
[ztTap100]
|
||||
%DeviceDescription%=ztTap100.ndi,ztTap100
|
||||
[zttap200]
|
||||
%DeviceDescription%=zttap200.ndi,zttap200
|
||||
|
||||
[ztTap100.NTamd64]
|
||||
%DeviceDescription%=ztTap100.ndi,ztTap100
|
||||
|
||||
[ztTap100.ndi]
|
||||
CopyFiles = ztTap100.driver,ztTap100.files
|
||||
AddReg = ztTap100.reg
|
||||
AddReg = ztTap100.params.reg
|
||||
[zttap200.ndi]
|
||||
CopyFiles = zttap200.driver,zttap200.files
|
||||
AddReg = zttap200.reg
|
||||
AddReg = zttap200.params.reg
|
||||
Characteristics = 0x81
|
||||
|
||||
[ztTap100.ndi.Services]
|
||||
AddService = ztTap100, 2, ztTap100.service
|
||||
[zttap200.ndi.Services]
|
||||
AddService = zttap200, 2, zttap200.service
|
||||
|
||||
[ztTap100.reg]
|
||||
HKR, Ndi, Service, 0, "ztTap100"
|
||||
[zttap200.reg]
|
||||
HKR, Ndi, Service, 0, "zttap200"
|
||||
HKR, Ndi\Interfaces, UpperRange, 0, "ndis5"
|
||||
HKR, Ndi\Interfaces, LowerRange, 0, "ethernet"
|
||||
HKR, , Manufacturer, 0, "%Provider%"
|
||||
HKR, , ProductName, 0, "%DeviceDescription%"
|
||||
|
||||
[ztTap100.params.reg]
|
||||
[zttap200.params.reg]
|
||||
HKR, Ndi\params\MTU, ParamDesc, 0, "MTU"
|
||||
HKR, Ndi\params\MTU, Type, 0, "int"
|
||||
HKR, Ndi\params\MTU, Default, 0, "2800"
|
||||
@ -53,33 +50,27 @@ HKR, Ndi\params\MediaStatus\enum, "1", 0, "Always Connected"
|
||||
HKR, Ndi\params\MAC, ParamDesc, 0, "MAC Address"
|
||||
HKR, Ndi\params\MAC, Type, 0, "edit"
|
||||
HKR, Ndi\params\MAC, Optional, 0, "1"
|
||||
HKR, Ndi\params\AllowNonAdmin, ParamDesc, 0, "Non-Admin Access"
|
||||
HKR, Ndi\params\AllowNonAdmin, Type, 0, "enum"
|
||||
HKR, Ndi\params\AllowNonAdmin, Default, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin, Optional, 0, "0"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "0", 0, "Not Allowed"
|
||||
HKR, Ndi\params\AllowNonAdmin\enum, "1", 0, "Allowed"
|
||||
|
||||
[ztTap100.service]
|
||||
[zttap200.service]
|
||||
DisplayName = %DeviceDescription%
|
||||
ServiceType = 1
|
||||
StartType = 3
|
||||
ErrorControl = 1
|
||||
LoadOrderGroup = NDIS
|
||||
ServiceBinary = %12%\ztTap100.sys
|
||||
ServiceBinary = %12%\zttap200.sys
|
||||
|
||||
[SourceDisksNames]
|
||||
1 = %DeviceDescription%, ztTap100.sys
|
||||
1 = %DeviceDescription%, zttap200.sys
|
||||
|
||||
[SourceDisksFiles]
|
||||
ztTap100.sys = 1
|
||||
zttap200.sys = 1
|
||||
|
||||
[DestinationDirs]
|
||||
ztTap100.files = 11
|
||||
ztTap100.driver = 12
|
||||
zttap200.files = 11
|
||||
zttap200.driver = 12
|
||||
|
||||
[ztTap100.files]
|
||||
[zttap200.files]
|
||||
;
|
||||
|
||||
[ztTap100.driver]
|
||||
ztTap100.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
||||
[zttap200.driver]
|
||||
zttap200.sys,,,6 ; COPYFLG_NOSKIP | COPYFLG_NOVERSIONCHECK
|
BIN
ext/bin/tap-windows/x86/zttap200.sys
Normal file
BIN
ext/bin/tap-windows/x86/zttap200.sys
Normal file
Binary file not shown.
@ -12,6 +12,22 @@ if [ "$UID" -ne 0 ]; then
|
||||
dryRun=1
|
||||
fi
|
||||
|
||||
# Detect systemd vs. regular init
|
||||
SYSTEMDUNITDIR=
|
||||
if [ -e /bin/systemctl -o -e /usr/bin/systemctl -o -e /usr/local/bin/systemctl -o -e /sbin/systemctl -o -e /usr/sbin/systemctl ]; then
|
||||
if [ -e /usr/bin/pkg-config ]; then
|
||||
SYSTEMDUNITDIR=`/usr/bin/pkg-config systemd --variable=systemdsystemunitdir`
|
||||
fi
|
||||
if [ -z "$SYSTEMDUNITDIR" -o ! -d "$SYSTEMDUNITDIR" ]; then
|
||||
if [ -d /usr/lib/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/usr/lib/systemd/system
|
||||
fi
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/etc/systemd/system
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $dryRun -gt 0 ]; then
|
||||
alias ln="echo '>> dry run: ln'"
|
||||
alias rm="echo '>> dry run: rm'"
|
||||
@ -21,6 +37,7 @@ if [ $dryRun -gt 0 ]; then
|
||||
alias chkconfig="echo '>> dry run: chkconfig'"
|
||||
alias zerotier-cli="echo '>> dry run: zerotier-cli'"
|
||||
alias service="echo '>> dry run: service'"
|
||||
alias systemctl="echo '>> dry run: systemctl'"
|
||||
fi
|
||||
|
||||
scriptPath="`dirname "$0"`/`basename "$0"`"
|
||||
@ -47,7 +64,7 @@ echo 'Extracting files...'
|
||||
if [ $dryRun -gt 0 ]; then
|
||||
echo ">> dry run: tail -c +$blobStart \"$scriptPath\" | gunzip -c | tar -xvop -C / -f -"
|
||||
else
|
||||
tail -c +$blobStart "$scriptPath" | gunzip -c | tar -xvop -C / -f -
|
||||
tail -c +$blobStart "$scriptPath" | gunzip -c | tar -xvop --no-overwrite-dir -C / -f -
|
||||
fi
|
||||
|
||||
if [ $dryRun -eq 0 -a ! -d "/var/lib/zerotier-one" ]; then
|
||||
@ -62,11 +79,34 @@ ln -sf /var/lib/zerotier-one/zerotier-one /usr/bin/zerotier-cli
|
||||
|
||||
echo 'Installing and (re-)starting zerotier-one daemon...'
|
||||
|
||||
chkconfig zerotier-one on
|
||||
service zerotier-one restart
|
||||
# Note: ensure that service restarts are the last thing this script actually
|
||||
# does, since these may kill the script itself. Also note the & to allow
|
||||
# them to finish independently.
|
||||
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
|
||||
# If this was updated or upgraded from an init.d based system, clean up the old
|
||||
# init.d stuff before installing directly via systemd.
|
||||
if [ -f /etc/init.d/zerotier-one ]; then
|
||||
if [ -e /sbin/chkconfig -o -e /usr/sbin/chkconfig -o -e /bin/chkconfig -o -e /usr/bin/chkconfig ]; then
|
||||
chkconfig zerotier-one off
|
||||
fi
|
||||
rm -f /etc/init.d/zerotier-one
|
||||
fi
|
||||
|
||||
cp -f /tmp/systemd_zerotier-one.service "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
rm -f /tmp/systemd_zerotier-one.service /tmp/init.d_zerotier-one
|
||||
|
||||
systemctl enable zerotier-one
|
||||
systemctl restart zerotier-one &
|
||||
else
|
||||
cp -f /tmp/init.d_zerotier-one /etc/init.d/zerotier-one
|
||||
chmod 0755 /etc/init.d/zerotier-one
|
||||
rm -f /tmp/systemd_zerotier-one.service /tmp/init.d_zerotier-one
|
||||
|
||||
chkconfig zerotier-one on
|
||||
service zerotier-one restart &
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
zerotier-cli info
|
||||
|
||||
exit 0
|
||||
|
||||
|
11
ext/installfiles/linux/systemd/zerotier-one.service
Normal file
11
ext/installfiles/linux/systemd/zerotier-one.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=ZeroTier One
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/var/lib/zerotier-one/zerotier-one
|
||||
Restart=always
|
||||
KillMode=process
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -7,6 +7,22 @@ if [ "$UID" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Detect systemd vs. regular init
|
||||
SYSTEMDUNITDIR=
|
||||
if [ -e /bin/systemctl -o -e /usr/bin/systemctl -o -e /usr/local/bin/systemctl -o -e /sbin/systemctl -o -e /usr/sbin/systemctl ]; then
|
||||
if [ -e /usr/bin/pkg-config ]; then
|
||||
SYSTEMDUNITDIR=`/usr/bin/pkg-config systemd --variable=systemdsystemunitdir`
|
||||
fi
|
||||
if [ -z "$SYSTEMDUNITDIR" -o ! -d "$SYSTEMDUNITDIR" ]; then
|
||||
if [ -d /usr/lib/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/usr/lib/systemd/system
|
||||
fi
|
||||
if [ -d /etc/systemd/system ]; then
|
||||
SYSTEMDUNITDIR=/etc/systemd/system
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
|
||||
echo "This will uninstall ZeroTier One, hit CTRL+C to abort."
|
||||
@ -14,20 +30,36 @@ echo "Waiting 5 seconds..."
|
||||
sleep 5
|
||||
|
||||
echo "Killing any running zerotier-one service..."
|
||||
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" ]; then
|
||||
systemctl stop zerotier-one
|
||||
systemctl disable zerotier-one
|
||||
else
|
||||
service stop zerotier-one
|
||||
fi
|
||||
sleep 1
|
||||
killall -q -TERM zerotier-one
|
||||
sleep 2
|
||||
sleep 1
|
||||
killall -q -KILL zerotier-one
|
||||
|
||||
echo "Removing SysV init items..."
|
||||
rm -fv /etc/init.d/zerotier-one
|
||||
find /etc/rc*.d -name '???zerotier-one' -print0 | xargs -0 rm -fv
|
||||
if [ -f /etc/init.d/zerotier-one ]; then
|
||||
echo "Removing SysV init items..."
|
||||
rm -f /etc/init.d/zerotier-one
|
||||
find /etc/rc*.d -name '???zerotier-one' -print0 | xargs -0 rm -f
|
||||
fi
|
||||
|
||||
if [ -n "$SYSTEMDUNITDIR" -a -d "$SYSTEMDUNITDIR" -a -f "$SYSTEMDUNITDIR/zerotier-one.service" ]; then
|
||||
echo "Removing systemd service..."
|
||||
rm -f "$SYSTEMDUNITDIR/zerotier-one.service"
|
||||
fi
|
||||
|
||||
echo "Erasing binary and support files..."
|
||||
cd /var/lib/zerotier-one
|
||||
rm -rfv zerotier-one *.persist authtoken.secret identity.public *.log *.pid *.sh updates.d networks.d iddb.d
|
||||
if [ -d /var/lib/zerotier-one ]; then
|
||||
cd /var/lib/zerotier-one
|
||||
rm -rf zerotier-one *.persist identity.public *.log *.pid *.sh updates.d networks.d iddb.d
|
||||
fi
|
||||
|
||||
echo "Erasing anything installed into system bin directories..."
|
||||
rm -fv /usr/local/bin/zerotier-* /usr/bin/zerotier-*
|
||||
rm -f /usr/local/bin/zerotier-cli /usr/bin/zerotier-cli
|
||||
|
||||
echo "Done."
|
||||
echo
|
||||
|
@ -127,14 +127,9 @@ fi
|
||||
echo 'Installing and (re-)starting zerotier-one service via launchctl...'
|
||||
|
||||
mv -f './Library/LaunchDaemons/com.zerotier.one.plist' '/Library/LaunchDaemons/'
|
||||
if [ ! -z "`launchctl list | grep -F com.zerotier.one`" ]; then
|
||||
launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist
|
||||
sleep 1
|
||||
fi
|
||||
launchctl load /Library/LaunchDaemons/com.zerotier.one.plist
|
||||
|
||||
sleep 1
|
||||
/usr/bin/zerotier-cli info
|
||||
# launchctl will restart us after exit if this is an online auto-update
|
||||
|
||||
cd /tmp
|
||||
rm -rf _zt1tmp
|
||||
|
149
ext/installfiles/windows/ZeroTier One.aip
Normal file
149
ext/installfiles/windows/ZeroTier One.aip
Normal file
@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<DOCUMENT Type="Advanced Installer" CreateVersion="10.9" version="10.9" Modules="simple" RootPath="." Language="en" Id="{DC564647-6BF0-4550-87F4-89C938D0159C}">
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiPropsComponent">
|
||||
<ROW Property="AI_BITMAP_DISPLAY_MODE" Value="0"/>
|
||||
<ROW Property="ALLUSERS" Value="1"/>
|
||||
<ROW Property="ARPCOMMENTS" Value="This installer database contains the logic and data required to install [|ProductName]." ValueLocId="*"/>
|
||||
<ROW Property="ARPCONTACT" Value="contact@zerotier.com"/>
|
||||
<ROW Property="ARPNOMODIFY" MultiBuildValue="DefaultBuild:1"/>
|
||||
<ROW Property="ARPNOREPAIR" Value="1"/>
|
||||
<ROW Property="ARPPRODUCTICON" Value="zt1icon.exe" Type="8"/>
|
||||
<ROW Property="ARPURLINFOABOUT" Value="https://www.zerotier.com/"/>
|
||||
<ROW Property="LIMITUI" MultiBuildValue="DefaultBuild:1"/>
|
||||
<ROW Property="MSIFASTINSTALL" MultiBuildValue="DefaultBuild:2"/>
|
||||
<ROW Property="Manufacturer" Value="ZeroTier Networks LLC"/>
|
||||
<ROW Property="ProductCode" Value="1033:{24DFCEE7-3AC9-4D39-BD53-974220C12043} " Type="16"/>
|
||||
<ROW Property="ProductLanguage" Value="1033"/>
|
||||
<ROW Property="ProductName" Value="ZeroTier One"/>
|
||||
<ROW Property="ProductVersion" Value="0.7.0" Type="32"/>
|
||||
<ROW Property="REBOOT" MultiBuildValue="DefaultBuild:ReallySuppress"/>
|
||||
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND"/>
|
||||
<ROW Property="UpgradeCode" Value="{B0E2A5F3-88B6-4E77-B922-CB4739B4C4C8}"/>
|
||||
<ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
|
||||
<ROW Property="WindowsType9XDisplay" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/>
|
||||
<ROW Property="WindowsTypeNT" MultiBuildValue="DefaultBuild:Windows 2000, Windows 2000 Service Pack 1, Windows 2000 Service Pack 2, Windows 2000 Service Pack 3, Windows 2000 Service Pack 4, Windows XP x86, Windows XP x86 Service Pack 1, Windows XP x86 Service Pack 2, Windows XP x86 Service Pack 3" ValueLocId="-"/>
|
||||
<ROW Property="WindowsTypeNT40" MultiBuildValue="DefaultBuild:Windows NT 4.0" ValueLocId="-"/>
|
||||
<ROW Property="WindowsTypeNT40Display" MultiBuildValue="DefaultBuild:Windows NT 4.0" ValueLocId="-"/>
|
||||
<ROW Property="WindowsTypeNT64" MultiBuildValue="DefaultBuild:Windows XP x64, Windows XP x64 Service Pack 1, Windows XP x64 Service Pack 2" ValueLocId="-"/>
|
||||
<ROW Property="WindowsTypeNT64Display" MultiBuildValue="DefaultBuild:Windows XP x64" ValueLocId="-"/>
|
||||
<ROW Property="WindowsTypeNTDisplay" MultiBuildValue="DefaultBuild:Windows 2000, Windows XP x86" ValueLocId="-"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiDirsComponent">
|
||||
<ROW Directory="APPDIR" Directory_Parent="TARGETDIR" DefaultDir="APPDIR:." IsPseudoRoot="1"/>
|
||||
<ROW Directory="TARGETDIR" DefaultDir="SourceDir"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiCompsComponent">
|
||||
<ROW Component="ProductInformation" ComponentId="{DB078D04-EA8E-4A7C-9001-89BAD932F9D9}" Directory_="APPDIR" Attributes="4" KeyPath="Version"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiFeatsComponent">
|
||||
<ROW Feature="MainFeature" Title="MainFeature" Description="Description" Display="1" Level="1" Directory_="APPDIR" Attributes="0" Components="ProductInformation"/>
|
||||
<ATTRIBUTE name="CurrentFeature" value="MainFeature"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.BuildComponent">
|
||||
<ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" Languages="en" InstallationType="4" UseLargeSchema="true"/>
|
||||
<ATTRIBUTE name="CurrentBuild" value="DefaultBuild"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.CacheComponent">
|
||||
<ATTRIBUTE name="Enable" value="false"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent">
|
||||
<ROW Path="<AI_DICTS>ui.ail"/>
|
||||
<ROW Path="<AI_DICTS>ui_en.ail"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.FragmentComponent">
|
||||
<ROW Fragment="CommonUI.aip" Path="<AI_FRAGS>CommonUI.aip"/>
|
||||
<ROW Fragment="MaintenanceTypeDlg.aip" Path="<AI_THEMES>classic\fragments\MaintenanceTypeDlg.aip"/>
|
||||
<ROW Fragment="MaintenanceWelcomeDlg.aip" Path="<AI_THEMES>classic\fragments\MaintenanceWelcomeDlg.aip"/>
|
||||
<ROW Fragment="SequenceDialogs.aip" Path="<AI_THEMES>classic\fragments\SequenceDialogs.aip"/>
|
||||
<ROW Fragment="Sequences.aip" Path="<AI_FRAGS>Sequences.aip"/>
|
||||
<ROW Fragment="StaticUIStrings.aip" Path="<AI_FRAGS>StaticUIStrings.aip"/>
|
||||
<ROW Fragment="UI.aip" Path="<AI_THEMES>classic\fragments\UI.aip"/>
|
||||
<ROW Fragment="Validation.aip" Path="<AI_FRAGS>Validation.aip"/>
|
||||
<ROW Fragment="VerifyRemoveDlg.aip" Path="<AI_THEMES>classic\fragments\VerifyRemoveDlg.aip"/>
|
||||
<ROW Fragment="VerifyRepairDlg.aip" Path="<AI_THEMES>classic\fragments\VerifyRepairDlg.aip"/>
|
||||
<ROW Fragment="WelcomeDlg.aip" Path="<AI_THEMES>classic\fragments\WelcomeDlg.aip"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiBinaryComponent">
|
||||
<ROW Name="aicustact.dll" SourcePath="<AI_CUSTACTS>aicustact.dll"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiControlComponent">
|
||||
<ROW Dialog_="WelcomeDlg" Control="WelcomeDlgDialogInitializer" Type="DialogInitializer" X="0" Y="0" Width="0" Height="0" Attributes="0" Order="-1" TextLocId="-" HelpLocId="-" ExtDataLocId="-"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiControlEventComponent">
|
||||
<ROW Dialog_="WelcomeDlg" Control_="Next" Event="EndDialog" Argument="Return" Condition="AI_INSTALL" Ordering="1"/>
|
||||
<ROW Dialog_="MaintenanceWelcomeDlg" Control_="Next" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT" Ordering="99"/>
|
||||
<ROW Dialog_="VerifyReadyDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_MAINT" Ordering="198"/>
|
||||
<ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="CustomizeDlg" Condition="AI_MAINT" Ordering="202"/>
|
||||
<ROW Dialog_="CustomizeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_MAINT" Ordering="101"/>
|
||||
<ROW Dialog_="CustomizeDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT" Ordering="1"/>
|
||||
<ROW Dialog_="MaintenanceTypeDlg" Control_="ChangeButton" Event="NewDialog" Argument="CustomizeDlg" Condition="AI_MAINT" Ordering="501"/>
|
||||
<ROW Dialog_="MaintenanceTypeDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceWelcomeDlg" Condition="AI_MAINT" Ordering="1"/>
|
||||
<ROW Dialog_="MaintenanceTypeDlg" Control_="RemoveButton" Event="NewDialog" Argument="VerifyRemoveDlg" Condition="AI_MAINT AND InstallMode="Remove"" Ordering="601"/>
|
||||
<ROW Dialog_="VerifyRemoveDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT AND InstallMode="Remove"" Ordering="1"/>
|
||||
<ROW Dialog_="MaintenanceTypeDlg" Control_="RepairButton" Event="NewDialog" Argument="VerifyRepairDlg" Condition="AI_MAINT AND InstallMode="Repair"" Ordering="601"/>
|
||||
<ROW Dialog_="VerifyRepairDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT AND InstallMode="Repair"" Ordering="1"/>
|
||||
<ROW Dialog_="VerifyRepairDlg" Control_="Repair" Event="EndDialog" Argument="Return" Condition="AI_MAINT AND InstallMode="Repair"" Ordering="399" Options="1"/>
|
||||
<ROW Dialog_="VerifyRemoveDlg" Control_="Remove" Event="EndDialog" Argument="Return" Condition="AI_MAINT AND InstallMode="Remove"" Ordering="299" Options="1"/>
|
||||
<ROW Dialog_="PatchWelcomeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_PATCH" Ordering="201"/>
|
||||
<ROW Dialog_="ResumeDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_RESUME" Ordering="299"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="Next" Event="SpawnDialog" Argument="OutOfRbDiskDlg" Condition="AI_INSTALL AND OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND (PROMPTROLLBACKCOST="P" OR NOT PROMPTROLLBACKCOST)" Ordering="2" Options="2"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="Next" Event="EnableRollback" Argument="False" Condition="AI_INSTALL AND OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 0 AND PROMPTROLLBACKCOST="D"" Ordering="3" Options="2"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="Next" Event="SpawnDialog" Argument="OutOfDiskDlg" Condition="AI_INSTALL AND ( (OutOfDiskSpace = 1 AND OutOfNoRbDiskSpace = 1) OR (OutOfDiskSpace = 1 AND PROMPTROLLBACKCOST="F") )" Ordering="4" Options="2"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="WelcomeDlgDialogInitializer" Event="[AI_ButtonText_Next_Orig]" Argument="[ButtonText_Next]" Condition="AI_INSTALL" Ordering="0" Options="2"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="WelcomeDlgDialogInitializer" Event="[ButtonText_Next]" Argument="[[AI_CommitButton]]" Condition="AI_INSTALL" Ordering="1" Options="2"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="WelcomeDlgDialogInitializer" Event="[AI_Text_Next_Orig]" Argument="[Text_Next]" Condition="AI_INSTALL" Ordering="2" Options="2"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="WelcomeDlgDialogInitializer" Event="[Text_Next]" Argument="[Text_Install]" Condition="AI_INSTALL" Ordering="3" Options="2"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="Back" Event="[ButtonText_Next]" Argument="[AI_ButtonText_Next_Orig]" Condition="AI_INSTALL" Ordering="0" Options="2"/>
|
||||
<ROW Dialog_="VerifyReadyDlg" Control_="Install" Event="EndDialog" Argument="Return" Condition="AI_PATCH" Ordering="199"/>
|
||||
<ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="PatchWelcomeDlg" Condition="AI_PATCH" Ordering="203"/>
|
||||
<ROW Dialog_="WelcomeDlg" Control_="Back" Event="[Text_Next]" Argument="[AI_Text_Next_Orig]" Condition="AI_INSTALL" Ordering="1" Options="2"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiCustActComponent">
|
||||
<ROW Action="AI_DOWNGRADE" Type="19" Target="4010"/>
|
||||
<ROW Action="AI_DpiContentScale" Type="1" Source="aicustact.dll" Target="DpiContentScale"/>
|
||||
<ROW Action="AI_InstallModeCheck" Type="1" Source="aicustact.dll" Target="UpdateInstallMode" WithoutSeq="true"/>
|
||||
<ROW Action="AI_PREPARE_UPGRADE" Type="65" Source="aicustact.dll" Target="PrepareUpgrade"/>
|
||||
<ROW Action="AI_RESTORE_LOCATION" Type="65" Source="aicustact.dll" Target="RestoreLocation"/>
|
||||
<ROW Action="AI_ResolveKnownFolders" Type="1" Source="aicustact.dll" Target="AI_ResolveKnownFolders"/>
|
||||
<ROW Action="AI_ResolveLocalizedCredentials" Type="1" Source="aicustact.dll" Target="GetLocalizedCredentials"/>
|
||||
<ROW Action="AI_SHOW_LOG" Type="65" Source="aicustact.dll" Target="LaunchLogFile" WithoutSeq="true"/>
|
||||
<ROW Action="AI_STORE_LOCATION" Type="51" Source="ARPINSTALLLOCATION" Target="[APPDIR]"/>
|
||||
<ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]"/>
|
||||
<ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
|
||||
<ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiIconsComponent">
|
||||
<ROW Name="zt1icon.exe" SourcePath="..\..\..\ZeroTierUI\zt1icon.ico" Index="0"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiInstExSeqComponent">
|
||||
<ROW Action="AI_DOWNGRADE" Condition="AI_NEWERPRODUCTFOUND AND (UILevel <> 5)" Sequence="210"/>
|
||||
<ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
|
||||
<ROW Action="AI_STORE_LOCATION" Condition="(Not Installed) OR REINSTALL" Sequence="1501"/>
|
||||
<ROW Action="AI_PREPARE_UPGRADE" Condition="AI_UPGRADE="No" AND (Not Installed)" Sequence="1399"/>
|
||||
<ROW Action="AI_ResolveKnownFolders" Sequence="52"/>
|
||||
<ROW Action="AI_ResolveLocalizedCredentials" Sequence="51"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiInstallUISequenceComponent">
|
||||
<ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
|
||||
<ROW Action="AI_ResolveKnownFolders" Sequence="53"/>
|
||||
<ROW Action="AI_ResolveLocalizedCredentials" Sequence="52"/>
|
||||
<ROW Action="AI_DpiContentScale" Sequence="51"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiLaunchConditionsComponent">
|
||||
<ROW Condition="( Version9X OR ( NOT VersionNT64 ) OR ( VersionNT64 AND ((VersionNT64 <> 502) OR (((VersionNT64 = 502) AND (ServicePackLevel >= 1)) OR (MsiNTProductType <> 1))) AND ((VersionNT64 <> 502) OR (((VersionNT64 = 502) AND (ServicePackLevel <> 1)) OR (MsiNTProductType <> 1))) AND ((VersionNT64 <> 502) OR (((VersionNT64 = 502) AND (ServicePackLevel <> 2)) OR (MsiNTProductType <> 1))) ) )" Description="[ProductName] cannot be installed on the following Windows versions: [WindowsTypeNT64Display]" DescriptionLocId="AI.LaunchCondition.NoSpecificNT64" IsPredefined="true" Builds="DefaultBuild"/>
|
||||
<ROW Condition="( Version9X OR VersionNT64 OR ( VersionNT AND ((VersionNT <> 500) OR ((VersionNT = 500) AND (ServicePackLevel >= 1))) AND ((VersionNT <> 500) OR ((VersionNT = 500) AND (ServicePackLevel <> 1))) AND ((VersionNT <> 500) OR ((VersionNT = 500) AND (ServicePackLevel <> 2))) AND ((VersionNT <> 500) OR ((VersionNT = 500) AND (ServicePackLevel <> 3))) AND ((VersionNT <> 500) OR ((VersionNT = 500) AND (ServicePackLevel <> 4))) AND (((VersionNT <> 501) OR ((VersionNT = 501) AND (ServicePackLevel >= 1))) OR VersionNT64) AND (((VersionNT <> 501) OR ((VersionNT = 501) AND (ServicePackLevel <> 1))) OR VersionNT64) AND (((VersionNT <> 501) OR ((VersionNT = 501) AND (ServicePackLevel <> 2))) OR VersionNT64) AND (((VersionNT <> 501) OR ((VersionNT = 501) AND (ServicePackLevel <> 3))) OR VersionNT64) ) )" Description="[ProductName] cannot be installed on the following Windows versions: [WindowsTypeNTDisplay]" DescriptionLocId="AI.LaunchCondition.NoSpecificNT" IsPredefined="true" Builds="DefaultBuild"/>
|
||||
<ROW Condition="(VersionNT <> 400)" Description="[ProductName] cannot be installed on the following Windows versions: [WindowsTypeNT40Display]" DescriptionLocId="AI.LaunchCondition.NoNT40" IsPredefined="true" Builds="DefaultBuild"/>
|
||||
<ROW Condition="VersionNT" Description="[ProductName] cannot be installed on [WindowsType9XDisplay]" DescriptionLocId="AI.LaunchCondition.No9X" IsPredefined="true" Builds="DefaultBuild"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiRegsComponent">
|
||||
<ROW Registry="Path" Root="-1" Key="Software\[Manufacturer]\[ProductName]" Name="Path" Value="[APPDIR]" Component_="ProductInformation"/>
|
||||
<ROW Registry="Version" Root="-1" Key="Software\[Manufacturer]\[ProductName]" Name="Version" Value="[ProductVersion]" Component_="ProductInformation"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiThemeComponent">
|
||||
<ATTRIBUTE name="UsedTheme" value="classic"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiUpgradeComponent">
|
||||
<ROW UpgradeCode="[|UpgradeCode]" VersionMin="0.0.1" VersionMax="[|ProductVersion]" Attributes="257" ActionProperty="OLDPRODUCTS"/>
|
||||
<ROW UpgradeCode="[|UpgradeCode]" VersionMin="[|ProductVersion]" Attributes="2" ActionProperty="AI_NEWERPRODUCTFOUND"/>
|
||||
</COMPONENT>
|
||||
</DOCUMENT>
|
@ -1,141 +0,0 @@
|
||||
|
||||
November 1, 2011:
|
||||
o Make the netmask address family fix work without knowledge of the struct
|
||||
ifaddr definition. This fixes a crash on Lion, where the layout of the
|
||||
structure has been changed, but at the cost of the fix no longer working for
|
||||
IPv6. I think this is OK though, since mDNSResponder has been fixed on
|
||||
Leopard and beyond to no longer require the hack.
|
||||
o Proper multicast address checking for tun; multicast should now work reliably
|
||||
with IP and IPv6 on tun also.
|
||||
o A quite comprehensive test suite has been added that allows for quick release
|
||||
testing.
|
||||
o PPC support has been dropped due to XCode 4 no longer supporting PPC arch.
|
||||
|
||||
September 13, 2009:
|
||||
o Change linker options to produce 64 bit kext bundle for Snow Leopard.
|
||||
o Switch from kmem_alloc and friends to OSAlloc for memory allocation and
|
||||
avoid the delay() call. Respective symbols are not available on 64 bit
|
||||
kernels anymore.
|
||||
|
||||
September 5, 2009:
|
||||
o Initial Snow Leopard port. Thanks to various people contributing patches in
|
||||
the bugtracker. The new official version can only be compiled on Snow
|
||||
Leopard but has been tested to work on all Tiger, Leopard and Snow Leopard
|
||||
o Clean up unused locking code and switch to rwlocks even for simple mutexes,
|
||||
which avoids a symbol incompatibility for Tiger and Leopard.
|
||||
o Clean up compilation flags in the Makefiles.
|
||||
|
||||
July 4, 2008:
|
||||
o Adapt the former Leopard package to also be installable on Tiger systems.
|
||||
This obsoletes the Tiger version, both Leopard and Tiger are now supported
|
||||
by a single package.
|
||||
|
||||
June 7, 2008:
|
||||
o Protect the selwakeup() call by the lock. This fixes incorrect select()
|
||||
behaviour, thanks to Roland Wendelin for reporting this.
|
||||
o Fix tuntap_mbuf_queue::size initialization
|
||||
o Use a proper wait condition for synchronization when detaching the network
|
||||
interface. The old code would crash if the if_detached() handler was called
|
||||
from a different thread than unregister_interface().
|
||||
|
||||
January 21, 2008:
|
||||
o Work around an issue in the Darwin kernel. When unregistering an interface,
|
||||
addresses are not properly removed from the interface. This leads to
|
||||
crashes and other problems when reusing the interface. Introduce an ugly
|
||||
hack that tries to remove all interface addresses when shutting the
|
||||
interface down.
|
||||
o Fix a small mbuf leak that could occur when the output queue was full.
|
||||
Thanks to Oleg Dolgov for reporting this.
|
||||
|
||||
December 21, 2007:
|
||||
o Fix paths in the startup item postflight scripts
|
||||
o Check if_ioctl arguments more defensively after a report of a panic after
|
||||
receiving a NULL arg.
|
||||
|
||||
November 14, 2007:
|
||||
o I have done a complete rework of the installer package generation. The
|
||||
package is now edited in PackageMaker. The distribution package can still
|
||||
be built from the commandline though.
|
||||
o Fix incorrect permission & ownership of the installed files.
|
||||
|
||||
Oktober 11, 2007:
|
||||
o Fix the permissions of the postflight scripts. Installer packages should work
|
||||
again.
|
||||
o Drop the kmod and kmodc++ in the linker command, they seem to be unneeded
|
||||
with Leopard.
|
||||
|
||||
September 20, 2007:
|
||||
o Initial Leopard port, it's basically the latest Tiger version with some
|
||||
Leopard-related fixes and s/Tiger/Leopard/g
|
||||
o I have switched to a proper version management system (git) and could
|
||||
remove some of the CVS hacks subsequently.
|
||||
o The installation packages have been reworked a bit, they now install into
|
||||
/System/Extensions and /System/StartupItems directly by using
|
||||
DestinationPaths.
|
||||
|
||||
May 13, 2006:
|
||||
o This version is not stable, it may crash, sorry.
|
||||
o Universal binaries that run on ppc and intel macs.
|
||||
o Adds tap MAC address randomization
|
||||
o Redesigned locking.
|
||||
o Better multicast support
|
||||
o mDNSResponder workaround, so that the tap interfaces should get picked up
|
||||
now. Note that we are fixing ifconfig/kernel behaviour here.
|
||||
o All tapX and tunX devices are visible in /dev at all times, network
|
||||
interfaces still created dynamically, though.
|
||||
o Startup items moved to /Library/StartupItems
|
||||
|
||||
May 17, 2005:
|
||||
o Initial Tiger port. We now have KPI-style interfaces. I guess the Tiger
|
||||
version is little slower than the Panther version because of all the
|
||||
wrapping and hiding in the kernel.
|
||||
o The kernel extensions moved to /Library/Extensions. That is the place where
|
||||
non-Apple kexts are supposed to live.
|
||||
|
||||
April 21, 2005:
|
||||
o I added support in tun for AF prepending like some BSDs do. Thanks to Dennis
|
||||
kSchneider for mailing the initial patch. You can also set the value of
|
||||
AF_INET6 to be used.
|
||||
o I finally found that major bug causing crashes (especially on multiprocessor
|
||||
machines). It also caused a memory leak (lost mbufs), and might have caused
|
||||
performance/througput/data-loss problems. Everyone is recommended to upgrade.
|
||||
|
||||
April 6, 2005:
|
||||
o I rewrote the common part concerning the tun and tap initialization and
|
||||
cleanup. This should make the code more maintainable (less duplication).
|
||||
o The devices now reinitialize to the state they were started in when they
|
||||
are closed by an application. This concerns IP addresses for example.
|
||||
o I changed the package building system to use PackageMaker.app in batch
|
||||
mode. The packages also check for version 10.3 now, so nobody should be
|
||||
able to install tun/tap on 10.2 using installer packages. Furthermore I
|
||||
have sprinkled some warnings telling you not to use tun/tap on SMP machines
|
||||
over the installation process ;-)
|
||||
o Some minor locking fixes.
|
||||
|
||||
November 19, 2004:
|
||||
o Jamie Wood reported that the packet queue in the driver could be considered
|
||||
empty even if there were packets in it. This was probably caused by a
|
||||
synchronization problem that should be fixed now. People encountering
|
||||
timeouts etc. should try the new version.
|
||||
o I finally implemented support for changing the interface MTU. The driver
|
||||
enforces the MTU when writing packets to the character device now. However,
|
||||
packets coming from the kernel are not checked.
|
||||
|
||||
September 9, 2004:
|
||||
o Marcello Teodori told me that the tun driver wasn't working with openvpn.
|
||||
The problem was the fcntl call, fixed that. Should work now. Thanks
|
||||
Marcello!
|
||||
o changed the tun driver not to prepend the address family field before each
|
||||
and every packet (which is the behaviour of OpenBSD). As there is currently
|
||||
only IPv4 and IPv6 support there is no problem with the standard tun
|
||||
approach used on other OSes. This should make the driver much more
|
||||
compatible.
|
||||
o Did a script and makefile support so that the installer packages can now be
|
||||
built from the command prompt. Unfortunately this might break things
|
||||
someday as I am not using the 'official' way to build the packages
|
||||
o Cleaned up installer packages a little.
|
||||
|
||||
August 24, 2004:
|
||||
o initial version put online
|
||||
o basic tun/tap support, tap working with qemu
|
||||
|
@ -2,7 +2,12 @@ Building the tap for both x86_64 and i386 requires an older version of the
|
||||
Xcode tools than what now ships for Mavericks (10.9). The newer version
|
||||
does not support creating i386 kernel images.
|
||||
|
||||
These can be obtained from:
|
||||
At the moment this is done on an OSX 10.6 virtual image that is used for
|
||||
building. (It doesn't have to be done often.) Then the kext is signed on
|
||||
the regular build system. That's because images built on newer OSX don't
|
||||
seem to load on 10.6 but 10.6 built kexts seem fine on 10.9. Go figure.
|
||||
|
||||
Older Xcode can also be found at:
|
||||
|
||||
https://developer.apple.com/downloads
|
||||
|
||||
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>ethertap device kernel extension</key>
|
||||
<string>ethertap kernel extension</string>
|
||||
<key>Initializing tap devices</key>
|
||||
<string>Initializing tap devices</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
Description = "ethertap device kernel extension";
|
||||
Provides = ("ethertap");
|
||||
Requires = ("Network Configuration");
|
||||
OrderPreference = "None";
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
##
|
||||
# load the tap kext
|
||||
##
|
||||
|
||||
. /etc/rc.common
|
||||
|
||||
StartService ()
|
||||
{
|
||||
ConsoleMessage "Initializing tap devices"
|
||||
|
||||
if [ -d /Library/Extensions/tap.kext ]; then
|
||||
kextload /Library/Extensions/tap.kext
|
||||
fi
|
||||
}
|
||||
|
||||
StopService ()
|
||||
{
|
||||
if [ -d /Library/Extensions/tap.kext ]; then
|
||||
kextunload /Library/Extensions/tap.kext
|
||||
fi
|
||||
}
|
||||
|
||||
RestartService ()
|
||||
{
|
||||
if [ -d /Library/Extensions/tap.kext ]; then
|
||||
kextunload /Library/Extensions/tap.kext
|
||||
kextload /Library/Extensions/tap.kext
|
||||
fi
|
||||
}
|
||||
|
||||
RunService "$1"
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>ip tunnel device kernel extension</key>
|
||||
<string>ip tunnel kernel extension</string>
|
||||
<key>Initializing tun devices</key>
|
||||
<string>Initializing tun devices</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
Description = "ip tunnel device kernel extension";
|
||||
Provides = ("tun");
|
||||
Requires = ("Network Configuration");
|
||||
OrderPreference = "None";
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
##
|
||||
# load the tun kext
|
||||
##
|
||||
|
||||
. /etc/rc.common
|
||||
|
||||
StartService ()
|
||||
{
|
||||
ConsoleMessage "Initializing tun devices"
|
||||
|
||||
if [ -d /Library/Extensions/tun.kext ]; then
|
||||
kextload /Library/Extensions/tun.kext
|
||||
fi
|
||||
}
|
||||
|
||||
StopService ()
|
||||
{
|
||||
if [ -d /Library/Extensions/tun.kext ]; then
|
||||
kextunload /Library/Extensions/tun.kext
|
||||
fi
|
||||
}
|
||||
|
||||
RestartService ()
|
||||
{
|
||||
if [ -d /Library/Extensions/tun.kext ]; then
|
||||
kextunload /Library/Extensions/tun.kext
|
||||
kextload /Library/Extensions/tun.kext
|
||||
fi
|
||||
}
|
||||
|
||||
RunService "$1"
|
234
main.cpp
234
main.cpp
@ -41,6 +41,10 @@
|
||||
#include <Windows.h>
|
||||
#include <tchar.h>
|
||||
#include <wchar.h>
|
||||
#include <lmcons.h>
|
||||
#include "windows/ZeroTierOne/ServiceInstaller.h"
|
||||
#include "windows/ZeroTierOne/ServiceBase.h"
|
||||
#include "windows/ZeroTierOne/ZeroTierOneService.h"
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
@ -92,6 +96,11 @@ static void printHelp(const char *cn,FILE *out)
|
||||
fprintf(out," -c<port> - Bind to this port for local control packets"ZT_EOL_S);
|
||||
fprintf(out," -q - Send a query to a running service (zerotier-cli)"ZT_EOL_S);
|
||||
fprintf(out," -i - Run idtool command (zerotier-idtool)"ZT_EOL_S);
|
||||
#ifdef __WINDOWS__
|
||||
fprintf(out," -C - Run from command line instead of as service (Windows)"ZT_EOL_S);
|
||||
fprintf(out," -I - Install Windows service (Windows)"ZT_EOL_S);
|
||||
fprintf(out," -R - Uninstall Windows service (Windows)"ZT_EOL_S);
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace ZeroTierCLI { // ---------------------------------------------------
|
||||
@ -317,8 +326,8 @@ static int main(int argc,char **argv)
|
||||
fprintf(stderr,"%s is not readable"ZT_EOL_S,argv[3]);
|
||||
return -1;
|
||||
}
|
||||
C25519::Signature signature = id.sign(inf.data(),inf.length());
|
||||
printf("%s",Utils::hex(signature.data,signature.size()).c_str());
|
||||
C25519::Signature signature = id.sign(inf.data(),(unsigned int)inf.length());
|
||||
printf("%s",Utils::hex(signature.data,(unsigned int)signature.size()).c_str());
|
||||
} else if (!strcmp(argv[1],"verify")) {
|
||||
if (argc < 4) {
|
||||
printHelp(stderr,argv[0]);
|
||||
@ -338,7 +347,7 @@ static int main(int argc,char **argv)
|
||||
}
|
||||
|
||||
std::string signature(Utils::unhex(argv[4]));
|
||||
if ((signature.length() > ZT_ADDRESS_LENGTH)&&(id.verify(inf.data(),inf.length(),signature.data(),signature.length()))) {
|
||||
if ((signature.length() > ZT_ADDRESS_LENGTH)&&(id.verify(inf.data(),(unsigned int)inf.length(),signature.data(),(unsigned int)signature.length()))) {
|
||||
printf("%s signature valid"ZT_EOL_S,argv[3]);
|
||||
} else {
|
||||
fprintf(stderr,"%s signature check FAILED"ZT_EOL_S,argv[3]);
|
||||
@ -356,6 +365,12 @@ static int main(int argc,char **argv)
|
||||
} // namespace ZeroTierIdTool ------------------------------------------------
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
static void sighandlerHup(int sig)
|
||||
{
|
||||
Node *n = node;
|
||||
if (n)
|
||||
n->resync();
|
||||
}
|
||||
static void sighandlerQuit(int sig)
|
||||
{
|
||||
Node *n = node;
|
||||
@ -366,6 +381,7 @@ static void sighandlerQuit(int sig)
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
// Console signal handler routine to allow CTRL+C to work, mostly for testing
|
||||
static BOOL WINAPI _handlerRoutine(DWORD dwCtrlType)
|
||||
{
|
||||
switch(dwCtrlType) {
|
||||
@ -380,7 +396,97 @@ static BOOL WINAPI _handlerRoutine(DWORD dwCtrlType)
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Returns true if this is running as the local administrator
|
||||
static BOOL IsCurrentUserLocalAdministrator(void)
|
||||
{
|
||||
BOOL fReturn = FALSE;
|
||||
DWORD dwStatus;
|
||||
DWORD dwAccessMask;
|
||||
DWORD dwAccessDesired;
|
||||
DWORD dwACLSize;
|
||||
DWORD dwStructureSize = sizeof(PRIVILEGE_SET);
|
||||
PACL pACL = NULL;
|
||||
PSID psidAdmin = NULL;
|
||||
|
||||
HANDLE hToken = NULL;
|
||||
HANDLE hImpersonationToken = NULL;
|
||||
|
||||
PRIVILEGE_SET ps;
|
||||
GENERIC_MAPPING GenericMapping;
|
||||
|
||||
PSECURITY_DESCRIPTOR psdAdmin = NULL;
|
||||
SID_IDENTIFIER_AUTHORITY SystemSidAuthority = SECURITY_NT_AUTHORITY;
|
||||
|
||||
const DWORD ACCESS_READ = 1;
|
||||
const DWORD ACCESS_WRITE = 2;
|
||||
|
||||
__try
|
||||
{
|
||||
if (!OpenThreadToken(GetCurrentThread(), TOKEN_DUPLICATE|TOKEN_QUERY,TRUE,&hToken))
|
||||
{
|
||||
if (GetLastError() != ERROR_NO_TOKEN)
|
||||
__leave;
|
||||
if (!OpenProcessToken(GetCurrentProcess(),TOKEN_DUPLICATE|TOKEN_QUERY, &hToken))
|
||||
__leave;
|
||||
}
|
||||
if (!DuplicateToken (hToken, SecurityImpersonation,&hImpersonationToken))
|
||||
__leave;
|
||||
if (!AllocateAndInitializeSid(&SystemSidAuthority, 2,
|
||||
SECURITY_BUILTIN_DOMAIN_RID,
|
||||
DOMAIN_ALIAS_RID_ADMINS,
|
||||
0, 0, 0, 0, 0, 0, &psidAdmin))
|
||||
__leave;
|
||||
psdAdmin = LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
|
||||
if (psdAdmin == NULL)
|
||||
__leave;
|
||||
if (!InitializeSecurityDescriptor(psdAdmin,SECURITY_DESCRIPTOR_REVISION))
|
||||
__leave;
|
||||
dwACLSize = sizeof(ACL) + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidAdmin) - sizeof(DWORD);
|
||||
pACL = (PACL)LocalAlloc(LPTR, dwACLSize);
|
||||
if (pACL == NULL)
|
||||
__leave;
|
||||
if (!InitializeAcl(pACL, dwACLSize, ACL_REVISION2))
|
||||
__leave;
|
||||
dwAccessMask= ACCESS_READ | ACCESS_WRITE;
|
||||
if (!AddAccessAllowedAce(pACL, ACL_REVISION2, dwAccessMask, psidAdmin))
|
||||
__leave;
|
||||
if (!SetSecurityDescriptorDacl(psdAdmin, TRUE, pACL, FALSE))
|
||||
__leave;
|
||||
|
||||
SetSecurityDescriptorGroup(psdAdmin, psidAdmin, FALSE);
|
||||
SetSecurityDescriptorOwner(psdAdmin, psidAdmin, FALSE);
|
||||
|
||||
if (!IsValidSecurityDescriptor(psdAdmin))
|
||||
__leave;
|
||||
dwAccessDesired = ACCESS_READ;
|
||||
|
||||
GenericMapping.GenericRead = ACCESS_READ;
|
||||
GenericMapping.GenericWrite = ACCESS_WRITE;
|
||||
GenericMapping.GenericExecute = 0;
|
||||
GenericMapping.GenericAll = ACCESS_READ | ACCESS_WRITE;
|
||||
|
||||
if (!AccessCheck(psdAdmin, hImpersonationToken, dwAccessDesired,
|
||||
&GenericMapping, &ps, &dwStructureSize, &dwStatus,
|
||||
&fReturn))
|
||||
{
|
||||
fReturn = FALSE;
|
||||
__leave;
|
||||
}
|
||||
}
|
||||
__finally
|
||||
{
|
||||
// Clean up.
|
||||
if (pACL) LocalFree(pACL);
|
||||
if (psdAdmin) LocalFree(psdAdmin);
|
||||
if (psidAdmin) FreeSid(psidAdmin);
|
||||
if (hImpersonationToken) CloseHandle (hImpersonationToken);
|
||||
if (hToken) CloseHandle (hToken);
|
||||
}
|
||||
|
||||
return fReturn;
|
||||
}
|
||||
#endif // __WINDOWS__
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
int _tmain(int argc, _TCHAR* argv[])
|
||||
@ -389,7 +495,7 @@ int main(int argc,char **argv)
|
||||
#endif
|
||||
{
|
||||
#ifdef __UNIX_LIKE__
|
||||
signal(SIGHUP,SIG_IGN);
|
||||
signal(SIGHUP,&sighandlerHup);
|
||||
signal(SIGPIPE,SIG_IGN);
|
||||
signal(SIGUSR1,SIG_IGN);
|
||||
signal(SIGUSR2,SIG_IGN);
|
||||
@ -413,6 +519,9 @@ int main(int argc,char **argv)
|
||||
const char *homeDir = (const char *)0;
|
||||
unsigned int port = 0;
|
||||
unsigned int controlPort = 0;
|
||||
#ifdef __WINDOWS__
|
||||
bool winRunFromCommandLine = false;
|
||||
#endif
|
||||
for(int i=1;i<argc;++i) {
|
||||
if (argv[i][0] == '-') {
|
||||
switch(argv[i][1]) {
|
||||
@ -443,6 +552,35 @@ int main(int argc,char **argv)
|
||||
printHelp(argv[0],stderr);
|
||||
return 0;
|
||||
} else return ZeroTierIdTool::main(argc,argv);
|
||||
#ifdef __WINDOWS__
|
||||
case 'C':
|
||||
winRunFromCommandLine = true;
|
||||
break;
|
||||
case 'I': { // install self as service
|
||||
if (IsCurrentUserLocalAdministrator() != TRUE) {
|
||||
fprintf(stderr,"%s: must be run as a local administrator."ZT_EOL_S,argv[0]);
|
||||
return 1;
|
||||
}
|
||||
std::string ret(InstallService(ZT_SERVICE_NAME,ZT_SERVICE_DISPLAY_NAME,ZT_SERVICE_START_TYPE,ZT_SERVICE_DEPENDENCIES,ZT_SERVICE_ACCOUNT,ZT_SERVICE_PASSWORD));
|
||||
if (ret.length()) {
|
||||
fprintf(stderr,"%s: unable to install service: %s"ZT_EOL_S,argv[0],ret.c_str());
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
} break;
|
||||
case 'R': { // uninstall self as service
|
||||
if (IsCurrentUserLocalAdministrator() != TRUE) {
|
||||
fprintf(stderr,"%s: must be run as a local administrator."ZT_EOL_S,argv[0]);
|
||||
return 1;
|
||||
}
|
||||
std::string ret(UninstallService(ZT_SERVICE_NAME));
|
||||
if (ret.length()) {
|
||||
fprintf(stderr,"%s: unable to uninstall service: %s"ZT_EOL_S,argv[0],ret.c_str());
|
||||
return 3;
|
||||
}
|
||||
return 0;
|
||||
} break;
|
||||
#endif
|
||||
case 'h':
|
||||
case '?':
|
||||
default:
|
||||
@ -477,39 +615,63 @@ int main(int argc,char **argv)
|
||||
fclose(pf);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef __WINDOWS__
|
||||
if (IsCurrentUserLocalAdministrator() != TRUE) {
|
||||
fprintf(stderr,"%s: must be run as a local administrator."ZT_EOL_S,argv[0]);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int exitCode = 0;
|
||||
|
||||
try {
|
||||
node = new Node(homeDir,port,controlPort);
|
||||
switch(node->run()) {
|
||||
case Node::NODE_RESTART_FOR_UPGRADE: {
|
||||
#ifdef __UNIX_LIKE__
|
||||
const char *upgPath = node->reasonForTermination();
|
||||
if (upgPath) {
|
||||
Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str());
|
||||
execl(upgPath,upgPath,(char *)0);
|
||||
}
|
||||
exitCode = 2;
|
||||
fprintf(stderr,"%s: abnormal termination: unable to execute update at %s\n",argv[0],(upgPath) ? upgPath : "(unknown path)");
|
||||
#endif
|
||||
} break;
|
||||
case Node::NODE_UNRECOVERABLE_ERROR: {
|
||||
exitCode = 3;
|
||||
const char *termReason = node->reasonForTermination();
|
||||
fprintf(stderr,"%s: abnormal termination: %s\n",argv[0],(termReason) ? termReason : "(unknown reason)");
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
#ifdef __WINDOWS__
|
||||
if (!winRunFromCommandLine) {
|
||||
ZeroTierOneService zt1Service;
|
||||
if (CServiceBase::Run(zt1Service) == TRUE) {
|
||||
// Normal termination of service process
|
||||
return 0;
|
||||
} else {
|
||||
fprintf(stderr,"%s: unable to start service (try -h for help)"ZT_EOL_S,argv[0]);
|
||||
return 1;
|
||||
}
|
||||
delete node;
|
||||
node = (Node *)0;
|
||||
} catch ( ... ) {}
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str());
|
||||
} else
|
||||
#endif
|
||||
|
||||
return exitCode;
|
||||
{
|
||||
int exitCode = 0;
|
||||
try {
|
||||
node = new Node(homeDir,port,controlPort);
|
||||
switch(node->run()) {
|
||||
#ifndef __WINDOWS__
|
||||
case Node::NODE_RESTART_FOR_UPGRADE: {
|
||||
const char *upgPath = node->reasonForTermination();
|
||||
// On Unix-type OSes we exec() right into the upgrade. This in turn will
|
||||
// end with us being re-launched either via the upgrade itself or something
|
||||
// like OSX's launchd.
|
||||
if (upgPath) {
|
||||
Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str());
|
||||
::execl(upgPath,upgPath,(char *)0);
|
||||
}
|
||||
exitCode = 3;
|
||||
fprintf(stderr,"%s: abnormal termination: unable to execute update at %s\n",argv[0],(upgPath) ? upgPath : "(unknown path)");
|
||||
} break;
|
||||
#endif
|
||||
case Node::NODE_UNRECOVERABLE_ERROR: {
|
||||
exitCode = 3;
|
||||
const char *termReason = node->reasonForTermination();
|
||||
fprintf(stderr,"%s: abnormal termination: %s\n",argv[0],(termReason) ? termReason : "(unknown reason)");
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
delete node;
|
||||
node = (Node *)0;
|
||||
} catch ( ... ) {
|
||||
fprintf(stderr,"%s: unexpected exception!"ZT_EOL_S,argv[0]);
|
||||
exitCode = 3;
|
||||
}
|
||||
#ifdef __UNIX_LIKE__
|
||||
Utils::rm((std::string(homeDir)+"/zerotier-one.pid").c_str());
|
||||
#endif
|
||||
return exitCode;
|
||||
}
|
||||
}
|
||||
|
17
make-mac.mk
17
make-mac.mk
@ -50,26 +50,29 @@ mac-ui: FORCE
|
||||
mkdir -p build-ZeroTierUI-release
|
||||
cd build-ZeroTierUI-release ; ../../Qt/bin/qmake ../ZeroTierUI/ZeroTierUI.pro ; make -j 4
|
||||
strip "build-ZeroTierUI-release/ZeroTier One.app/Contents/MacOS/ZeroTier One"
|
||||
cp -Rv ZeroTierUI/helpers "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources"
|
||||
$(CODESIGN) -f -s $(CODESIGN_CERT) "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources/helpers/mac/ZeroTier One (Authenticate).app"
|
||||
$(CODESIGN) -f -s $(CODESIGN_CERT) "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources/helpers/mac/ZeroTier One (Install).app"
|
||||
find "build-ZeroTierUI-release/ZeroTier One.app" -type f -name '.DS_Store' -print0 | xargs -0 rm -f
|
||||
$(CODESIGN) -f -s $(CODESIGN_CERT) "build-ZeroTierUI-release/ZeroTier One.app"
|
||||
$(CODESIGN) -vvv "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources/helpers/mac/ZeroTier One (Authenticate).app"
|
||||
$(CODESIGN) -vvv "build-ZeroTierUI-release/ZeroTier One.app/Contents/Resources/helpers/mac/ZeroTier One (Install).app"
|
||||
$(CODESIGN) -vvv "build-ZeroTierUI-release/ZeroTier One.app"
|
||||
|
||||
install-mac-tap: FORCE
|
||||
mkdir -p /Library/Application\ Support/ZeroTier/One
|
||||
rm -rf /Library/Application\ Support/ZeroTier/One/tap.kext
|
||||
cp -R ext/bin/tap-mac//tap.kext /Library/Application\ Support/ZeroTier/One
|
||||
cp -R ext/bin/tap-mac/tap.kext /Library/Application\ Support/ZeroTier/One
|
||||
chown -R root:wheel /Library/Application\ Support/ZeroTier/One/tap.kext
|
||||
|
||||
clean:
|
||||
rm -rf *.dSYM build-* $(OBJS) zerotier-* ZeroTierOneInstaller-*
|
||||
rm -rf *.dSYM build-* $(OBJS) zerotier-* ZeroTierOneInstaller-* "ZeroTier One.zip" "ZeroTier One.dmg"
|
||||
|
||||
official: FORCE
|
||||
make -j 4 ZT_OFFICIAL_RELEASE=1
|
||||
make mac-ui ZT_OFFICIAL_RELEASE=1
|
||||
./buildinstaller.sh
|
||||
mkdir build-ZeroTierOne-dmg
|
||||
cd build-ZeroTierOne-dmg ; ln -sf /Applications Applications
|
||||
cp -a "build-ZeroTierUI-release/ZeroTier One.app" build-ZeroTierOne-dmg/
|
||||
rm -f /tmp/tmp.dmg
|
||||
hdiutil create /tmp/tmp.dmg -ov -volname "ZeroTier One" -fs HFS+ -srcfolder ./build-ZeroTierOne-dmg
|
||||
hdiutil convert /tmp/tmp.dmg -format UDZO -o "ZeroTier One.dmg"
|
||||
rm -f /tmp/tmp.dmg
|
||||
|
||||
FORCE:
|
||||
|
@ -277,7 +277,7 @@ int main(int argc,char **argv)
|
||||
std::string desc;
|
||||
{
|
||||
Query q = dbCon->query();
|
||||
q << "SELECT name,`desc`,isOpen,multicastPrefixBits,multicastDepth,emulateArp,emulateNdp,arpCacheTtl,ndpCacheTtl FROM Network WHERE id = " << nwid;
|
||||
q << "SELECT * FROM Network WHERE id = " << nwid;
|
||||
StoreQueryResult rs = q.store();
|
||||
if (rs.num_rows() > 0) {
|
||||
name = rs[0]["name"].c_str();
|
||||
@ -411,36 +411,38 @@ int main(int argc,char **argv)
|
||||
uint32_t ipNet = (uint32_t)((unsigned long)rs[aaRow]["ipNet"]);
|
||||
unsigned int netmaskBits = (unsigned int)rs[aaRow]["netmaskBits"];
|
||||
|
||||
uint32_t tryIp = (((uint32_t)addressBytes[1]) << 24) |
|
||||
(((uint32_t)addressBytes[2]) << 16) |
|
||||
(((uint32_t)addressBytes[3]) << 8) |
|
||||
((((uint32_t)addressBytes[4]) % 254) + 1);
|
||||
tryIp &= (0xffffffff >> netmaskBits);
|
||||
tryIp |= ipNet;
|
||||
if ((netmaskBits > 0)&&(ipNet)) {
|
||||
uint32_t tryIp = (((uint32_t)addressBytes[1]) << 24) |
|
||||
(((uint32_t)addressBytes[2]) << 16) |
|
||||
(((uint32_t)addressBytes[3]) << 8) |
|
||||
((((uint32_t)addressBytes[4]) % 254) + 1);
|
||||
tryIp &= (0xffffffff >> netmaskBits);
|
||||
tryIp |= ipNet;
|
||||
|
||||
for(int k=0;k<100000;++k) {
|
||||
Query q2 = dbCon->query();
|
||||
q2 << "INSERT INTO IPv4Static (Network_id,Node_id,ip,netmaskBits) VALUES (" << nwid << "," << peerIdentity.address().toInt() << "," << tryIp << "," << netmaskBits << ")";
|
||||
if (q2.exec()) {
|
||||
sprintf(buf,"%u.%u.%u.%u",(unsigned int)((tryIp >> 24) & 0xff),(unsigned int)((tryIp >> 16) & 0xff),(unsigned int)((tryIp >> 8) & 0xff),(unsigned int)(tryIp & 0xff));
|
||||
if (ipv4Static.length())
|
||||
ipv4Static.push_back(',');
|
||||
ipv4Static.append(buf);
|
||||
ipv4Static.push_back('/');
|
||||
sprintf(buf,"%u",netmaskBits);
|
||||
ipv4Static.append(buf);
|
||||
break;
|
||||
} else { // insert will fail if IP is in use due to uniqueness constraints in DB
|
||||
++tryIp;
|
||||
if ((tryIp & 0xff) == 0)
|
||||
tryIp |= 1;
|
||||
tryIp &= (0xffffffff >> netmaskBits);
|
||||
tryIp |= ipNet;
|
||||
for(int k=0;k<100000;++k) {
|
||||
Query q2 = dbCon->query();
|
||||
q2 << "INSERT INTO IPv4Static (Network_id,Node_id,ip,netmaskBits) VALUES (" << nwid << "," << peerIdentity.address().toInt() << "," << tryIp << "," << netmaskBits << ")";
|
||||
if (q2.exec()) {
|
||||
sprintf(buf,"%u.%u.%u.%u",(unsigned int)((tryIp >> 24) & 0xff),(unsigned int)((tryIp >> 16) & 0xff),(unsigned int)((tryIp >> 8) & 0xff),(unsigned int)(tryIp & 0xff));
|
||||
if (ipv4Static.length())
|
||||
ipv4Static.push_back(',');
|
||||
ipv4Static.append(buf);
|
||||
ipv4Static.push_back('/');
|
||||
sprintf(buf,"%u",netmaskBits);
|
||||
ipv4Static.append(buf);
|
||||
break;
|
||||
} else { // insert will fail if IP is in use due to uniqueness constraints in DB
|
||||
++tryIp;
|
||||
if ((tryIp & 0xff) == 0)
|
||||
tryIp |= 1;
|
||||
tryIp &= (0xffffffff >> netmaskBits);
|
||||
tryIp |= ipNet;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ipv4Static.length())
|
||||
break;
|
||||
if (ipv4Static.length())
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,10 @@
|
||||
#include "Constants.hpp"
|
||||
#include "Utils.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#define round(x) ((x-floor(x))>0.5 ? ceil(x) : floor(x))
|
||||
#endif
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
/**
|
||||
|
@ -1,29 +1,13 @@
|
||||
// Code taken from NaCl by D. J. Bernstein and others
|
||||
|
||||
/*
|
||||
* ZeroTier One - Global Peer to Peer Ethernet
|
||||
* Copyright (C) 2012-2013 ZeroTier Networks LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --
|
||||
*
|
||||
* ZeroTier may be used and distributed under the terms of the GPLv3, which
|
||||
* are available at: http://www.gnu.org/licenses/gpl-3.0.html
|
||||
*
|
||||
* If you would like to embed ZeroTier into a commercial application or
|
||||
* redistribute it in a modified binary form, please contact ZeroTier Networks
|
||||
* LLC. Start here: http://www.zerotier.com/
|
||||
*/
|
||||
Matthew Dempsky
|
||||
Public domain.
|
||||
Derived from public domain code by D. J. Bernstein.
|
||||
*/
|
||||
|
||||
// Modified very slightly for ZeroTier One by Adam Ierymenko
|
||||
// (no functional changes)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
@ -34,19 +18,15 @@
|
||||
#include "SHA512.hpp"
|
||||
#include "Buffer.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#pragma warning(disable: 4146)
|
||||
#endif
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Code taken from NaCl by D. J. Bernstein and others
|
||||
|
||||
/*
|
||||
Matthew Dempsky
|
||||
Public domain.
|
||||
Derived from public domain code by D. J. Bernstein.
|
||||
*/
|
||||
|
||||
#define crypto_int32 int32_t
|
||||
#define crypto_uint32 uint32_t
|
||||
#define crypto_int64 int64_t
|
||||
@ -312,7 +292,7 @@ static int crypto_scalarmult(unsigned char *q,
|
||||
|
||||
static const unsigned char base[32] = {9};
|
||||
|
||||
static int crypto_scalarmult_base(unsigned char *q,
|
||||
static inline int crypto_scalarmult_base(unsigned char *q,
|
||||
const unsigned char *n)
|
||||
{
|
||||
return crypto_scalarmult(q,n,base);
|
||||
@ -1888,21 +1868,21 @@ static const ge25519_aff ge25519_base_multiples_affine[425] = {
|
||||
{{0x69, 0x3e, 0x47, 0x97, 0x2c, 0xaf, 0x52, 0x7c, 0x78, 0x83, 0xad, 0x1b, 0x39, 0x82, 0x2f, 0x02, 0x6f, 0x47, 0xdb, 0x2a, 0xb0, 0xe1, 0x91, 0x99, 0x55, 0xb8, 0x99, 0x3a, 0xa0, 0x44, 0x11, 0x51}}}
|
||||
};
|
||||
|
||||
static void p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p)
|
||||
static inline void p1p1_to_p2(ge25519_p2 *r, const ge25519_p1p1 *p)
|
||||
{
|
||||
fe25519_mul(&r->x, &p->x, &p->t);
|
||||
fe25519_mul(&r->y, &p->y, &p->z);
|
||||
fe25519_mul(&r->z, &p->z, &p->t);
|
||||
}
|
||||
|
||||
static void p1p1_to_p2_2(ge25519_p3 *r, const ge25519_p1p1 *p)
|
||||
static inline void p1p1_to_p2_2(ge25519_p3 *r, const ge25519_p1p1 *p)
|
||||
{
|
||||
fe25519_mul(&r->x, &p->x, &p->t);
|
||||
fe25519_mul(&r->y, &p->y, &p->z);
|
||||
fe25519_mul(&r->z, &p->z, &p->t);
|
||||
}
|
||||
|
||||
static void p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p)
|
||||
static inline void p1p1_to_p3(ge25519_p3 *r, const ge25519_p1p1 *p)
|
||||
{
|
||||
p1p1_to_p2_2(r, p);
|
||||
fe25519_mul(&r->t, &p->x, &p->y);
|
||||
@ -1971,13 +1951,13 @@ static void dbl_p1p1(ge25519_p1p1 *r, const ge25519_p2 *p)
|
||||
}
|
||||
|
||||
/* Constant-time version of: if(b) r = p */
|
||||
static void cmov_aff(ge25519_aff *r, const ge25519_aff *p, unsigned char b)
|
||||
static inline void cmov_aff(ge25519_aff *r, const ge25519_aff *p, unsigned char b)
|
||||
{
|
||||
fe25519_cmov(&r->x, &p->x, b);
|
||||
fe25519_cmov(&r->y, &p->y, b);
|
||||
}
|
||||
|
||||
static unsigned char equal(signed char b,signed char c)
|
||||
static inline unsigned char equal(signed char b,signed char c)
|
||||
{
|
||||
unsigned char ub = b;
|
||||
unsigned char uc = c;
|
||||
@ -1985,14 +1965,14 @@ static unsigned char equal(signed char b,signed char c)
|
||||
crypto_uint32 y = x; /* 0: yes; 1..255: no */
|
||||
y -= 1; /* 4294967295: yes; 0..254: no */
|
||||
y >>= 31; /* 1: yes; 0: no */
|
||||
return y;
|
||||
return (unsigned char)y;
|
||||
}
|
||||
|
||||
static unsigned char negative(signed char b)
|
||||
static inline unsigned char negative(signed char b)
|
||||
{
|
||||
unsigned long long x = b; /* 18446744073709551361..18446744073709551615: yes; 0..255: no */
|
||||
x >>= 63; /* 1: yes; 0: no */
|
||||
return x;
|
||||
return (unsigned char)x;
|
||||
}
|
||||
|
||||
static void choose_t(ge25519_aff *t, unsigned long long pos, signed char b)
|
||||
@ -2008,7 +1988,7 @@ static void choose_t(ge25519_aff *t, unsigned long long pos, signed char b)
|
||||
fe25519_cmov(&t->x, &v, negative(b));
|
||||
}
|
||||
|
||||
static void setneutral(ge25519 *r)
|
||||
static inline void setneutral(ge25519 *r)
|
||||
{
|
||||
fe25519_setzero(&r->x);
|
||||
fe25519_setone(&r->y);
|
||||
@ -2064,7 +2044,7 @@ static int ge25519_unpackneg_vartime(ge25519_p3 *r, const unsigned char p[32])
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ge25519_pack(unsigned char r[32], const ge25519_p3 *p)
|
||||
static inline void ge25519_pack(unsigned char r[32], const ge25519_p3 *p)
|
||||
{
|
||||
fe25519 tx, ty, zi;
|
||||
fe25519_invert(&zi, &p->z);
|
||||
@ -2147,7 +2127,7 @@ static void ge25519_scalarmult_base(ge25519_p3 *r, const sc25519 *s)
|
||||
}
|
||||
}
|
||||
|
||||
static void get_hram(unsigned char *hram, const unsigned char *sm, const unsigned char *pk, unsigned char *playground, unsigned long long smlen)
|
||||
static inline void get_hram(unsigned char *hram, const unsigned char *sm, const unsigned char *pk, unsigned char *playground, unsigned long long smlen)
|
||||
{
|
||||
unsigned long long i;
|
||||
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
throw()
|
||||
{
|
||||
Pair kp;
|
||||
Utils::getSecureRandom(kp.priv.data,kp.priv.size());
|
||||
Utils::getSecureRandom(kp.priv.data,(unsigned int)kp.priv.size());
|
||||
_calcPubDH(kp);
|
||||
_calcPubED(kp);
|
||||
return kp;
|
||||
@ -98,7 +98,7 @@ public:
|
||||
{
|
||||
Pair kp;
|
||||
void *const priv = (void *)kp.priv.data;
|
||||
Utils::getSecureRandom(priv,kp.priv.size());
|
||||
Utils::getSecureRandom(priv,(unsigned int)kp.priv.size());
|
||||
_calcPubED(kp); // do Ed25519 key -- bytes 32-63 of pub and priv
|
||||
do {
|
||||
++(((uint64_t *)priv)[1]);
|
||||
|
@ -74,7 +74,7 @@ std::string CertificateOfMembership::toString() const
|
||||
|
||||
if (_signedBy) {
|
||||
s.push_back(':');
|
||||
s.append(Utils::hex(_signature.data,_signature.size()));
|
||||
s.append(Utils::hex(_signature.data,(unsigned int)_signature.size()));
|
||||
}
|
||||
|
||||
return s;
|
||||
@ -132,7 +132,7 @@ void CertificateOfMembership::fromString(const char *s)
|
||||
while ((s[colonAt])&&(s[colonAt] != ':')) ++colonAt;
|
||||
|
||||
if (colonAt) {
|
||||
if (Utils::unhex(s,colonAt,_signature.data,_signature.size()) != _signature.size())
|
||||
if (Utils::unhex(s,colonAt,_signature.data,(unsigned int)_signature.size()) != _signature.size())
|
||||
_signedBy.zero();
|
||||
} else _signedBy.zero();
|
||||
} else _signedBy.zero();
|
||||
|
@ -327,7 +327,7 @@ public:
|
||||
}
|
||||
_signedBy.appendTo(b);
|
||||
if (_signedBy)
|
||||
b.append(_signature.data,_signature.size());
|
||||
b.append(_signature.data,(unsigned int)_signature.size());
|
||||
}
|
||||
|
||||
template<unsigned int C>
|
||||
@ -361,8 +361,8 @@ public:
|
||||
p += ZT_ADDRESS_LENGTH;
|
||||
|
||||
if (_signedBy) {
|
||||
memcpy(_signature.data,b.field(p,_signature.size()),_signature.size());
|
||||
p += _signature.size();
|
||||
memcpy(_signature.data,b.field(p,(unsigned int)_signature.size()),_signature.size());
|
||||
p += (unsigned int)_signature.size();
|
||||
}
|
||||
|
||||
return (p - startAt);
|
||||
|
@ -77,6 +77,8 @@
|
||||
#define ZT_PATH_SEPARATOR '\\'
|
||||
#define ZT_PATH_SEPARATOR_S "\\"
|
||||
#define ZT_EOL_S "\r\n"
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
|
||||
// Assume these are little-endian. PPC is not supported for OSX, and ARM
|
||||
@ -302,6 +304,11 @@ error_no_byte_order_defined;
|
||||
*/
|
||||
#define ZT_PEER_LINK_ACTIVITY_TIMEOUT ((ZT_PEER_DIRECT_PING_DELAY * 2) + 1000)
|
||||
|
||||
/**
|
||||
* Stop relaying via peers that have not responded to direct sends in this long
|
||||
*/
|
||||
#define ZT_PEER_RELAY_CONVERSATION_LATENCY_THRESHOLD 10000
|
||||
|
||||
/**
|
||||
* Number of outgoing verb/packetId pairs to keep for sends expecting responses
|
||||
*/
|
||||
@ -341,9 +348,9 @@ error_no_byte_order_defined;
|
||||
#define ZT_UPDATE_MIN_INTERVAL 120000
|
||||
|
||||
/**
|
||||
* Maximum interval between attempts to do a software update
|
||||
* Maximum interval between checks for new versions (2 hours)
|
||||
*/
|
||||
#define ZT_UPDATE_MAX_INTERVAL 28800000
|
||||
#define ZT_UPDATE_MAX_INTERVAL 7200000
|
||||
|
||||
/**
|
||||
* Update HTTP timeout in seconds
|
||||
|
@ -36,6 +36,7 @@
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#include <ShlObj.h>
|
||||
#endif
|
||||
|
||||
namespace ZeroTier {
|
||||
@ -72,30 +73,38 @@ static inline std::map< Identity,std::vector<InetAddress> > _mkSupernodeMap()
|
||||
addrs.push_back(InetAddress("198.211.127.172",ZT_DEFAULT_UDP_PORT));
|
||||
sn[id] = addrs;
|
||||
|
||||
// mi-go.zerotier.com - Singapore
|
||||
addrs.clear();
|
||||
if (!id.fromString("abbb7f4622:0:89d2c6b2062b10f4ce314dfcb914c082566247090a6f74c8ba1c15c63b205f540758f0abae85287397152c9d8cf463cfe51e7a480946cd6a31495b24ca13253c"))
|
||||
throw std::runtime_error("invalid identity in Defaults");
|
||||
addrs.push_back(InetAddress("128.199.254.204",ZT_DEFAULT_UDP_PORT));
|
||||
sn[id] = addrs;
|
||||
|
||||
return sn;
|
||||
}
|
||||
|
||||
static inline std::string _mkDefaultHomePath()
|
||||
{
|
||||
#ifdef __UNIX_LIKE__
|
||||
|
||||
#ifdef __APPLE__
|
||||
return std::string("/Library/Application Support/ZeroTier/One");
|
||||
#else
|
||||
return std::string("/var/lib/zerotier-one");
|
||||
#endif
|
||||
#else
|
||||
|
||||
#else // not __UNIX_LIKE__
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
OSVERSIONINFO vi;
|
||||
memset (&vi,0,sizeof(vi));
|
||||
vi.dwOSVersionInfoSize = sizeof(vi);
|
||||
GetVersionEx(&vi);
|
||||
if (vi.dwMajorVersion < 6)
|
||||
return std::string("C:\\Documents and Settings\\All Users\\Application Data\\ZeroTier\\One");
|
||||
return std::string("C:\\ProgramData\\ZeroTier\\One");
|
||||
char buf[16384];
|
||||
if (SUCCEEDED(SHGetFolderPathA(NULL,CSIDL_COMMON_APPDATA,NULL,0,buf)))
|
||||
return (std::string(buf) + "\\ZeroTier\\One");
|
||||
else return std::string("C:\\ZeroTier\\One");
|
||||
#else
|
||||
// unknown platform
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // __UNIX_LIKE__ or not...
|
||||
}
|
||||
|
||||
static inline std::map< Address,Identity > _mkUpdateAuth()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -94,27 +94,6 @@ public:
|
||||
*/
|
||||
~EthernetTap();
|
||||
|
||||
/**
|
||||
* Perform OS dependent actions on network configuration change detection
|
||||
*/
|
||||
void whack();
|
||||
|
||||
/**
|
||||
* Set whether or not DHCP is enabled (disabled by default)
|
||||
*
|
||||
* @param dhcp DHCP status
|
||||
* @return New state of DHCP (may be false even on 'true' if DHCP enable failed)
|
||||
*/
|
||||
bool setDhcpEnabled(bool dhcp);
|
||||
|
||||
/**
|
||||
* Set whether or not DHCP6 is enabled (disabled by default)
|
||||
*
|
||||
* @param dhcp DHCP6 status
|
||||
* @return New state of DHCP6 (may be false even on 'true' if DHCP enable failed)
|
||||
*/
|
||||
bool setDhcp6Enabled(bool dhcp);
|
||||
|
||||
/**
|
||||
* Set the user display name for this connection
|
||||
*
|
||||
@ -145,24 +124,17 @@ public:
|
||||
/**
|
||||
* Remove an IP from this interface
|
||||
*
|
||||
* Link-local IP addresses may not be able to be removed, depending on platform and type.
|
||||
*
|
||||
* @param ip IP and netmask (netmask stored in port field)
|
||||
* @return True if IP removed successfully
|
||||
*/
|
||||
bool removeIP(const InetAddress &ip);
|
||||
|
||||
/**
|
||||
* @return Set of IP addresses / netmasks
|
||||
* @return All IP addresses (V4 and V6) assigned to this interface (including link-local)
|
||||
*/
|
||||
inline std::set<InetAddress> ips() const
|
||||
{
|
||||
Mutex::Lock _l(_ips_m);
|
||||
return _ips;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Set of IP addresses / netmasks included any we did not assign, link-local, etc.
|
||||
*/
|
||||
std::set<InetAddress> allIps() const;
|
||||
std::set<InetAddress> ips() const;
|
||||
|
||||
/**
|
||||
* Set this tap's IP addresses to exactly this set of IPs
|
||||
@ -176,10 +148,23 @@ public:
|
||||
for(std::set<InetAddress>::iterator i(allIps.begin());i!=allIps.end();++i)
|
||||
addIP(*i);
|
||||
std::set<InetAddress> myIps(ips());
|
||||
#ifdef __APPLE__
|
||||
bool haveV6LinkLocal = false;
|
||||
for(std::set<InetAddress>::iterator i(myIps.begin());i!=myIps.end();++i) {
|
||||
if (!allIps.count(*i))
|
||||
if (i->isLinkLocal()) {
|
||||
if (i->isV6())
|
||||
haveV6LinkLocal = true;
|
||||
} else if (!allIps.count(*i))
|
||||
removeIP(*i);
|
||||
}
|
||||
if (!haveV6LinkLocal)
|
||||
addIP(InetAddress::makeIpv6LinkLocal(_mac));
|
||||
#else
|
||||
for(std::set<InetAddress>::iterator i(myIps.begin());i!=myIps.end();++i) {
|
||||
if ((!i->isLinkLocal())&&(!allIps.count(*i)))
|
||||
removeIP(*i);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,6 +183,11 @@ public:
|
||||
*/
|
||||
std::string deviceName() const;
|
||||
|
||||
/**
|
||||
* @return OS-internal persistent device ID or empty string if not applicable to this platform or not persistent
|
||||
*/
|
||||
std::string persistentId() const;
|
||||
|
||||
/**
|
||||
* Fill or modify a set to contain multicast groups for this device
|
||||
*
|
||||
@ -218,21 +208,28 @@ public:
|
||||
void threadMain()
|
||||
throw();
|
||||
|
||||
/**
|
||||
* Remove persistent tap device by device name
|
||||
*
|
||||
* This has no effect on platforms that do not have persistent taps.
|
||||
* On platforms like Windows with persistent devices the device is
|
||||
* uninstalled.
|
||||
*
|
||||
* @param _r Runtime environment
|
||||
* @param pdev Device name as returned by persistentId() while tap is running
|
||||
* @return True if a device was deleted
|
||||
*/
|
||||
static bool deletePersistentTapDevice(const RuntimeEnvironment *_r,const char *pid);
|
||||
|
||||
private:
|
||||
const MAC _mac;
|
||||
const unsigned int _mtu;
|
||||
|
||||
const RuntimeEnvironment *_r;
|
||||
|
||||
std::set<InetAddress> _ips;
|
||||
Mutex _ips_m;
|
||||
|
||||
void (*_handler)(void *,const MAC &,const MAC &,unsigned int,const Buffer<4096> &);
|
||||
void *_arg;
|
||||
|
||||
bool _dhcp;
|
||||
bool _dhcp6;
|
||||
|
||||
Thread _thread;
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
@ -242,6 +239,8 @@ private:
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
void _syncIpsWithRegistry(const std::set<InetAddress> &haveIps);
|
||||
|
||||
HANDLE _tap;
|
||||
OVERLAPPED _tapOvlRead,_tapOvlWrite;
|
||||
char _tapReadBuf[ZT_IF_MTU + 32];
|
||||
@ -252,6 +251,7 @@ private:
|
||||
std::queue< std::pair< Array<char,ZT_IF_MTU + 32>,unsigned int > > _injectPending;
|
||||
Mutex _injectPending_m;
|
||||
volatile bool _run;
|
||||
volatile bool _initialized;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -25,21 +25,20 @@
|
||||
* LLC. Start here: http://www.zerotier.com/
|
||||
*/
|
||||
|
||||
#include "Constants.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#include <winhttp.h>
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "HttpClient.hpp"
|
||||
#include "Thread.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "NonCopyable.hpp"
|
||||
#include "Defaults.hpp"
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
@ -51,6 +50,16 @@
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
|
||||
#include "HttpClient.hpp"
|
||||
#include "Thread.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "NonCopyable.hpp"
|
||||
#include "Defaults.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
const std::map<std::string,std::string> HttpClient::NO_HEADERS;
|
||||
@ -308,4 +317,154 @@ HttpClient::Request HttpClient::_do(
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
#define WIN_MAX_MESSAGE_LENGTH (1024 * 1024 * 64)
|
||||
|
||||
// Internal private thread class that performs request, notifies handler,
|
||||
// and then commits suicide by deleting itself.
|
||||
class P_Req : NonCopyable
|
||||
{
|
||||
public:
|
||||
P_Req(const char *method,const std::string &url,const std::map<std::string,std::string> &headers,unsigned int timeout,void (*handler)(void *,int,const std::string &,bool,const std::string &),void *arg) :
|
||||
_url(url),
|
||||
_headers(headers),
|
||||
_timeout(timeout),
|
||||
_handler(handler),
|
||||
_arg(arg)
|
||||
{
|
||||
_myThread = Thread::start(this);
|
||||
}
|
||||
|
||||
void threadMain()
|
||||
{
|
||||
HINTERNET hSession = (HINTERNET)0;
|
||||
HINTERNET hConnect = (HINTERNET)0;
|
||||
HINTERNET hRequest = (HINTERNET)0;
|
||||
|
||||
try {
|
||||
hSession = WinHttpOpen(L"ZeroTier One HttpClient/1.0",WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,WINHTTP_NO_PROXY_NAME,WINHTTP_NO_PROXY_BYPASS,0);
|
||||
if (!hSession) {
|
||||
_handler(_arg,-1,_url,false,"WinHttpOpen() failed");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
int timeoutMs = (int)_timeout * 1000;
|
||||
WinHttpSetTimeouts(hSession,timeoutMs,timeoutMs,timeoutMs,timeoutMs);
|
||||
|
||||
std::wstring_convert< std::codecvt_utf8<wchar_t> > wcconv;
|
||||
std::wstring wurl(wcconv.from_bytes(_url));
|
||||
|
||||
URL_COMPONENTS uc;
|
||||
memset(&uc,0,sizeof(uc));
|
||||
uc.dwStructSize = sizeof(uc);
|
||||
uc.dwSchemeLength = -1;
|
||||
uc.dwHostNameLength = -1;
|
||||
uc.dwUrlPathLength = -1;
|
||||
uc.dwExtraInfoLength = -1;
|
||||
if (!WinHttpCrackUrl(wurl.c_str(),(DWORD)wurl.length(),0,&uc)) {
|
||||
_handler(_arg,-1,_url,false,"unable to parse URL: WinHttpCrackUrl() failed");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
if ((!uc.lpszHostName)||(!uc.lpszUrlPath)||(!uc.lpszScheme)||(uc.dwHostNameLength <= 0)||(uc.dwUrlPathLength <= 0)||(uc.dwSchemeLength <= 0)) {
|
||||
_handler(_arg,-1,_url,false,"unable to parse URL: missing scheme, host name, or path");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
std::wstring urlScheme(uc.lpszScheme,uc.dwSchemeLength);
|
||||
std::wstring urlHostName(uc.lpszHostName,uc.dwHostNameLength);
|
||||
std::wstring urlPath(uc.lpszUrlPath,uc.dwUrlPathLength);
|
||||
if ((uc.lpszExtraInfo)&&(uc.dwExtraInfoLength > 0))
|
||||
urlPath.append(uc.lpszExtraInfo,uc.dwExtraInfoLength);
|
||||
|
||||
if (urlScheme != L"http") {
|
||||
_handler(_arg,-1,_url,false,"only 'http' scheme is supported");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
|
||||
hConnect = WinHttpConnect(hSession,urlHostName.c_str(),((uc.nPort > 0) ? uc.nPort : 80),0);
|
||||
if (!hConnect) {
|
||||
_handler(_arg,-1,_url,false,"connection failed");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
|
||||
hRequest = WinHttpOpenRequest(hConnect,L"GET",urlPath.c_str(),NULL,WINHTTP_NO_REFERER,WINHTTP_DEFAULT_ACCEPT_TYPES,0);
|
||||
if (!hRequest) {
|
||||
_handler(_arg,-1,_url,false,"error sending request (1)");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
if (!WinHttpSendRequest(hRequest,WINHTTP_NO_ADDITIONAL_HEADERS,0,WINHTTP_NO_REQUEST_DATA,0,0,0)) {
|
||||
_handler(_arg,-1,_url,false,"error sending request (2)");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
|
||||
if (WinHttpReceiveResponse(hRequest,NULL)) {
|
||||
DWORD dwStatusCode = 0;
|
||||
DWORD dwTmp = sizeof(dwStatusCode);
|
||||
WinHttpQueryHeaders(hRequest,WINHTTP_QUERY_STATUS_CODE| WINHTTP_QUERY_FLAG_NUMBER,NULL,&dwStatusCode,&dwTmp,NULL);
|
||||
|
||||
DWORD dwSize;
|
||||
do {
|
||||
dwSize = 0;
|
||||
if (!WinHttpQueryDataAvailable(hRequest,&dwSize)) {
|
||||
_handler(_arg,-1,_url,false,"receive error (1)");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
|
||||
char *outBuffer = new char[dwSize];
|
||||
DWORD dwRead = 0;
|
||||
if (!WinHttpReadData(hRequest,(LPVOID)outBuffer,dwSize,&dwRead)) {
|
||||
_handler(_arg,-1,_url,false,"receive error (2)");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
|
||||
_body.append(outBuffer,dwRead);
|
||||
delete [] outBuffer;
|
||||
if (_body.length() > WIN_MAX_MESSAGE_LENGTH) {
|
||||
_handler(_arg,-1,_url,false,"result too large");
|
||||
goto closeAndReturnFromHttp;
|
||||
}
|
||||
} while (dwSize > 0);
|
||||
|
||||
_handler(_arg,dwStatusCode,_url,false,_body);
|
||||
} else {
|
||||
_handler(_arg,-1,_url,false,"receive response failed");
|
||||
}
|
||||
} catch (std::bad_alloc &exc) {
|
||||
_handler(_arg,-1,_url,false,"insufficient memory");
|
||||
} catch ( ... ) {
|
||||
_handler(_arg,-1,_url,false,"unexpected exception");
|
||||
}
|
||||
|
||||
closeAndReturnFromHttp:
|
||||
if (hRequest)
|
||||
WinHttpCloseHandle(hRequest);
|
||||
if (hConnect)
|
||||
WinHttpCloseHandle(hConnect);
|
||||
if (hSession)
|
||||
WinHttpCloseHandle(hSession);
|
||||
delete this;
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string _url;
|
||||
std::string _body;
|
||||
std::map<std::string,std::string> _headers;
|
||||
unsigned int _timeout;
|
||||
void (*_handler)(void *,int,const std::string &,bool,const std::string &);
|
||||
void *_arg;
|
||||
Thread _myThread;
|
||||
};
|
||||
|
||||
HttpClient::Request HttpClient::_do(
|
||||
const char *method,
|
||||
const std::string &url,
|
||||
const std::map<std::string,std::string> &headers,
|
||||
unsigned int timeout,
|
||||
void (*handler)(void *,int,const std::string &,bool,const std::string &),
|
||||
void *arg)
|
||||
{
|
||||
return (HttpClient::Request)(new P_Req(method,url,headers,timeout,handler,arg));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
@ -90,7 +90,7 @@ struct _Identity_generate_cond
|
||||
inline bool operator()(const C25519::Pair &kp) const
|
||||
throw()
|
||||
{
|
||||
_computeMemoryHardHash(kp.pub.data,kp.pub.size(),digest,genmem);
|
||||
_computeMemoryHardHash(kp.pub.data,(unsigned int)kp.pub.size(),digest,genmem);
|
||||
return (digest[0] < ZT_IDENTITY_GEN_HASHCASH_FIRST_BYTE_LESS_THAN);
|
||||
}
|
||||
unsigned char *digest;
|
||||
@ -123,7 +123,7 @@ bool Identity::locallyValidate() const
|
||||
|
||||
unsigned char digest[64];
|
||||
char *genmem = new char[ZT_IDENTITY_GEN_MEMORY];
|
||||
_computeMemoryHardHash(_publicKey.data,_publicKey.size(),digest,genmem);
|
||||
_computeMemoryHardHash(_publicKey.data,(unsigned int)_publicKey.size(),digest,genmem);
|
||||
delete [] genmem;
|
||||
|
||||
unsigned char addrb[5];
|
||||
@ -144,10 +144,10 @@ std::string Identity::toString(bool includePrivate) const
|
||||
|
||||
r.append(_address.toString());
|
||||
r.append(":0:"); // 0 == IDENTITY_TYPE_C25519
|
||||
r.append(Utils::hex(_publicKey.data,_publicKey.size()));
|
||||
r.append(Utils::hex(_publicKey.data,(unsigned int)_publicKey.size()));
|
||||
if ((_privateKey)&&(includePrivate)) {
|
||||
r.push_back(':');
|
||||
r.append(Utils::hex(_privateKey->data,_privateKey->size()));
|
||||
r.append(Utils::hex(_privateKey->data,(unsigned int)_privateKey->size()));
|
||||
}
|
||||
|
||||
return r;
|
||||
@ -176,12 +176,12 @@ bool Identity::fromString(const char *str)
|
||||
return false;
|
||||
break;
|
||||
case 2:
|
||||
if (Utils::unhex(f,_publicKey.data,_publicKey.size()) != _publicKey.size())
|
||||
if (Utils::unhex(f,_publicKey.data,(unsigned int)_publicKey.size()) != _publicKey.size())
|
||||
return false;
|
||||
break;
|
||||
case 3:
|
||||
_privateKey = new C25519::Private();
|
||||
if (Utils::unhex(f,_privateKey->data,_privateKey->size()) != _privateKey->size())
|
||||
if (Utils::unhex(f,_privateKey->data,(unsigned int)_privateKey->size()) != _privateKey->size())
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
|
@ -224,10 +224,10 @@ public:
|
||||
{
|
||||
_address.appendTo(b);
|
||||
b.append((unsigned char)IDENTITY_TYPE_C25519);
|
||||
b.append(_publicKey.data,_publicKey.size());
|
||||
b.append(_publicKey.data,(unsigned int)_publicKey.size());
|
||||
if ((_privateKey)&&(includePrivate)) {
|
||||
b.append((unsigned char)_privateKey->size());
|
||||
b.append(_privateKey->data,_privateKey->size());
|
||||
b.append(_privateKey->data,(unsigned int)_privateKey->size());
|
||||
} else b.append((unsigned char)0);
|
||||
}
|
||||
|
||||
@ -258,8 +258,8 @@ public:
|
||||
if (b[p++] != IDENTITY_TYPE_C25519)
|
||||
throw std::invalid_argument("unsupported identity type");
|
||||
|
||||
memcpy(_publicKey.data,b.field(p,_publicKey.size()),_publicKey.size());
|
||||
p += _publicKey.size();
|
||||
memcpy(_publicKey.data,b.field(p,(unsigned int)_publicKey.size()),(unsigned int)_publicKey.size());
|
||||
p += (unsigned int)_publicKey.size();
|
||||
|
||||
unsigned int privateKeyLength = (unsigned int)b[p++];
|
||||
if (privateKeyLength) {
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include <string>
|
||||
|
||||
#include "Constants.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "MAC.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
@ -188,6 +190,28 @@ public:
|
||||
_sa.sin6.sin6_port = htons((uint16_t)port);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if this is a link-local IP address
|
||||
*/
|
||||
inline bool isLinkLocal() const
|
||||
throw()
|
||||
{
|
||||
if (_sa.saddr.sa_family == AF_INET)
|
||||
return ((Utils::ntoh((uint32_t)_sa.sin.sin_addr.s_addr) & 0xffff0000) == 0xa9fe0000);
|
||||
else if (_sa.saddr.sa_family == AF_INET6) {
|
||||
if (_sa.sin6.sin6_addr.s6_addr[0] != 0xfe) return false;
|
||||
if (_sa.sin6.sin6_addr.s6_addr[1] != 0x80) return false;
|
||||
if (_sa.sin6.sin6_addr.s6_addr[2] != 0x00) return false;
|
||||
if (_sa.sin6.sin6_addr.s6_addr[3] != 0x00) return false;
|
||||
if (_sa.sin6.sin6_addr.s6_addr[4] != 0x00) return false;
|
||||
if (_sa.sin6.sin6_addr.s6_addr[5] != 0x00) return false;
|
||||
if (_sa.sin6.sin6_addr.s6_addr[6] != 0x00) return false;
|
||||
if (_sa.sin6.sin6_addr.s6_addr[7] != 0x00) return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ASCII IP/port format representation
|
||||
*/
|
||||
@ -233,6 +257,31 @@ public:
|
||||
return port();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a full netmask as an InetAddress
|
||||
*/
|
||||
inline InetAddress netmask() const
|
||||
throw()
|
||||
{
|
||||
InetAddress r(*this);
|
||||
switch(_sa.saddr.sa_family) {
|
||||
case AF_INET:
|
||||
r._sa.sin.sin_addr.s_addr = Utils::hton((uint32_t)(0xffffffff << (32 - netmaskBits())));
|
||||
break;
|
||||
case AF_INET6: {
|
||||
unsigned char *bf = (unsigned char *)r._sa.sin6.sin6_addr.s6_addr;
|
||||
signed int bitsLeft = (signed int)netmaskBits();
|
||||
for(unsigned int i=0;i<16;++i) {
|
||||
if (bitsLeft > 0) {
|
||||
bf[i] = (unsigned char)((bitsLeft >= 8) ? 0xff : (0xff << (8 - bitsLeft)));
|
||||
bitsLeft -= 8;
|
||||
} else bf[i] = (unsigned char)0;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if this is an IPv4 address
|
||||
*/
|
||||
@ -339,6 +388,35 @@ public:
|
||||
_sa.saddr.sa_family = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mac MAC address seed
|
||||
* @return IPv6 link-local address
|
||||
*/
|
||||
static inline InetAddress makeIpv6LinkLocal(const MAC &mac)
|
||||
throw()
|
||||
{
|
||||
InetAddress ip;
|
||||
ip._sa.saddr.sa_family = AF_INET6;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[0] = 0xfe;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[1] = 0x80;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[2] = 0x00;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[3] = 0x00;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[4] = 0x00;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[5] = 0x00;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[6] = 0x00;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[7] = 0x00;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[8] = mac.data[0] & 0xfd;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[9] = mac.data[1];
|
||||
ip._sa.sin6.sin6_addr.s6_addr[10] = mac.data[2];
|
||||
ip._sa.sin6.sin6_addr.s6_addr[11] = 0xff;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[12] = 0xfe;
|
||||
ip._sa.sin6.sin6_addr.s6_addr[13] = mac.data[3];
|
||||
ip._sa.sin6.sin6_addr.s6_addr[14] = mac.data[4];
|
||||
ip._sa.sin6.sin6_addr.s6_addr[15] = mac.data[5];
|
||||
ip._sa.sin6.sin6_port = Utils::hton((uint16_t)64);
|
||||
return ip;
|
||||
}
|
||||
|
||||
private:
|
||||
union {
|
||||
struct sockaddr saddr;
|
||||
|
112
node/Network.cpp
112
node/Network.cpp
@ -36,6 +36,7 @@
|
||||
#include "Switch.hpp"
|
||||
#include "Packet.hpp"
|
||||
#include "Buffer.hpp"
|
||||
#include "EthernetTap.hpp"
|
||||
|
||||
#define ZT_NETWORK_CERT_WRITE_BUF_SIZE 131072
|
||||
|
||||
@ -45,20 +46,28 @@ const char *Network::statusString(const Status s)
|
||||
throw()
|
||||
{
|
||||
switch(s) {
|
||||
case NETWORK_INITIALIZING: return "INITIALIZING";
|
||||
case NETWORK_WAITING_FOR_FIRST_AUTOCONF: return "WAITING_FOR_FIRST_AUTOCONF";
|
||||
case NETWORK_OK: return "OK";
|
||||
case NETWORK_ACCESS_DENIED: return "ACCESS_DENIED";
|
||||
case NETWORK_NOT_FOUND: return "NOT_FOUND";
|
||||
case NETWORK_INITIALIZATION_FAILED: return "INITIALIZATION_FAILED";
|
||||
}
|
||||
return "(invalid)";
|
||||
}
|
||||
|
||||
Network::~Network()
|
||||
{
|
||||
Thread::join(_setupThread);
|
||||
|
||||
std::string devPersistentId(_tap->persistentId());
|
||||
delete _tap;
|
||||
|
||||
if (_destroyOnDelete) {
|
||||
Utils::rm(std::string(_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d" + ZT_PATH_SEPARATOR_S + idString() + ".conf"));
|
||||
Utils::rm(std::string(_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d" + ZT_PATH_SEPARATOR_S + idString() + ".mcerts"));
|
||||
if (devPersistentId.length())
|
||||
EthernetTap::deletePersistentTapDevice(_r,devPersistentId.c_str());
|
||||
} else {
|
||||
// Causes flush of membership certs to disk
|
||||
clean();
|
||||
@ -66,55 +75,64 @@ Network::~Network()
|
||||
}
|
||||
}
|
||||
|
||||
SharedPtr<Network> Network::newInstance(const RuntimeEnvironment *renv,uint64_t id)
|
||||
SharedPtr<Network> Network::newInstance(const RuntimeEnvironment *renv,NodeConfig *nc,uint64_t id)
|
||||
{
|
||||
// Tag to identify tap device -- used on some OSes like Windows
|
||||
char tag[32];
|
||||
Utils::snprintf(tag,sizeof(tag),"%.16llx",(unsigned long long)id);
|
||||
/* We construct Network via a static method to ensure that it is immediately
|
||||
* wrapped in a SharedPtr<>. Otherwise if there is traffic on the Ethernet
|
||||
* tap device, a SharedPtr<> wrap can occur in the Ethernet frame handler
|
||||
* that then causes the Network instance to be deleted before it is finished
|
||||
* being constructed. C++ edge cases, how I love thee. */
|
||||
|
||||
// We construct Network via a static method to ensure that it is immediately
|
||||
// wrapped in a SharedPtr<>. Otherwise if there is traffic on the Ethernet
|
||||
// tap device, a SharedPtr<> wrap can occur in the Ethernet frame handler
|
||||
// that then causes the Network instance to be deleted before it is finished
|
||||
// being constructed. C++ edge cases, how I love thee.
|
||||
SharedPtr<Network> nw(new Network());
|
||||
nw->_id = id;
|
||||
nw->_ready = false; // disable handling of Ethernet frames during construct
|
||||
nw->_nc = nc;
|
||||
nw->_mac = renv->identity.address().toMAC();
|
||||
nw->_r = renv;
|
||||
nw->_tap = new EthernetTap(renv,tag,renv->identity.address().toMAC(),ZT_IF_MTU,&_CBhandleTapData,nw.ptr());
|
||||
nw->_tap = (EthernetTap *)0;
|
||||
nw->_lastConfigUpdate = 0;
|
||||
nw->_status = NETWORK_WAITING_FOR_FIRST_AUTOCONF;
|
||||
nw->_destroyOnDelete = false;
|
||||
nw->_netconfFailure = NETCONF_FAILURE_NONE;
|
||||
|
||||
if (nw->controller() == renv->identity.address()) // netconf masters can't really join networks
|
||||
throw std::runtime_error("cannot join a network for which I am the netconf master");
|
||||
nw->_restoreState();
|
||||
nw->_ready = true; // enable handling of Ethernet frames
|
||||
nw->requestConfiguration();
|
||||
|
||||
nw->_setupThread = Thread::start<Network>(nw.ptr());
|
||||
|
||||
return nw;
|
||||
}
|
||||
|
||||
void Network::setConfiguration(const Dictionary &conf,bool saveToDisk)
|
||||
bool Network::setConfiguration(const Dictionary &conf,bool saveToDisk)
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
|
||||
EthernetTap *t = _tap;
|
||||
if (!t) {
|
||||
TRACE("BUG: setConfiguration() called while tap is null!");
|
||||
return false; // can't accept config in initialization state
|
||||
}
|
||||
|
||||
try {
|
||||
SharedPtr<NetworkConfig> newConfig(new NetworkConfig(conf));
|
||||
if ((newConfig->networkId() == _id)&&(newConfig->issuedTo() == _r->identity.address())) {
|
||||
Mutex::Lock _l(_lock);
|
||||
_config = newConfig;
|
||||
|
||||
if (newConfig->staticIps().size())
|
||||
_tap->setIps(newConfig->staticIps());
|
||||
_tap->setDisplayName((std::string("ZeroTier One [") + newConfig->name() + "]").c_str());
|
||||
t->setIps(newConfig->staticIps());
|
||||
t->setDisplayName((std::string("ZeroTier One [") + newConfig->name() + "]").c_str());
|
||||
|
||||
_lastConfigUpdate = Utils::now();
|
||||
_status = NETWORK_OK;
|
||||
_netconfFailure = NETCONF_FAILURE_NONE;
|
||||
|
||||
if (saveToDisk) {
|
||||
std::string confPath(_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d" + ZT_PATH_SEPARATOR_S + idString() + ".conf");
|
||||
if (!Utils::writeFile(confPath.c_str(),conf.toString())) {
|
||||
LOG("error: unable to write network configuration file at: %s",confPath.c_str());
|
||||
} else {
|
||||
Utils::lockDownFile(confPath.c_str(),false);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
LOG("ignored invalid configuration for network %.16llx (configuration contains mismatched network ID or issued-to address)",(unsigned long long)_id);
|
||||
}
|
||||
@ -123,10 +141,15 @@ void Network::setConfiguration(const Dictionary &conf,bool saveToDisk)
|
||||
} catch ( ... ) {
|
||||
LOG("ignored invalid configuration for network %.16llx (unknown exception)",(unsigned long long)_id);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Network::requestConfiguration()
|
||||
{
|
||||
if (!_tap)
|
||||
return; // don't bother requesting until we are initialized
|
||||
|
||||
if (controller() == _r->identity.address()) {
|
||||
// netconf master cannot be a member of its own nets
|
||||
LOG("unable to request network configuration for network %.16llx: I am the network master, cannot query self",(unsigned long long)_id);
|
||||
@ -183,6 +206,7 @@ bool Network::isAllowed(const Address &peer) const
|
||||
void Network::clean()
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
|
||||
if ((_config)&&(_config->isOpen())) {
|
||||
// Open (public) networks do not track certs or cert pushes at all.
|
||||
_membershipCertificates.clear();
|
||||
@ -208,7 +232,7 @@ void Network::clean()
|
||||
|
||||
void Network::_CBhandleTapData(void *arg,const MAC &from,const MAC &to,unsigned int etherType,const Buffer<4096> &data)
|
||||
{
|
||||
if (!((Network *)arg)->isUp())
|
||||
if (((Network *)arg)->status() != NETWORK_OK)
|
||||
return;
|
||||
|
||||
const RuntimeEnvironment *_r = ((Network *)arg)->_r;
|
||||
@ -243,6 +267,51 @@ void Network::_pushMembershipCertificate(const Address &peer,bool force,uint64_t
|
||||
}
|
||||
}
|
||||
|
||||
void Network::threadMain()
|
||||
throw()
|
||||
{
|
||||
// Setup thread -- this exits when tap is constructed. It's here
|
||||
// because opening the tap can take some time on some platforms.
|
||||
|
||||
try {
|
||||
#ifdef __WINDOWS__
|
||||
// Windows tags interfaces by their network IDs, which are shoved into the
|
||||
// registry to mark persistent instance of the tap device.
|
||||
char tag[24];
|
||||
Utils::snprintf(tag,sizeof(tag),"%.16llx",(unsigned long long)_id);
|
||||
#else
|
||||
// Unix tries to get the same device name next time, if possible.
|
||||
std::string tagstr;
|
||||
char lcentry[128];
|
||||
Utils::snprintf(lcentry,sizeof(lcentry),"_dev_for_%.16llx",(unsigned long long)_id);
|
||||
tagstr = _nc->getLocalConfig(lcentry);
|
||||
const char *tag = (tagstr.length() > 0) ? tagstr.c_str() : (const char *)0;
|
||||
#endif
|
||||
|
||||
_tap = new EthernetTap(_r,tag,_mac,ZT_IF_MTU,&_CBhandleTapData,this);
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
std::string dn(_tap->deviceName());
|
||||
if ((!tag)||(dn != tag))
|
||||
_nc->putLocalConfig(lcentry,dn);
|
||||
#endif
|
||||
} catch (std::exception &exc) {
|
||||
LOG("network %.16llx failed to initialize: %s",_id,exc.what());
|
||||
_netconfFailure = NETCONF_FAILURE_INIT_FAILED;
|
||||
} catch ( ... ) {
|
||||
LOG("network %.16llx failed to initialize: unknown error",_id);
|
||||
_netconfFailure = NETCONF_FAILURE_INIT_FAILED;
|
||||
}
|
||||
|
||||
try {
|
||||
_restoreState();
|
||||
requestConfiguration();
|
||||
} catch ( ... ) {
|
||||
TRACE("BUG: exception in network setup thread in _restoreState() or requestConfiguration()!");
|
||||
_lastConfigUpdate = 0; // call requestConfiguration() again
|
||||
}
|
||||
}
|
||||
|
||||
void Network::_restoreState()
|
||||
{
|
||||
if (!_id)
|
||||
@ -365,6 +434,7 @@ void Network::_dumpMulticastCerts()
|
||||
}
|
||||
|
||||
fclose(mcdb);
|
||||
Utils::lockDownFile(mcdbPath.c_str(),false);
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
173
node/Network.hpp
173
node/Network.hpp
@ -53,6 +53,7 @@
|
||||
#include "BandwidthAccount.hpp"
|
||||
#include "NetworkConfig.hpp"
|
||||
#include "CertificateOfMembership.hpp"
|
||||
#include "Thread.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
@ -81,8 +82,7 @@ private:
|
||||
// Only NodeConfig can create, only SharedPtr can delete
|
||||
|
||||
// Actual construction happens in newInstance()
|
||||
Network() throw() : _tap((EthernetTap *)0) {}
|
||||
|
||||
Network() throw() {}
|
||||
~Network();
|
||||
|
||||
/**
|
||||
@ -91,12 +91,16 @@ private:
|
||||
* If there is no saved state, a dummy .conf is created on disk to remember
|
||||
* this network across restarts.
|
||||
*
|
||||
* This can be a time consuming operation on some platforms (cough Windows
|
||||
* cough).
|
||||
*
|
||||
* @param renv Runtime environment
|
||||
* @param nc Parent NodeConfig
|
||||
* @param id Network ID
|
||||
* @return Reference counted pointer to new network
|
||||
* @throws std::runtime_error Unable to create tap device or other fatal error
|
||||
*/
|
||||
static SharedPtr<Network> newInstance(const RuntimeEnvironment *renv,uint64_t id);
|
||||
static SharedPtr<Network> newInstance(const RuntimeEnvironment *renv,NodeConfig *nc,uint64_t id);
|
||||
|
||||
/**
|
||||
* Causes all persistent disk presence to be erased on delete
|
||||
@ -109,10 +113,12 @@ public:
|
||||
*/
|
||||
enum Status
|
||||
{
|
||||
NETWORK_INITIALIZING,
|
||||
NETWORK_WAITING_FOR_FIRST_AUTOCONF,
|
||||
NETWORK_OK,
|
||||
NETWORK_ACCESS_DENIED,
|
||||
NETWORK_NOT_FOUND
|
||||
NETWORK_NOT_FOUND,
|
||||
NETWORK_INITIALIZATION_FAILED
|
||||
};
|
||||
|
||||
/**
|
||||
@ -127,11 +133,6 @@ public:
|
||||
*/
|
||||
inline uint64_t id() const throw() { return _id; }
|
||||
|
||||
/**
|
||||
* @return Ethernet tap
|
||||
*/
|
||||
inline EthernetTap &tap() throw() { return *_tap; }
|
||||
|
||||
/**
|
||||
* @return Address of network's controlling node
|
||||
*/
|
||||
@ -155,7 +156,10 @@ public:
|
||||
inline bool updateMulticastGroups()
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
return _tap->updateMulticastGroups(_multicastGroups);
|
||||
EthernetTap *t = _tap;
|
||||
if (t)
|
||||
return _tap->updateMulticastGroups(_multicastGroups);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,10 +177,34 @@ public:
|
||||
* This is called by PacketDecoder when an update comes over the wire, or
|
||||
* internally when an old config is reloaded from disk.
|
||||
*
|
||||
* This also cancels any netconf failure flags.
|
||||
*
|
||||
* The network can't accept configuration when in INITIALIZATION state,
|
||||
* and so in that state this will just return false.
|
||||
*
|
||||
* @param conf Configuration in key/value dictionary form
|
||||
* @param saveToDisk IF true (default), write config to disk
|
||||
* @return True if configuration was accepted
|
||||
*/
|
||||
void setConfiguration(const Dictionary &conf,bool saveToDisk = true);
|
||||
bool setConfiguration(const Dictionary &conf,bool saveToDisk = true);
|
||||
|
||||
/**
|
||||
* Set netconf failure to 'access denied'.
|
||||
*/
|
||||
inline void setAccessDenied()
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
_netconfFailure = NETCONF_FAILURE_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set netconf failure to 'not found'.
|
||||
*/
|
||||
inline void setNotFound()
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
_netconfFailure = NETCONF_FAILURE_NOT_FOUND;
|
||||
}
|
||||
|
||||
/**
|
||||
* Causes this network to request an updated configuration from its master node now
|
||||
@ -223,16 +251,6 @@ public:
|
||||
*/
|
||||
inline uint64_t lastConfigUpdate() const throw() { return _lastConfigUpdate; }
|
||||
|
||||
/**
|
||||
* Force this network's status to a particular state based on config reply
|
||||
*/
|
||||
inline void forceStatusTo(const Status s)
|
||||
throw()
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
_status = s;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Status of this network
|
||||
*/
|
||||
@ -240,17 +258,23 @@ public:
|
||||
throw()
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
return _status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return True if this network is in "OK" status and can accept traffic from us
|
||||
*/
|
||||
inline bool isUp() const
|
||||
throw()
|
||||
{
|
||||
Mutex::Lock _l(_lock);
|
||||
return ((_config)&&(_status == NETWORK_OK)&&(_ready));
|
||||
if (_tap) {
|
||||
switch(_netconfFailure) {
|
||||
case NETCONF_FAILURE_ACCESS_DENIED:
|
||||
return NETWORK_ACCESS_DENIED;
|
||||
case NETCONF_FAILURE_NOT_FOUND:
|
||||
return NETWORK_NOT_FOUND;
|
||||
case NETCONF_FAILURE_NONE:
|
||||
if (_lastConfigUpdate > 0)
|
||||
return NETWORK_OK;
|
||||
else return NETWORK_WAITING_FOR_FIRST_AUTOCONF;
|
||||
case NETCONF_FAILURE_INIT_FAILED:
|
||||
default:
|
||||
return NETWORK_INITIALIZATION_FAILED;
|
||||
}
|
||||
} else if (_netconfFailure == NETCONF_FAILURE_INIT_FAILED) {
|
||||
return NETWORK_INITIALIZATION_FAILED;
|
||||
} else return NETWORK_INITIALIZING;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -307,6 +331,73 @@ public:
|
||||
return _config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Thread main method; do not call elsewhere
|
||||
*/
|
||||
void threadMain()
|
||||
throw();
|
||||
|
||||
/**
|
||||
* Inject a frame into tap (if it's created)
|
||||
*
|
||||
* @param from Origin MAC
|
||||
* @param to Destination MC
|
||||
* @param etherType Ethernet frame type
|
||||
* @param data Frame data
|
||||
* @param len Frame length
|
||||
*/
|
||||
inline void tapPut(const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len)
|
||||
{
|
||||
EthernetTap *t = _tap;
|
||||
if (t)
|
||||
t->put(from,to,etherType,data,len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inject a frame into tap with local MAC as destination MAC (if it's created)
|
||||
*
|
||||
* @param from Origin MAC
|
||||
* @param etherType Ethernet frame type
|
||||
* @param data Frame data
|
||||
* @param len Frame length
|
||||
*/
|
||||
inline void tapPut(const MAC &from,unsigned int etherType,const void *data,unsigned int len)
|
||||
{
|
||||
EthernetTap *t = _tap;
|
||||
if (t)
|
||||
t->put(from,t->mac(),etherType,data,len);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Tap device name or empty string if still initializing
|
||||
*/
|
||||
inline std::string tapDeviceName() const
|
||||
{
|
||||
EthernetTap *t = _tap;
|
||||
if (t)
|
||||
return t->deviceName();
|
||||
else return std::string();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Ethernet MAC address for this network's local interface
|
||||
*/
|
||||
inline const MAC &mac() const
|
||||
{
|
||||
return _mac;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Set of currently assigned IP addresses
|
||||
*/
|
||||
inline std::set<InetAddress> ips() const
|
||||
{
|
||||
EthernetTap *t = _tap;
|
||||
if (t)
|
||||
return t->ips();
|
||||
return std::set<InetAddress>();
|
||||
}
|
||||
|
||||
private:
|
||||
static void _CBhandleTapData(void *arg,const MAC &from,const MAC &to,unsigned int etherType,const Buffer<4096> &data);
|
||||
|
||||
@ -315,22 +406,24 @@ private:
|
||||
void _dumpMulticastCerts();
|
||||
|
||||
uint64_t _id;
|
||||
|
||||
NodeConfig *_nc;
|
||||
MAC _mac;
|
||||
const RuntimeEnvironment *_r;
|
||||
|
||||
EthernetTap *_tap;
|
||||
EthernetTap *volatile _tap;
|
||||
std::set<MulticastGroup> _multicastGroups;
|
||||
|
||||
std::map< std::pair<Address,MulticastGroup>,BandwidthAccount > _multicastRateAccounts;
|
||||
std::map<Address,CertificateOfMembership> _membershipCertificates;
|
||||
std::map<Address,uint64_t> _lastPushedMembershipCertificate;
|
||||
SharedPtr<NetworkConfig> _config;
|
||||
|
||||
volatile uint64_t _lastConfigUpdate;
|
||||
volatile Status _status;
|
||||
volatile bool _destroyOnDelete;
|
||||
volatile bool _ready;
|
||||
|
||||
volatile enum {
|
||||
NETCONF_FAILURE_NONE,
|
||||
NETCONF_FAILURE_ACCESS_DENIED,
|
||||
NETCONF_FAILURE_NOT_FOUND,
|
||||
NETCONF_FAILURE_INIT_FAILED
|
||||
} _netconfFailure;
|
||||
Thread _setupThread;
|
||||
Mutex _lock;
|
||||
|
||||
AtomicCounter __refCount;
|
||||
|
@ -112,8 +112,8 @@ public:
|
||||
if ((!etherType)||(etherType > 0xffff)) // sanity checks
|
||||
return false;
|
||||
else if ((_etWhitelist[0] & 1)) // prsence of 0 in set inverts sense: whitelist becomes blacklist
|
||||
return (!(_etWhitelist[etherType >> 3] & (1 << (etherType & 7))));
|
||||
else return ((_etWhitelist[etherType >> 3] & (1 << (etherType & 7))));
|
||||
return ((_etWhitelist[etherType >> 3] & (1 << (etherType & 7))) == 0);
|
||||
else return ((_etWhitelist[etherType >> 3] & (1 << (etherType & 7))) != 0);
|
||||
}
|
||||
|
||||
std::set<unsigned int> allowedEtherTypes() const;
|
||||
|
194
node/Node.cpp
194
node/Node.cpp
@ -44,6 +44,14 @@
|
||||
#ifdef __WINDOWS__
|
||||
#include <WinSock2.h>
|
||||
#include <Windows.h>
|
||||
#include <ShlObj.h>
|
||||
#endif
|
||||
|
||||
#ifdef __UNIX_LIKE__
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#include "Condition.hpp"
|
||||
@ -70,15 +78,6 @@
|
||||
#include "Service.hpp"
|
||||
#include "SoftwareUpdater.hpp"
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
namespace ZeroTier {
|
||||
@ -133,7 +132,7 @@ Node::LocalClient::LocalClient(const char *authToken,unsigned int controlPort,vo
|
||||
if (sock) {
|
||||
{
|
||||
unsigned int csk[64];
|
||||
SHA512::hash(csk,authToken,strlen(authToken));
|
||||
SHA512::hash(csk,authToken,(unsigned int)strlen(authToken));
|
||||
memcpy(impl->key,csk,32);
|
||||
}
|
||||
|
||||
@ -190,6 +189,15 @@ std::vector<std::string> Node::LocalClient::splitLine(const char *line)
|
||||
|
||||
std::string Node::LocalClient::authTokenDefaultUserPath()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
char buf[16384];
|
||||
if (SUCCEEDED(SHGetFolderPathA(NULL,CSIDL_APPDATA,NULL,0,buf)))
|
||||
return (std::string(buf) + "\\ZeroTier\\One\\authtoken.secret");
|
||||
else return std::string();
|
||||
|
||||
#else // not __WINDOWS__
|
||||
|
||||
const char *home = getenv("HOME");
|
||||
if (home) {
|
||||
#ifdef __APPLE__
|
||||
@ -197,21 +205,14 @@ std::string Node::LocalClient::authTokenDefaultUserPath()
|
||||
#else
|
||||
return (std::string(home) + "/.zeroTierOneAuthToken");
|
||||
#endif
|
||||
}
|
||||
return std::string();
|
||||
} else return std::string();
|
||||
|
||||
#endif // __WINDOWS__ or not __WINDOWS__
|
||||
}
|
||||
|
||||
std::string Node::LocalClient::authTokenDefaultSystemPath()
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
// TODO
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
return "/Library/Application Support/ZeroTier/One/authtoken.secret";
|
||||
#else
|
||||
return "/var/lib/zerotier-one/authtoken.secret";
|
||||
#endif
|
||||
#endif
|
||||
return (ZT_DEFAULTS.defaultHomePath + ZT_PATH_SEPARATOR_S"authtoken.secret");
|
||||
}
|
||||
|
||||
struct _NodeImpl
|
||||
@ -223,6 +224,7 @@ struct _NodeImpl
|
||||
volatile Node::ReasonForTermination reasonForTermination;
|
||||
volatile bool started;
|
||||
volatile bool running;
|
||||
volatile bool resynchronize;
|
||||
|
||||
inline Node::ReasonForTermination terminate()
|
||||
{
|
||||
@ -286,7 +288,7 @@ static void _netconfServiceMessageHandler(void *renv,Service &svc,const Dictiona
|
||||
if (err == "OBJ_NOT_FOUND")
|
||||
errCode = Packet::ERROR_OBJ_NOT_FOUND;
|
||||
else if (err == "ACCESS_DENIED")
|
||||
errCode = Packet::ERROR_NETWORK_ACCESS_DENIED;
|
||||
errCode = Packet::ERROR_NETWORK_ACCESS_DENIED_;
|
||||
|
||||
Packet outp(peerAddress,_r->identity.address(),Packet::VERB_ERROR);
|
||||
outp.append((unsigned char)Packet::VERB_NETWORK_CONFIG_REQUEST);
|
||||
@ -358,6 +360,7 @@ Node::Node(const char *hp,unsigned int port,unsigned int controlPort)
|
||||
impl->reasonForTermination = Node::NODE_RUNNING;
|
||||
impl->started = false;
|
||||
impl->running = false;
|
||||
impl->resynchronize = false;
|
||||
}
|
||||
|
||||
Node::~Node()
|
||||
@ -417,11 +420,14 @@ Node::ReasonForTermination Node::run()
|
||||
Utils::lockDownFile(identitySecretPath.c_str(),false);
|
||||
|
||||
// Make sure networks.d exists
|
||||
{
|
||||
std::string networksDotD(_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d");
|
||||
#ifdef __WINDOWS__
|
||||
CreateDirectoryA((_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str(),NULL);
|
||||
CreateDirectoryA(networksDotD.c_str(),NULL);
|
||||
#else
|
||||
mkdir((_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str(),0700);
|
||||
mkdir(networksDotD.c_str(),0700);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Load or generate config authentication secret
|
||||
std::string configAuthTokenPath(_r->homePath + ZT_PATH_SEPARATOR_S + "authtoken.secret");
|
||||
@ -443,7 +449,7 @@ Node::ReasonForTermination Node::run()
|
||||
_r->sw = new Switch(_r);
|
||||
_r->demarc = new Demarc(_r);
|
||||
_r->topology = new Topology(_r,Utils::fileExists((_r->homePath + ZT_PATH_SEPARATOR_S + "iddb.d").c_str()));
|
||||
_r->sysEnv = new SysEnv(_r);
|
||||
_r->sysEnv = new SysEnv();
|
||||
try {
|
||||
_r->nc = new NodeConfig(_r,configAuthToken.c_str(),impl->controlPort);
|
||||
} catch (std::exception &exc) {
|
||||
@ -455,6 +461,7 @@ Node::ReasonForTermination Node::run()
|
||||
#ifdef ZT_AUTO_UPDATE
|
||||
if (ZT_DEFAULTS.updateLatestNfoURL.length()) {
|
||||
_r->updater = new SoftwareUpdater(_r);
|
||||
_r->updater->cleanOldUpdates(); // clean out updates.d on startup
|
||||
} else {
|
||||
LOG("WARNING: unable to enable software updates: latest .nfo URL from ZT_DEFAULTS is empty (does this platform actually support software updates?)");
|
||||
}
|
||||
@ -504,13 +511,15 @@ Node::ReasonForTermination Node::run()
|
||||
* in the natural Mac way. */
|
||||
std::string shutdownIfUnreadablePath(_r->homePath + ZT_PATH_SEPARATOR_S + "shutdownIfUnreadable");
|
||||
|
||||
// Times we last did stuff... used for firing off periodic events.
|
||||
uint64_t lastNetworkAutoconfCheck = Utils::now() - 5000; // check autoconf again after 5s for startup
|
||||
uint64_t lastNetworkAutoconfCheck = Utils::now() - 5000ULL; // check autoconf again after 5s for startup
|
||||
uint64_t lastPingCheck = 0;
|
||||
uint64_t lastSupernodePing = 0;
|
||||
uint64_t lastClean = Utils::now(); // don't need to do this immediately
|
||||
uint64_t lastNetworkFingerprintCheck = 0;
|
||||
uint64_t networkConfigurationFingerprint = _r->sysEnv->getNetworkConfigurationFingerprint();
|
||||
uint64_t lastMulticastCheck = 0;
|
||||
|
||||
uint64_t networkConfigurationFingerprint = _r->sysEnv->getNetworkConfigurationFingerprint(_r->nc->networkTapDeviceNames());
|
||||
_r->timeOfLastNetworkEnvironmentChange = Utils::now();
|
||||
long lastDelayDelta = 0;
|
||||
|
||||
while (impl->reasonForTermination == NODE_RUNNING) {
|
||||
@ -522,31 +531,86 @@ Node::ReasonForTermination Node::run()
|
||||
}
|
||||
|
||||
uint64_t now = Utils::now();
|
||||
bool resynchronize = false;
|
||||
bool resynchronize = impl->resynchronize;
|
||||
if (resynchronize) {
|
||||
LOG("manual resynchronize ordered, resyncing with network");
|
||||
}
|
||||
impl->resynchronize = false;
|
||||
|
||||
// Detect sleep/wake by looking for delay loop pauses that are longer
|
||||
// than we intended to pause.
|
||||
// If it looks like the computer slept and woke, resynchronize.
|
||||
if (lastDelayDelta >= ZT_SLEEP_WAKE_DETECTION_THRESHOLD) {
|
||||
resynchronize = true;
|
||||
LOG("probable suspend/resume detected, pausing a moment for things to settle...");
|
||||
Thread::sleep(ZT_SLEEP_WAKE_SETTLE_TIME);
|
||||
}
|
||||
|
||||
// Periodically check our network environment, sending pings out to all
|
||||
// our direct links if things look like we got a different address.
|
||||
// If our network environment looks like it changed, resynchronize.
|
||||
if ((resynchronize)||((now - lastNetworkFingerprintCheck) >= ZT_NETWORK_FINGERPRINT_CHECK_DELAY)) {
|
||||
lastNetworkFingerprintCheck = now;
|
||||
uint64_t fp = _r->sysEnv->getNetworkConfigurationFingerprint();
|
||||
uint64_t fp = _r->sysEnv->getNetworkConfigurationFingerprint(_r->nc->networkTapDeviceNames());
|
||||
if (fp != networkConfigurationFingerprint) {
|
||||
LOG("netconf fingerprint change: %.16llx != %.16llx, resyncing with network",networkConfigurationFingerprint,fp);
|
||||
networkConfigurationFingerprint = fp;
|
||||
_r->timeOfLastNetworkEnvironmentChange = now;
|
||||
resynchronize = true;
|
||||
_r->nc->whackAllTaps(); // call whack() on all tap devices -- hack, might go away
|
||||
}
|
||||
}
|
||||
|
||||
// Request configuration for unconfigured nets, or nets with out of date
|
||||
// configuration information.
|
||||
// Ping supernodes separately for two reasons: (1) supernodes only ping each
|
||||
// other, and (2) we still want to ping them first on resynchronize.
|
||||
if ((resynchronize)||((now - lastSupernodePing) >= ZT_PEER_DIRECT_PING_DELAY)) {
|
||||
lastSupernodePing = now;
|
||||
std::vector< SharedPtr<Peer> > sns(_r->topology->supernodePeers());
|
||||
TRACE("pinging %d supernodes",(int)sns.size());
|
||||
for(std::vector< SharedPtr<Peer> >::const_iterator p(sns.begin());p!=sns.end();++p)
|
||||
(*p)->sendPing(_r,now);
|
||||
}
|
||||
|
||||
if (resynchronize) {
|
||||
/* If resynchronizing, forget P2P links to all peers and then send
|
||||
* something to formerly active ones. This will relay via a supernode
|
||||
* which will trigger a new RENDEZVOUS and a new hole punch. This
|
||||
* functor excludes supernodes, which are pinged separately above. */
|
||||
_r->topology->eachPeer(Topology::ResetActivePeers(_r,now));
|
||||
} else {
|
||||
// Periodically check for changes in our local multicast subscriptions
|
||||
// and broadcast those changes to directly connected peers.
|
||||
if ((now - lastMulticastCheck) >= ZT_MULTICAST_LOCAL_POLL_PERIOD) {
|
||||
lastMulticastCheck = now;
|
||||
try {
|
||||
std::map< SharedPtr<Network>,std::set<MulticastGroup> > toAnnounce;
|
||||
std::vector< SharedPtr<Network> > networks(_r->nc->networks());
|
||||
for(std::vector< SharedPtr<Network> >::const_iterator nw(networks.begin());nw!=networks.end();++nw) {
|
||||
if ((*nw)->updateMulticastGroups())
|
||||
toAnnounce.insert(std::pair< SharedPtr<Network>,std::set<MulticastGroup> >(*nw,(*nw)->multicastGroups()));
|
||||
}
|
||||
if (toAnnounce.size())
|
||||
_r->sw->announceMulticastGroups(toAnnounce);
|
||||
} catch (std::exception &exc) {
|
||||
LOG("unexpected exception announcing multicast groups: %s",exc.what());
|
||||
} catch ( ... ) {
|
||||
LOG("unexpected exception announcing multicast groups: (unknown)");
|
||||
}
|
||||
}
|
||||
|
||||
// Periodically ping all our non-stale direct peers unless we're a supernode.
|
||||
// Supernodes only ping each other (which is done above).
|
||||
if (!_r->topology->amSupernode()) {
|
||||
if ((now - lastPingCheck) >= ZT_PING_CHECK_DELAY) {
|
||||
lastPingCheck = now;
|
||||
try {
|
||||
_r->topology->eachPeer(Topology::PingPeersThatNeedPing(_r,now));
|
||||
_r->topology->eachPeer(Topology::OpenPeersThatNeedFirewallOpener(_r,now));
|
||||
} catch (std::exception &exc) {
|
||||
LOG("unexpected exception running ping check cycle: %s",exc.what());
|
||||
} catch ( ... ) {
|
||||
LOG("unexpected exception running ping check cycle: (unkonwn)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Periodically or on resynchronize update network configurations.
|
||||
if ((resynchronize)||((now - lastNetworkAutoconfCheck) >= ZT_NETWORK_AUTOCONF_CHECK_DELAY)) {
|
||||
lastNetworkAutoconfCheck = now;
|
||||
std::vector< SharedPtr<Network> > nets(_r->nc->networks());
|
||||
@ -556,51 +620,8 @@ Node::ReasonForTermination Node::run()
|
||||
}
|
||||
}
|
||||
|
||||
// Periodically check for changes in our local multicast subscriptions and broadcast
|
||||
// those changes to peers.
|
||||
if ((resynchronize)||((now - lastMulticastCheck) >= ZT_MULTICAST_LOCAL_POLL_PERIOD)) {
|
||||
lastMulticastCheck = now;
|
||||
try {
|
||||
std::map< SharedPtr<Network>,std::set<MulticastGroup> > toAnnounce;
|
||||
std::vector< SharedPtr<Network> > networks(_r->nc->networks());
|
||||
for(std::vector< SharedPtr<Network> >::const_iterator nw(networks.begin());nw!=networks.end();++nw) {
|
||||
if ((*nw)->updateMulticastGroups())
|
||||
toAnnounce.insert(std::pair< SharedPtr<Network>,std::set<MulticastGroup> >(*nw,(*nw)->multicastGroups()));
|
||||
}
|
||||
if (toAnnounce.size())
|
||||
_r->sw->announceMulticastGroups(toAnnounce);
|
||||
} catch (std::exception &exc) {
|
||||
LOG("unexpected exception announcing multicast groups: %s",exc.what());
|
||||
} catch ( ... ) {
|
||||
LOG("unexpected exception announcing multicast groups: (unknown)");
|
||||
}
|
||||
}
|
||||
|
||||
if ((resynchronize)||((now - lastPingCheck) >= ZT_PING_CHECK_DELAY)) {
|
||||
lastPingCheck = now;
|
||||
try {
|
||||
if (_r->topology->amSupernode()) {
|
||||
// Supernodes are so super they don't even have to ping out, since
|
||||
// all nodes ping them. They're also never firewalled so they
|
||||
// don't need firewall openers. They just ping each other.
|
||||
std::vector< SharedPtr<Peer> > sns(_r->topology->supernodePeers());
|
||||
for(std::vector< SharedPtr<Peer> >::const_iterator p(sns.begin());p!=sns.end();++p) {
|
||||
if ((now - (*p)->lastDirectSend()) > ZT_PEER_DIRECT_PING_DELAY)
|
||||
_r->sw->sendHELLO((*p)->address());
|
||||
}
|
||||
} else {
|
||||
if (resynchronize)
|
||||
_r->topology->eachPeer(Topology::PingAllActivePeers(_r,now));
|
||||
else _r->topology->eachPeer(Topology::PingPeersThatNeedPing(_r,now));
|
||||
_r->topology->eachPeer(Topology::OpenPeersThatNeedFirewallOpener(_r,now));
|
||||
}
|
||||
} catch (std::exception &exc) {
|
||||
LOG("unexpected exception running ping check cycle: %s",exc.what());
|
||||
} catch ( ... ) {
|
||||
LOG("unexpected exception running ping check cycle: (unkonwn)");
|
||||
}
|
||||
}
|
||||
|
||||
// Do periodic cleanup, flushes of stuff to disk, software update
|
||||
// checks, etc.
|
||||
if ((now - lastClean) >= ZT_DB_CLEAN_PERIOD) {
|
||||
lastClean = now;
|
||||
_r->mc->clean();
|
||||
@ -610,6 +631,7 @@ Node::ReasonForTermination Node::run()
|
||||
_r->updater->checkIfMaxIntervalExceeded(now);
|
||||
}
|
||||
|
||||
// Sleep for loop interval or until something interesting happens.
|
||||
try {
|
||||
unsigned long delay = std::min((unsigned long)ZT_MIN_SERVICE_LOOP_INTERVAL,_r->sw->doTimerTasks());
|
||||
uint64_t start = Utils::now();
|
||||
@ -622,6 +644,7 @@ Node::ReasonForTermination Node::run()
|
||||
}
|
||||
}
|
||||
} catch ( ... ) {
|
||||
LOG("FATAL: unexpected exception in core loop: unknown exception");
|
||||
return impl->terminateBecause(Node::NODE_UNRECOVERABLE_ERROR,"unexpected exception during outer main I/O loop");
|
||||
}
|
||||
|
||||
@ -644,6 +667,13 @@ void Node::terminate(ReasonForTermination reason,const char *reasonText)
|
||||
((_NodeImpl *)_impl)->renv.mainLoopWaitCondition.signal();
|
||||
}
|
||||
|
||||
void Node::resync()
|
||||
throw()
|
||||
{
|
||||
((_NodeImpl *)_impl)->resynchronize = true;
|
||||
((_NodeImpl *)_impl)->renv.mainLoopWaitCondition.signal();
|
||||
}
|
||||
|
||||
class _VersionStringMaker
|
||||
{
|
||||
public:
|
||||
|
@ -45,6 +45,10 @@ class Node
|
||||
public:
|
||||
/**
|
||||
* Client for controlling a local ZeroTier One node
|
||||
*
|
||||
* Windows note: be sure you call WSAStartup() before using this,
|
||||
* otherwise it will be unable to open a local UDP socket to
|
||||
* communicate with the service.
|
||||
*/
|
||||
class LocalClient
|
||||
{
|
||||
@ -176,6 +180,12 @@ public:
|
||||
void terminate(ReasonForTermination reason,const char *reasonText)
|
||||
throw();
|
||||
|
||||
/**
|
||||
* Forget p2p links and resynchronize with peers
|
||||
*/
|
||||
void resync()
|
||||
throw();
|
||||
|
||||
/**
|
||||
* Get the ZeroTier version in major.minor.revision string format
|
||||
*
|
||||
|
@ -66,61 +66,66 @@ NodeConfig::NodeConfig(const RuntimeEnvironment *renv,const char *authToken,unsi
|
||||
{
|
||||
{
|
||||
unsigned int csk[64];
|
||||
SHA512::hash(csk,authToken,strlen(authToken));
|
||||
SHA512::hash(csk,authToken,(unsigned int)strlen(authToken));
|
||||
memcpy(_controlSocketKey,csk,32);
|
||||
}
|
||||
|
||||
{
|
||||
Mutex::Lock _llc(_localConfig_m);
|
||||
_readLocalConfig();
|
||||
}
|
||||
|
||||
std::string networksFolder(_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d");
|
||||
std::map<std::string,bool> networksDotD(Utils::listDirectory(networksFolder.c_str()));
|
||||
std::set<uint64_t> nwids;
|
||||
std::vector<uint64_t> configuredNets;
|
||||
for(std::map<std::string,bool>::iterator d(networksDotD.begin());d!=networksDotD.end();++d) {
|
||||
if (!d->second) {
|
||||
std::string::size_type dot = d->first.rfind(".conf");
|
||||
if (dot != std::string::npos) {
|
||||
uint64_t nwid = strtoull(d->first.substr(0,dot).c_str(),(char **)0,16);
|
||||
|
||||
// TODO: remove legacy code once out of beta
|
||||
if (nwid == 0x6c92786fee000001ULL) {
|
||||
nwid = 0xbc8f9a8ee3000001ULL;
|
||||
Utils::rm((networksFolder + ZT_PATH_SEPARATOR_S + d->first).c_str());
|
||||
}
|
||||
if (nwid == 0xbc8f9a8ee3000001ULL) {
|
||||
nwid = 0x8D93FBE886000001ULL;
|
||||
Utils::rm((networksFolder + ZT_PATH_SEPARATOR_S + d->first).c_str());
|
||||
}
|
||||
if (nwid == 0x8D93FBE886000001ULL) {
|
||||
nwid = 0x8056c2e21c000001ULL;
|
||||
Utils::rm((networksFolder + ZT_PATH_SEPARATOR_S + d->first).c_str());
|
||||
}
|
||||
|
||||
if (nwid > 0)
|
||||
nwids.insert(nwid);
|
||||
uint64_t nwid = Utils::hexStrToU64(d->first.substr(0,dot).c_str());
|
||||
if ((nwid > 0)&&(std::find(configuredNets.begin(),configuredNets.end(),nwid) == configuredNets.end()))
|
||||
configuredNets.push_back(nwid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(std::set<uint64_t>::iterator nwid(nwids.begin());nwid!=nwids.end();++nwid) {
|
||||
for(std::vector<uint64_t>::iterator n(configuredNets.begin());n!=configuredNets.end();++n) {
|
||||
try {
|
||||
SharedPtr<Network> nw(Network::newInstance(_r,*nwid));
|
||||
_networks[*nwid] = nw;
|
||||
_networks[*n] = Network::newInstance(_r,this,*n);
|
||||
} catch (std::exception &exc) {
|
||||
LOG("unable to create network %.16llx: %s",(unsigned long long)*nwid,exc.what());
|
||||
LOG("unable to create network %.16llx: %s",(unsigned long long)*n,exc.what());
|
||||
} catch ( ... ) {
|
||||
LOG("unable to create network %.16llx: (unknown exception)",(unsigned long long)*nwid);
|
||||
LOG("unable to create network %.16llx: (unknown exception)",(unsigned long long)*n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NodeConfig::~NodeConfig()
|
||||
{
|
||||
_writeLocalConfig();
|
||||
}
|
||||
|
||||
void NodeConfig::whackAllTaps()
|
||||
void NodeConfig::putLocalConfig(const std::string &key,const char *value)
|
||||
{
|
||||
std::vector< SharedPtr<Network> > nwlist;
|
||||
Mutex::Lock _l(_networks_m);
|
||||
for(std::map< uint64_t,SharedPtr<Network> >::const_iterator n(_networks.begin());n!=_networks.end();++n)
|
||||
n->second->tap().whack();
|
||||
Mutex::Lock _l(_localConfig_m);
|
||||
_localConfig[key] = value;
|
||||
_writeLocalConfig();
|
||||
}
|
||||
|
||||
void NodeConfig::putLocalConfig(const std::string &key,const std::string &value)
|
||||
{
|
||||
Mutex::Lock _l(_localConfig_m);
|
||||
_localConfig[key] = value;
|
||||
_writeLocalConfig();
|
||||
}
|
||||
|
||||
std::string NodeConfig::getLocalConfig(const std::string &key) const
|
||||
{
|
||||
Mutex::Lock _l(_localConfig_m);
|
||||
Dictionary::const_iterator i(_localConfig.find(key));
|
||||
if (i == _localConfig.end())
|
||||
return std::string();
|
||||
return i->second;
|
||||
}
|
||||
|
||||
void NodeConfig::clean()
|
||||
@ -130,6 +135,9 @@ void NodeConfig::clean()
|
||||
n->second->clean();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// UDP localhost control bus
|
||||
|
||||
// Macro used in execute() to push lines onto the return packet
|
||||
#undef _P
|
||||
#define _P(f,...) { r.push_back(std::string()); Utils::stdsprintf(r.back(),(f),##__VA_ARGS__); }
|
||||
@ -187,15 +195,20 @@ std::vector<std::string> NodeConfig::execute(const char *command)
|
||||
_P("200 help terminate [<reason>]");
|
||||
_P("200 help updatecheck");
|
||||
} else if (cmd[0] == "info") {
|
||||
// We are online if at least one supernode has spoken to us since the last time our
|
||||
// network environment changed and also less than ZT_PEER_LINK_ACTIVITY_TIMEOUT ago.
|
||||
bool isOnline = false;
|
||||
uint64_t now = Utils::now();
|
||||
uint64_t since = _r->timeOfLastNetworkEnvironmentChange;
|
||||
std::vector< SharedPtr<Peer> > snp(_r->topology->supernodePeers());
|
||||
for(std::vector< SharedPtr<Peer> >::const_iterator sn(snp.begin());sn!=snp.end();++sn) {
|
||||
if ((*sn)->hasActiveDirectPath(now)) {
|
||||
uint64_t lastRec = (*sn)->lastDirectReceive();
|
||||
if ((lastRec)&&(lastRec > since)&&((now - lastRec) < ZT_PEER_LINK_ACTIVITY_TIMEOUT)) {
|
||||
isOnline = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_P("200 info %s %s %s",_r->identity.address().toString().c_str(),(isOnline ? "ONLINE" : "OFFLINE"),Node::versionString());
|
||||
} else if (cmd[0] == "listpeers") {
|
||||
_P("200 listpeers <ztaddr> <ipv4> <ipv6> <latency> <version>");
|
||||
@ -205,7 +218,7 @@ std::vector<std::string> NodeConfig::execute(const char *command)
|
||||
_P("200 listnetworks <nwid> <name> <status> <config age> <type> <dev> <ips>");
|
||||
for(std::map< uint64_t,SharedPtr<Network> >::const_iterator nw(_networks.begin());nw!=_networks.end();++nw) {
|
||||
std::string tmp;
|
||||
std::set<InetAddress> ips(nw->second->tap().ips());
|
||||
std::set<InetAddress> ips(nw->second->ips());
|
||||
for(std::set<InetAddress>::iterator i(ips.begin());i!=ips.end();++i) {
|
||||
if (tmp.length())
|
||||
tmp.push_back(',');
|
||||
@ -219,25 +232,26 @@ std::vector<std::string> NodeConfig::execute(const char *command)
|
||||
age = 0;
|
||||
age /= 1000;
|
||||
|
||||
std::string dn(nw->second->tapDeviceName());
|
||||
_P("200 listnetworks %.16llx %s %s %lld %s %s %s",
|
||||
(unsigned long long)nw->first,
|
||||
((nconf) ? nconf->name().c_str() : "?"),
|
||||
Network::statusString(nw->second->status()),
|
||||
age,
|
||||
((nconf) ? (nconf->isOpen() ? "public" : "private") : "?"),
|
||||
nw->second->tap().deviceName().c_str(),
|
||||
(dn.length() > 0) ? dn.c_str() : "?",
|
||||
((tmp.length() > 0) ? tmp.c_str() : "-"));
|
||||
}
|
||||
} else if (cmd[0] == "join") {
|
||||
if (cmd.size() > 1) {
|
||||
uint64_t nwid = strtoull(cmd[1].c_str(),(char **)0,16);
|
||||
uint64_t nwid = Utils::hexStrToU64(cmd[1].c_str());
|
||||
if (nwid > 0) {
|
||||
Mutex::Lock _l(_networks_m);
|
||||
if (_networks.count(nwid)) {
|
||||
_P("409 already a member of %.16llx",(unsigned long long)nwid);
|
||||
} else {
|
||||
try {
|
||||
SharedPtr<Network> nw(Network::newInstance(_r,nwid));
|
||||
SharedPtr<Network> nw(Network::newInstance(_r,this,nwid));
|
||||
_networks[nwid] = nw;
|
||||
_P("200 join %.16llx OK",(unsigned long long)nwid);
|
||||
} catch (std::exception &exc) {
|
||||
@ -255,7 +269,7 @@ std::vector<std::string> NodeConfig::execute(const char *command)
|
||||
} else if (cmd[0] == "leave") {
|
||||
if (cmd.size() > 1) {
|
||||
Mutex::Lock _l(_networks_m);
|
||||
uint64_t nwid = strtoull(cmd[1].c_str(),(char **)0,16);
|
||||
uint64_t nwid = Utils::hexStrToU64(cmd[1].c_str());
|
||||
std::map< uint64_t,SharedPtr<Network> >::iterator nw(_networks.find(nwid));
|
||||
if (nw == _networks.end()) {
|
||||
_P("404 leave %.16llx ERROR: not a member of that network",(unsigned long long)nwid);
|
||||
@ -396,4 +410,21 @@ void NodeConfig::_CBcontrolPacketHandler(UdpSocket *sock,void *arg,const InetAdd
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void NodeConfig::_readLocalConfig()
|
||||
{
|
||||
// assumes _localConfig_m is locked
|
||||
std::string localDotConf(_r->homePath + ZT_PATH_SEPARATOR_S + "local.conf");
|
||||
std::string buf;
|
||||
if (Utils::readFile(localDotConf.c_str(),buf))
|
||||
_localConfig.fromString(buf.c_str());
|
||||
}
|
||||
|
||||
void NodeConfig::_writeLocalConfig()
|
||||
{
|
||||
// assumes _localConfig_m is locked
|
||||
Utils::writeFile(((_r->homePath + ZT_PATH_SEPARATOR_S + "local.conf")).c_str(),_localConfig.toString());
|
||||
}
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "Utils.hpp"
|
||||
#include "UdpSocket.hpp"
|
||||
#include "Buffer.hpp"
|
||||
#include "Dictionary.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
@ -67,6 +68,24 @@ public:
|
||||
|
||||
~NodeConfig();
|
||||
|
||||
/**
|
||||
* Store something in local configuration cache
|
||||
*
|
||||
* By convention, keys starting with _ will not be shown in the command bus
|
||||
* local config functions.
|
||||
*
|
||||
* @param key Configuration key
|
||||
* @param value Configuration value
|
||||
*/
|
||||
void putLocalConfig(const std::string &key,const char *value);
|
||||
void putLocalConfig(const std::string &key,const std::string &value);
|
||||
|
||||
/**
|
||||
* @param key Configuration key
|
||||
* @return Value or empty string if not found
|
||||
*/
|
||||
std::string getLocalConfig(const std::string &key) const;
|
||||
|
||||
/**
|
||||
* @param nwid Network ID
|
||||
* @return Network or NULL if no network for that ID
|
||||
@ -90,11 +109,6 @@ public:
|
||||
return nwlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call whack() on all networks' tap devices
|
||||
*/
|
||||
void whackAllTaps();
|
||||
|
||||
/**
|
||||
* Perform cleanup and possibly update saved state
|
||||
*/
|
||||
@ -117,13 +131,16 @@ public:
|
||||
{
|
||||
std::set<std::string> tapDevs;
|
||||
Mutex::Lock _l(_networks_m);
|
||||
for(std::map< uint64_t,SharedPtr<Network> >::const_iterator n(_networks.begin());n!=_networks.end();++n)
|
||||
tapDevs.insert(n->second->tap().deviceName());
|
||||
for(std::map< uint64_t,SharedPtr<Network> >::const_iterator n(_networks.begin());n!=_networks.end();++n) {
|
||||
std::string dn(n->second->tapDeviceName());
|
||||
if (dn.length())
|
||||
tapDevs.insert(dn);
|
||||
}
|
||||
return tapDevs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a command
|
||||
* Execute a control command (called when stuff comes in via control bus)
|
||||
*
|
||||
* @param command Command and arguments separated by whitespace (must already be trimmed of CR+LF, etc.)
|
||||
* @return One or more command results (lines of output)
|
||||
@ -161,12 +178,18 @@ public:
|
||||
private:
|
||||
static void _CBcontrolPacketHandler(UdpSocket *sock,void *arg,const InetAddress &remoteAddr,const void *data,unsigned int len);
|
||||
|
||||
void _readLocalConfig();
|
||||
void _writeLocalConfig();
|
||||
|
||||
const RuntimeEnvironment *_r;
|
||||
|
||||
unsigned char _controlSocketKey[32];
|
||||
UdpSocket _controlSocket;
|
||||
|
||||
std::map< uint64_t,SharedPtr<Network> > _networks;
|
||||
Dictionary _localConfig; // persisted as local.conf
|
||||
Mutex _localConfig_m;
|
||||
|
||||
std::map< uint64_t,SharedPtr<Network> > _networks; // persisted in networks.d/
|
||||
Mutex _networks_m;
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,6 @@ const char *Packet::verbString(Verb v)
|
||||
case VERB_NETWORK_MEMBERSHIP_CERTIFICATE: return "NETWORK_MEMBERSHIP_CERTIFICATE";
|
||||
case VERB_NETWORK_CONFIG_REQUEST: return "NETWORK_CONFIG_REQUEST";
|
||||
case VERB_NETWORK_CONFIG_REFRESH: return "NETWORK_CONFIG_REFRESH";
|
||||
case VERB_PROBE: return "PROBE";
|
||||
}
|
||||
return "(unknown)";
|
||||
}
|
||||
@ -64,7 +63,7 @@ const char *Packet::errorString(ErrorCode e)
|
||||
case ERROR_IDENTITY_COLLISION: return "IDENTITY_COLLISION";
|
||||
case ERROR_UNSUPPORTED_OPERATION: return "UNSUPPORTED_OPERATION";
|
||||
case ERROR_NEED_MEMBERSHIP_CERTIFICATE: return "NEED_MEMBERSHIP_CERTIFICATE";
|
||||
case ERROR_NETWORK_ACCESS_DENIED: return "NETWORK_ACCESS_DENIED";
|
||||
case ERROR_NETWORK_ACCESS_DENIED_: return "NETWORK_ACCESS_DENIED";
|
||||
}
|
||||
return "(unknown)";
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user