From b2f0b35608459449bdade3f969a409812156a2cf Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 14 Jan 2020 14:37:49 -0800 Subject: [PATCH] Move self-test so it can be called from CLI and always builds, implement Endpoint and Locator deserialization in Go as well as C++. --- CMakeLists.txt | 4 - go/cmd/zerotier/cli/help.go | 76 ++++----- go/cmd/zerotier/cli/selftest.go | 30 ++++ go/cmd/zerotier/zerotier.go | 3 + go/native/CMakeLists.txt | 1 + selftest.cpp => go/native/CoreTests.cpp | 199 +++--------------------- go/native/GoGlue.h | 9 +- go/pkg/zerotier/endpoint.go | 115 ++++++++++++++ go/pkg/zerotier/inetaddress.go | 134 ++++++++++++++-- go/pkg/zerotier/locator.go | 47 +++++- go/pkg/zerotier/node.go | 74 ++------- go/pkg/zerotier/root.go | 8 +- node/CMakeLists.txt | 5 +- node/Endpoint.cpp | 185 ++++++++++++++++++++++ node/Endpoint.hpp | 175 ++------------------- node/InetAddress.cpp | 62 ++++++++ node/InetAddress.hpp | 75 +-------- node/Locator.cpp | 4 +- node/OS.hpp | 67 ++++---- node/Packet.hpp | 73 ++++----- 20 files changed, 718 insertions(+), 628 deletions(-) create mode 100644 go/cmd/zerotier/cli/selftest.go rename selftest.cpp => go/native/CoreTests.cpp (95%) create mode 100644 go/pkg/zerotier/endpoint.go create mode 100644 node/Endpoint.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b1d104b2..aa07e94fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,7 +177,3 @@ add_custom_command( DEPENDS zt_osdep zt_core zt_go_native ) add_custom_target(build_zerotier ALL DEPENDS zerotier) - -add_executable(zerotier-selftest selftest.cpp) -target_link_libraries(zerotier-selftest ${libs} zt_core zt_osdep) -target_compile_features(zerotier-selftest PUBLIC cxx_std_11) diff --git a/go/cmd/zerotier/cli/help.go b/go/cmd/zerotier/cli/help.go index fabd65b50..55708cb79 100644 --- a/go/cmd/zerotier/cli/help.go +++ b/go/cmd/zerotier/cli/help.go @@ -30,45 +30,47 @@ func Help() { Usage: zerotier [-options] [command args] Global Options: - -j Output raw JSON where applicable - -p Use alternate base path - -t Use secret auth token from this file + -j Output raw JSON where applicable + -p Use alternate base path + -t Use secret auth token from this file Commands: - help Show this help - version Print version - service Start in system service mode - status Show ZeroTier service status and config - peers Show VL1 peers - roots Show configured VL1 root servers - addroot Add VL1 root server - removeroot Remove VL1 root server - identity [args] Identity management commands - new [c25519|p384] Create new identity (including secret) - getpublic Extract only public part of identity - validate Locally validate an identity - sign Sign a file with an identity's key - verify Verify a signature - networks List joined VL2 virtual networks - network Show verbose network info - join Join a virtual network - leave Leave a virtual network - set