mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-17 18:29:57 +00:00
Build fix for UI and mac.
This commit is contained in:
parent
0e84eb3852
commit
8bd9f7d51d
@ -18,37 +18,37 @@ SOURCES += main.cpp \
|
|||||||
installdialog.cpp \
|
installdialog.cpp \
|
||||||
licensedialog.cpp \
|
licensedialog.cpp \
|
||||||
onetimedialog.cpp \
|
onetimedialog.cpp \
|
||||||
|
../control/IpcConnection.cpp \
|
||||||
|
../control/IpcListener.cpp \
|
||||||
|
../control/NodeControlClient.cpp \
|
||||||
|
../control/NodeControlService.cpp \
|
||||||
../node/C25519.cpp \
|
../node/C25519.cpp \
|
||||||
../node/CertificateOfMembership.cpp \
|
../node/CertificateOfMembership.cpp \
|
||||||
../node/Defaults.cpp \
|
../node/Defaults.cpp \
|
||||||
|
../node/Dictionary.cpp \
|
||||||
../node/HttpClient.cpp \
|
../node/HttpClient.cpp \
|
||||||
../node/Identity.cpp \
|
../node/Identity.cpp \
|
||||||
|
../node/IncomingPacket.cpp \
|
||||||
../node/InetAddress.cpp \
|
../node/InetAddress.cpp \
|
||||||
../node/IpcConnection.cpp \
|
|
||||||
../node/IpcListener.cpp \
|
|
||||||
../node/Logger.cpp \
|
../node/Logger.cpp \
|
||||||
../node/Multicaster.cpp \
|
../node/Multicaster.cpp \
|
||||||
../node/Network.cpp \
|
../node/Network.cpp \
|
||||||
../node/NetworkConfig.cpp \
|
../node/NetworkConfig.cpp \
|
||||||
../node/Node.cpp \
|
../node/Node.cpp \
|
||||||
../node/NodeConfig.cpp \
|
../node/NodeConfig.cpp \
|
||||||
|
../node/OutboundMulticast.cpp \
|
||||||
../node/Packet.cpp \
|
../node/Packet.cpp \
|
||||||
../node/PacketDecoder.cpp \
|
|
||||||
../node/Peer.cpp \
|
../node/Peer.cpp \
|
||||||
../node/Poly1305.cpp \
|
../node/Poly1305.cpp \
|
||||||
../node/RoutingTable.cpp \
|
../node/RoutingTable.cpp \
|
||||||
../node/Salsa20.cpp \
|
../node/Salsa20.cpp \
|
||||||
../node/Service.cpp \
|
../node/Service.cpp \
|
||||||
../node/SHA512.cpp \
|
../node/SHA512.cpp \
|
||||||
../node/SocketManager.cpp \
|
|
||||||
../node/SoftwareUpdater.cpp \
|
../node/SoftwareUpdater.cpp \
|
||||||
../node/Switch.cpp \
|
../node/Switch.cpp \
|
||||||
../node/TcpSocket.cpp \
|
|
||||||
../node/Topology.cpp \
|
../node/Topology.cpp \
|
||||||
../node/UdpSocket.cpp \
|
|
||||||
../node/Utils.cpp \
|
../node/Utils.cpp \
|
||||||
../ext/lz4/lz4.c \
|
../ext/lz4/lz4.c
|
||||||
../node/Dictionary.cpp
|
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
aboutwindow.h \
|
aboutwindow.h \
|
||||||
@ -58,7 +58,12 @@ HEADERS += mainwindow.h \
|
|||||||
licensedialog.h \
|
licensedialog.h \
|
||||||
main.h \
|
main.h \
|
||||||
onetimedialog.h \
|
onetimedialog.h \
|
||||||
|
../control/IpcConnection.hpp \
|
||||||
|
../control/IpcListener.hpp \
|
||||||
|
../control/NodeControlClient.hpp \
|
||||||
|
../control/NodeControlService.hpp \
|
||||||
../node/Address.hpp \
|
../node/Address.hpp \
|
||||||
|
../node/AntiRecursion.hpp \
|
||||||
../node/Array.hpp \
|
../node/Array.hpp \
|
||||||
../node/AtomicCounter.hpp \
|
../node/AtomicCounter.hpp \
|
||||||
../node/BandwidthAccount.hpp \
|
../node/BandwidthAccount.hpp \
|
||||||
@ -69,11 +74,12 @@ HEADERS += mainwindow.h \
|
|||||||
../node/Constants.hpp \
|
../node/Constants.hpp \
|
||||||
../node/Defaults.hpp \
|
../node/Defaults.hpp \
|
||||||
../node/Dictionary.hpp \
|
../node/Dictionary.hpp \
|
||||||
|
../node/EthernetTap.hpp \
|
||||||
|
../node/EthernetTapFactory.hpp \
|
||||||
../node/HttpClient.hpp \
|
../node/HttpClient.hpp \
|
||||||
../node/Identity.hpp \
|
../node/Identity.hpp \
|
||||||
|
../node/IncomingPacket.hpp \
|
||||||
../node/InetAddress.hpp \
|
../node/InetAddress.hpp \
|
||||||
../node/IpcConnection.hpp \
|
|
||||||
../node/IpcListener.hpp \
|
|
||||||
../node/Logger.hpp \
|
../node/Logger.hpp \
|
||||||
../node/MAC.hpp \
|
../node/MAC.hpp \
|
||||||
../node/Multicaster.hpp \
|
../node/Multicaster.hpp \
|
||||||
@ -84,11 +90,12 @@ HEADERS += mainwindow.h \
|
|||||||
../node/Node.hpp \
|
../node/Node.hpp \
|
||||||
../node/NodeConfig.hpp \
|
../node/NodeConfig.hpp \
|
||||||
../node/NonCopyable.hpp \
|
../node/NonCopyable.hpp \
|
||||||
|
../node/OutboundMulticast.hpp \
|
||||||
../node/Packet.hpp \
|
../node/Packet.hpp \
|
||||||
../node/PacketDecoder.hpp \
|
|
||||||
../node/Path.hpp \
|
../node/Path.hpp \
|
||||||
../node/Peer.hpp \
|
../node/Peer.hpp \
|
||||||
../node/Poly1305.hpp \
|
../node/Poly1305.hpp \
|
||||||
|
../node/RoutingTable.hpp \
|
||||||
../node/RuntimeEnvironment.hpp \
|
../node/RuntimeEnvironment.hpp \
|
||||||
../node/Salsa20.hpp \
|
../node/Salsa20.hpp \
|
||||||
../node/Service.hpp \
|
../node/Service.hpp \
|
||||||
@ -98,15 +105,10 @@ HEADERS += mainwindow.h \
|
|||||||
../node/SocketManager.hpp \
|
../node/SocketManager.hpp \
|
||||||
../node/SoftwareUpdater.hpp \
|
../node/SoftwareUpdater.hpp \
|
||||||
../node/Switch.hpp \
|
../node/Switch.hpp \
|
||||||
../node/RoutingTable.hpp \
|
|
||||||
../node/TcpSocket.hpp \
|
|
||||||
../node/Thread.hpp \
|
../node/Thread.hpp \
|
||||||
../node/Topology.hpp \
|
../node/Topology.hpp \
|
||||||
../node/UdpSocket.hpp \
|
|
||||||
../node/Utils.hpp \
|
../node/Utils.hpp \
|
||||||
../ext/lz4/lz4.h \
|
../ext/lz4/lz4.h
|
||||||
../node/EthernetTap.hpp \
|
|
||||||
../node/EthernetTapFactory.hpp
|
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
aboutwindow.ui \
|
aboutwindow.ui \
|
||||||
|
@ -62,8 +62,11 @@
|
|||||||
#include "mac_doprivileged.h"
|
#include "mac_doprivileged.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "../node/Utils.hpp"
|
||||||
|
#include "../node/Identity.hpp"
|
||||||
|
|
||||||
// Globally visible
|
// Globally visible
|
||||||
ZeroTier::Node::NodeControlClient *zeroTierClient = (ZeroTier::Node::NodeControlClient *)0;
|
ZeroTier::NodeControlClient *zeroTierClient = (ZeroTier::NodeControlClient *)0;
|
||||||
|
|
||||||
// Main window instance for app
|
// Main window instance for app
|
||||||
QMainWindow *mainWindow = (MainWindow *)0;
|
QMainWindow *mainWindow = (MainWindow *)0;
|
||||||
@ -77,6 +80,7 @@ static void handleZTMessage(void *arg,const char *line)
|
|||||||
ztReplies_m.lock();
|
ztReplies_m.lock();
|
||||||
|
|
||||||
if (line) {
|
if (line) {
|
||||||
|
//printf("%s\n",line);
|
||||||
if ((line[0] == '.')&&(line[1] == (char)0)) {
|
if ((line[0] == '.')&&(line[1] == (char)0)) {
|
||||||
// The message is packed into an event and sent to the main window where
|
// The message is packed into an event and sent to the main window where
|
||||||
// the actual parsing code lives.
|
// the actual parsing code lives.
|
||||||
@ -136,7 +140,7 @@ MainWindow::~MainWindow()
|
|||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
delete zeroTierClient;
|
delete zeroTierClient;
|
||||||
zeroTierClient = (ZeroTier::Node::NodeControlClient *)0;
|
zeroTierClient = (ZeroTier::NodeControlClient *)0;
|
||||||
mainWindow = (MainWindow *)0;
|
mainWindow = (MainWindow *)0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +165,7 @@ void MainWindow::timerEvent(QTimerEvent *event) // event can be null since code
|
|||||||
|
|
||||||
if (!zeroTierClient) {
|
if (!zeroTierClient) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
if ((!QFile::exists(ZeroTier::Node::NodeControlClient::authTokenDefaultUserPath()))&&(QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one"))) {
|
if ((!QFile::exists(ZeroTier::NodeControlClient::authTokenDefaultUserPath()))&&(QFile::exists("/Library/Application Support/ZeroTier/One/zerotier-one"))) {
|
||||||
// Authorize user by copying auth token into local home directory
|
// 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);
|
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);
|
||||||
|
|
||||||
@ -204,14 +208,21 @@ void MainWindow::timerEvent(QTimerEvent *event) // event can be null since code
|
|||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
try {
|
try {
|
||||||
zeroTierClient = new ZeroTier::Node::NodeControlClient((const char *)0,&handleZTMessage,this);
|
std::string buf;
|
||||||
|
if (ZeroTier::Utils::readFile("/Library/Application Support/ZeroTier/One/identity.public",buf)) {
|
||||||
|
ZeroTier::Identity id;
|
||||||
|
if (id.fromString(buf)) {
|
||||||
|
std::string authToken(ZeroTier::NodeControlClient::getAuthToken(ZeroTier::NodeControlClient::authTokenDefaultUserPath(),false));
|
||||||
|
zeroTierClient = new ZeroTier::NodeControlClient((std::string(ZT_IPC_ENDPOINT_BASE) + id.address().toString()).c_str(),authToken.c_str(),&handleZTMessage,this);
|
||||||
const char *err = zeroTierClient->error();
|
const char *err = zeroTierClient->error();
|
||||||
if (err) {
|
if (err) {
|
||||||
delete zeroTierClient;
|
delete zeroTierClient;
|
||||||
zeroTierClient = (ZeroTier::Node::NodeControlClient *)0;
|
zeroTierClient = (ZeroTier::NodeControlClient *)0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
zeroTierClient = (ZeroTier::Node::NodeControlClient *)0;
|
zeroTierClient = (ZeroTier::NodeControlClient *)0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +248,7 @@ void MainWindow::customEvent(QEvent *event)
|
|||||||
ZTMessageEvent *m = (ZTMessageEvent *)event; // only one custom event type so far
|
ZTMessageEvent *m = (ZTMessageEvent *)event; // only one custom event type so far
|
||||||
if (m->ztMessage.size() == 0)
|
if (m->ztMessage.size() == 0)
|
||||||
return;
|
return;
|
||||||
std::vector<std::string> hdr(ZeroTier::Node::NodeControlClient::splitLine(m->ztMessage[0]));
|
std::vector<std::string> hdr(ZeroTier::NodeControlClient::splitLine(m->ztMessage[0]));
|
||||||
if (hdr.size() < 2)
|
if (hdr.size() < 2)
|
||||||
return;
|
return;
|
||||||
if (hdr[0] != "200")
|
if (hdr[0] != "200")
|
||||||
@ -255,7 +266,7 @@ void MainWindow::customEvent(QEvent *event)
|
|||||||
} else if (hdr[1] == "listnetworks") {
|
} else if (hdr[1] == "listnetworks") {
|
||||||
std::map< std::string,std::vector<std::string> > newNetworks;
|
std::map< std::string,std::vector<std::string> > newNetworks;
|
||||||
for(unsigned long i=1;i<m->ztMessage.size();++i) {
|
for(unsigned long i=1;i<m->ztMessage.size();++i) {
|
||||||
std::vector<std::string> l(ZeroTier::Node::NodeControlClient::splitLine(m->ztMessage[i]));
|
std::vector<std::string> l(ZeroTier::NodeControlClient::splitLine(m->ztMessage[i]));
|
||||||
// 200 listnetworks <nwid> <name> <mac> <status> <config age> <type> <dev> <ips>
|
// 200 listnetworks <nwid> <name> <mac> <status> <config age> <type> <dev> <ips>
|
||||||
if ((l.size() == 10)&&(l[2].length() == 16))
|
if ((l.size() == 10)&&(l[2].length() == 16))
|
||||||
newNetworks[l[2]] = l;
|
newNetworks[l[2]] = l;
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include "../node/Constants.hpp"
|
#include "../node/Constants.hpp"
|
||||||
#include "../node/Node.hpp"
|
#include "../node/Node.hpp"
|
||||||
#include "../node/Utils.hpp"
|
#include "../node/Utils.hpp"
|
||||||
|
#include "../control/NodeControlClient.hpp"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
@ -49,7 +50,7 @@ class MainWindow;
|
|||||||
|
|
||||||
// Globally visible instance of local client for communicating with ZT1
|
// Globally visible instance of local client for communicating with ZT1
|
||||||
// Can be null if not connected, or will point to current
|
// Can be null if not connected, or will point to current
|
||||||
extern ZeroTier::Node::NodeControlClient *zeroTierClient;
|
extern ZeroTier::NodeControlClient *zeroTierClient;
|
||||||
|
|
||||||
// Globally visible pointer to main app window
|
// Globally visible pointer to main app window
|
||||||
extern QMainWindow *mainWindow;
|
extern QMainWindow *mainWindow;
|
||||||
|
@ -68,7 +68,7 @@ mac-ui: FORCE
|
|||||||
$(CODESIGN) -vvv "build-ZeroTierUI-release/ZeroTier One.app"
|
$(CODESIGN) -vvv "build-ZeroTierUI-release/ZeroTier One.app"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.dSYM testnet.o selftest.o build-* $(OBJS) $(TESTNET_OBJS) zerotier-* ZeroTierOneInstaller-* "ZeroTier One.zip" "ZeroTier One.dmg"
|
rm -rf *.dSYM testnet.o selftest.o build-* *.o $(OBJS) $(TESTNET_OBJS) zerotier-* ZeroTierOneInstaller-* "ZeroTier One.zip" "ZeroTier One.dmg"
|
||||||
|
|
||||||
# For our use -- builds official signed binary, packages in installer and download DMG
|
# For our use -- builds official signed binary, packages in installer and download DMG
|
||||||
official: FORCE
|
official: FORCE
|
||||||
|
Loading…
Reference in New Issue
Block a user