Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev into main #253

Merged
merged 89 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
a6f6886
Exclude temporary IPv6 checks for SDK builds (#147 and #184)
joseph-henry Jun 1, 2022
361c6ff
Add mention of JDK to build matrix
joseph-henry Jun 1, 2022
0bcae7b
Update README.md
joseph-henry Jun 1, 2022
cc58bce
Tweak build.sh
joseph-henry Jun 1, 2022
7ad5b78
Bump regex from 1.5.4 to 1.5.6 in /pkg/crate/libzt
dependabot[bot] Jun 6, 2022
eca2f5b
Merge pull request #186 from zerotier/dependabot/cargo/pkg/crate/libz…
joseph-henry Jun 9, 2022
038166f
upgrade gradle versions and include .cxx bindings
Nov 23, 2022
0cb84aa
Merge pull request #201 from tejas238/android-fixes-tejas
joseph-henry Nov 23, 2022
9d66844
Fix ZTS_MAX_PEER_NETWORK_PATHS to equal ZTO submodule
janvanbouwel Feb 21, 2023
b4e06b6
Merge pull request #209 from janvanbouwel/fix-include-constants
joseph-henry Feb 21, 2023
71c2f97
Fix broken include path for JSON library
joseph-henry Feb 21, 2023
48adf41
Move java files to com/zerotier/sockets subfolder
bostick Dec 9, 2022
4531b38
Merge pull request #214 from zerotier/brenton/move
joseph-henry May 25, 2023
8952a6b
Fix typos ZTS_CENRTAL_MAX_URL_LEN -> ZTS_CENTRAL_MAX_URL_LEN
bostick Dec 9, 2022
d00f72a
Fix typo accetpedFd -> acceptedFd
bostick Dec 9, 2022
51af6aa
Fix typo TCP_SLOW_INTERVALs -> TCP_SLOW_INTERVAL
bostick Dec 9, 2022
8bd9a18
remove stray U+200b characters
bostick Dec 9, 2022
18c009d
fix: Incorrect type for parameter 'thisObj', which should have type '…
bostick Dec 9, 2022
472b4d3
fix bad parameter
bostick Dec 9, 2022
e47e37d
fix stray GetFieldID
bostick Dec 9, 2022
f656868
update various settings for Android and Gradle
bostick Dec 11, 2022
044d2ce
Merge pull request #215 from zerotier/brenton/fix-this
joseph-henry May 26, 2023
38334d8
Merge pull request #216 from zerotier/brenton/fix-stray-getfieldid
joseph-henry May 26, 2023
57fd2e2
Merge pull request #217 from zerotier/brenton/fix-bad-param
joseph-henry May 26, 2023
bb578e9
Merge pull request #219 from zerotier/brenton/update-gradle
joseph-henry May 26, 2023
7d82d0e
Merge pull request #218 from zerotier/brenton/fix-typos
joseph-henry May 26, 2023
8a90a7b
Fix warning about function never used
bostick May 26, 2023
03670cc
Merge pull request #220 from zerotier/brenton/fix-overloaded
joseph-henry May 30, 2023
87e344b
add new prometheus headers that are now used by ZeroTierOne
bostick Jun 1, 2023
0d81706
Fix a few issues with Android build
bostick Jun 2, 2023
4aa57d7
Merge pull request #222 from zerotier/brenton/fix-android-build
joseph-henry Jun 2, 2023
356dcd0
Update Java example
joseph-henry Jun 4, 2023
787dd6e
new rust demo + cleanup of build
rcoder Jun 6, 2023
91b190d
should work for non-oneshot (request/response) protocols a little bet…
rcoder Jun 6, 2023
8c9ac11
Merge pull request #221 from zerotier/brenton/add-prometheus
joseph-henry Jun 6, 2023
bfa02c5
Merge pull request #223 from zerotier/ldr/rust-demo
joseph-henry Jun 6, 2023
eabceab
Update ZTO submodule to 1.10.6-dev
joseph-henry Jun 6, 2023
916a2ce
Update iOS SDK version to 16.4
joseph-henry Jun 6, 2023
fad04bf
Update examples:
bostick Jun 30, 2023
cf07630
Merge pull request #227 from zerotier/brenton/update-examples
joseph-henry Jun 30, 2023
e602393
Bump ZTO submodule commit to include iOS fix
joseph-henry Jul 17, 2023
27805f8
Add low-bandwidth mode
joseph-henry Jul 18, 2023
9f36334
Fix typo in return type
joseph-henry Jul 18, 2023
8d6d515
fix links
bostick Jul 18, 2023
8066b0e
fix typos
bostick Jul 19, 2023
f856f04
Merge pull request #228 from zerotier/brenton/fix-typos
laduke Jul 19, 2023
279fc18
Merge pull request #229 from zerotier/brenton/fix-links
laduke Jul 19, 2023
6ce18af
fix unused warnings
bostick Jul 19, 2023
88681c0
fix: Cannot resolve corresponding JNI function Java_com_zerotier_sock…
bostick Jul 19, 2023
fd00026
fix 'No such file or directory' error
bostick Jul 19, 2023
a0ffaec
fix return type warnings
bostick Jul 19, 2023
1230544
Merge pull request #233 from zerotier/brenton/fix-unused-warnings
joseph-henry Jul 20, 2023
a3b3d82
Merge pull request #232 from zerotier/brenton/fix-missing-jni-function
joseph-henry Jul 20, 2023
e0200fb
Merge pull request #231 from zerotier/brenton/fix-return-type-warnings
joseph-henry Jul 20, 2023
ca83e94
Merge pull request #230 from zerotier/brenton/fix-no-such-file-or-dir…
joseph-henry Jul 20, 2023
5874e44
Port over TCP relay functionality from ZeroTier One
joseph-henry Jul 25, 2023
10548d9
Fix mismatched types in tcp relay api
joseph-henry Jul 26, 2023
2d83bc2
Fix tcp relay api logic error
joseph-henry Jul 26, 2023
b85a6a4
Fix typos and bump ZTO submodule commit to include Fix typos (https:/…
bostick Aug 2, 2023
02dbc8f
Merge pull request #236 from zerotier/brenton/fix-typos
joseph-henry Aug 2, 2023
6fe2d49
Fix: field '_lastRestart' will be initialized after field '_tcpFallba…
bostick Aug 2, 2023
aede837
Fix: warning: enumeration value 'TCP_HTTP_OUTGOING' not handled in sw…
bostick Aug 2, 2023
928d08c
Merge pull request #238 from zerotier/brenton/fix-reorder-ctor
joseph-henry Aug 2, 2023
f5eee8d
Merge pull request #237 from zerotier/brenton/fix-switch
joseph-henry Aug 2, 2023
b4c7fd1
Fix: Cannot resolve symbol 'localPort'
bostick Aug 2, 2023
8aa6890
Fix: Incorrect type for parameter 'net_id', which should have type 'j…
bostick Aug 2, 2023
79636da
Merge pull request #240 from zerotier/brenton/fix-cannot-resolve-symbol
joseph-henry Aug 2, 2023
431c421
Merge pull request #239 from zerotier/brenton/fix-incorrect-types
joseph-henry Aug 2, 2023
dd0d606
Add missing zts_init_set_low_bandwidth_mode
joseph-henry Aug 3, 2023
dd45f9f
Fix https://github.com/zerotier/libzt/issues/242
bostick Aug 4, 2023
624038d
Merge pull request #243 from zerotier/bugfix/242
joseph-henry Aug 4, 2023
b1d088f
fix examples warnings
bostick Aug 18, 2023
8480053
fix formatting
bostick Aug 18, 2023
18a2c38
Fix warning: [cast] redundant cast to int
bostick Aug 18, 2023
9ca6873
add ZTS_IN6ADDR_ANY_INIT and zts_in6addr_any
bostick Aug 18, 2023
29b2087
Remove debug optimization -O3
bostick Aug 18, 2023
1895767
Fix fatal error: jni_md.h: No such file or directory
bostick Aug 18, 2023
67cdb59
Merge pull request #245 from zerotier/brenton/add-zts_in6addr_any
joseph-henry Aug 19, 2023
d5ffe38
Merge pull request #246 from zerotier/brenton/jni-work
joseph-henry Aug 19, 2023
b2d5e08
Merge pull request #247 from zerotier/brenton/remove-debug-optimization
joseph-henry Aug 19, 2023
2ec28b8
Merge pull request #248 from zerotier/brenton/fix-redundant-cast
joseph-henry Aug 19, 2023
2a8670e
Merge pull request #249 from zerotier/brenton/fix-formatting
joseph-henry Aug 19, 2023
f800bba
Merge pull request #250 from zerotier/brenton/fix-examples-warnings
joseph-henry Aug 19, 2023
f5ffc06
rename
bostick Aug 21, 2023
ee5047b
Fix https://github.com/zerotier/libzt/issues/244:
bostick Aug 21, 2023
af217eb
Merge pull request #251 from zerotier/bugfix/244
joseph-henry Aug 21, 2023
8a414d5
Fix #211: Use tcpip_input for IPv6 instead of ethernet_input
bostick Aug 21, 2023
1bdced9
Merge pull request #252 from zerotier/bugfix/211
joseph-henry Aug 21, 2023
d12d43c
Update ZeroTierOne submodule to 1.12 + ipv6 tx fix
joseph-henry Aug 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .version

This file was deleted.

82 changes: 42 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ endif()
# ------------------------------------------------------------------------------
# | INCLUDE DIRECTORIES |
# ------------------------------------------------------------------------------
# Temporary measure to test GitHub workflow on Ubuntu
include_directories(/usr/lib/jvm/java-11-openjdk-amd64/include/linux/)
# ZeroTier
include_directories(${ZTO_SRC_DIR})
include_directories(${ZTO_SRC_DIR}/include)
Expand All @@ -92,6 +90,8 @@ include_directories(${ZTO_SRC_DIR}/osdep)
# ZeroTier (ext)
#include_directories(${ZTO_SRC_DIR}/ext/miniupnpc)
include_directories(${ZTO_SRC_DIR}/ext/libnatpmp)
include_directories(${ZTO_SRC_DIR}/ext/prometheus-cpp-lite-1.0/core/include)
include_directories(${ZTO_SRC_DIR}/ext/prometheus-cpp-lite-1.0/simpleapi/include)
# libzt
include_directories(${PROJ_DIR}/src)
include_directories(${PROJ_DIR}/include)
Expand All @@ -116,7 +116,7 @@ if (ZTS_ENABLE_PINVOKE)
# Features
set(BUILD_STATIC_LIB FALSE)
set(BUILD_SHARED_LIB TRUE)
set(BUILD_EXAMPLES FALSE)
set(BUILD_HOST_EXAMPLES FALSE)
set(ALLOW_INSTALL_TARGET FALSE)
set(BUILD_HOST_SELFTEST FALSE)
# Sources and libraries
Expand All @@ -129,7 +129,7 @@ if (ZTS_ENABLE_RUST)
# Features
set(BUILD_STATIC_LIB TRUE)
set(BUILD_SHARED_LIB FALSE)
set(BUILD_EXAMPLES FALSE)
set(BUILD_HOST_EXAMPLES FALSE)
set(ALLOW_INSTALL_TARGET FALSE)
set(BUILD_HOST_SELFTEST FALSE)
endif()
Expand All @@ -142,7 +142,7 @@ if (ZTS_ENABLE_PYTHON)
# Targets
set(BUILD_STATIC_LIB FALSE)
set(BUILD_SHARED_LIB TRUE)
set(BUILD_EXAMPLES FALSE)
set(BUILD_HOST_EXAMPLES FALSE)
set(ALLOW_INSTALL_TARGET FALSE)
set(BUILD_HOST_SELFTEST FALSE)
# Sources and libraries
Expand Down Expand Up @@ -190,15 +190,17 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Android")
set(BUILD_STATIC_LIB FALSE)
set(BUILD_SHARED_LIB TRUE)
set(BUILD_HOST_SELFTEST FALSE)
set(BUILD_EXAMPLES FALSE)
set(BUILD_HOST_EXAMPLES FALSE)
set(ALLOW_INSTALL_TARGET FALSE)
set(LANG_WRAPPER_FILE ${LIBZT_SRC_DIR}/bindings/java/*.cxx)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DZTS_ENABLE_JAVA=1")
endif()

if(BUILD_MACOS_FRAMEWORK)
set(BUILD_STATIC_LIB TRUE)
set(BUILD_SHARED_LIB TRUE)
set(BUILD_HOST_SELFTEST FALSE)
set(BUILD_EXAMPLES FALSE)
set(BUILD_HOST_EXAMPLES FALSE)
set(ALLOW_INSTALL_TARGET FALSE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOMIT_JSON_SUPPORT=1")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DOMIT_JSON_SUPPORT=1")
Expand All @@ -213,15 +215,15 @@ if(BUILD_IOS_FRAMEWORK)
set(BUILD_STATIC_LIB TRUE)
set(BUILD_SHARED_LIB TRUE)
set(BUILD_HOST_SELFTEST FALSE)
set(BUILD_EXAMPLES FALSE)
set(BUILD_HOST_EXAMPLES FALSE)
set(ALLOW_INSTALL_TARGET FALSE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOMIT_JSON_SUPPORT=1")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DOMIT_JSON_SUPPORT=1")
set(DEVROOT
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
if(IOS_ARM64)
set(CMAKE_OSX_ARCHITECTURES arm64)
set(SDKVER "11.4")
set(SDKVER "16.4")
endif()
if(IOS_ARMV7)
# armv7 armv7s
Expand Down Expand Up @@ -277,7 +279,6 @@ endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "debug")
set(BUILD_DEBUG ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(DEBUG_OPTIMIZATION "-O3")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "release")
set(BUILD_RELEASE ON)
Expand Down Expand Up @@ -396,7 +397,6 @@ else()

set(CMAKE_C_FLAGS_DEBUG
"${CMAKE_C_FLAGS_DEBUG} \
${DEBUG_OPTIMIZATION} \
-DLWIP_DEBUG=1 -DLIBZT_DEBUG=1")

set(CMAKE_C_FLAGS_RELEASE
Expand All @@ -409,7 +409,6 @@ else()

set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} \
${DEBUG_OPTIMIZATION} \
-DLWIP_DEBUG=1 -DLIBZT_DEBUG=1")

set(CMAKE_CXX_FLAGS_RELEASE
Expand Down Expand Up @@ -467,37 +466,40 @@ endif()

if(ZTS_ENABLE_JAVA OR (BUILD_ANDROID AND NOT ZTS_NDK_ONLY))
message(STATUS "Looking for JNI")

if(BUILD_WIN)
# We are only interested in finding jni.h: we do not care about extended JVM
# functionality or the AWT library. set(JAVA_AWT_LIBRARY NotNeeded)
# set(JAVA_JVM_LIBRARY NotNeeded) set(JAVA_INCLUDE_PATH2 NotNeeded)
# set(JAVA_AWT_INCLUDE_PATH NotNeeded)
set(JAVA_INCLUDE_PATH "C:\\Program Files\\Java\\jdk-10.0.2\\include")
endif()

message(STATUS "Ignore seeing \"Found JNI: NotNeeded\" below; check that JNI_INCLUDE_DIRS is valid")

#
# "trick" CMake into thinking that we have already found these
# https://stackoverflow.com/a/51764145
#
# These may be missing, but we do not need them
#
# There is no official way of telling CMake: "skip looking for AWT, etc."
#
set(JAVA_AWT_LIBRARY NotNeeded)
set(JAVA_JVM_LIBRARY NotNeeded)
set(JAVA_INCLUDE_PATH2 NotNeeded)
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
find_package(JNI REQUIRED)

if(JNI_FOUND)
message(STATUS "JNI_INCLUDE_DIR=${JNI_INCLUDE_DIRS}")
message(STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
list(GET JNI_INCLUDE_DIRS 0 JNI_INCLUDE_DIR)
message(STATUS "jni path=${JNI_INCLUDE_DIR}")
include_directories("${JNI_INCLUDE_DIR}")
# include_directories ("${JNI_INCLUDE_DIRS}")
if(BUILD_WIN)
include_directories("${JNI_INCLUDE_DIR}\\win32")
endif()
if(BUILD_MACOS)
include_directories("${JNI_INCLUDE_DIR}/darwin")
endif()
if(BUILD_LINUX)
include_directories("${JNI_INCLUDE_DIR}/linux")
endif()

#
# Do NOT make REQUIRED
# Until there is an official way of telling CMake to skip AWT, etc.,
# then JNI will be considered as "not found"
#
find_package(JNI)

list(FILTER JNI_INCLUDE_DIRS EXCLUDE REGEX NotNeeded)
list(FILTER JNI_LIBRARIES EXCLUDE REGEX NotNeeded)

#
# Do NOT check JNI_FOUND here, check JNI_INCLUDE_DIRS instead
# because of setting the above variables to NotNeeded,
# the variable JNI_FOUND is now set to NotNeeded, which is annoying
#
# We only care about JNI_INCLUDE_DIRS
#
if(JNI_INCLUDE_DIRS)
message(STATUS "JNI_INCLUDE_DIRS: ${JNI_INCLUDE_DIRS}")
include_directories("${JNI_INCLUDE_DIRS}")
else()
message(STATUS "JNI not found")
endif()
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Peer-to-peer and cross-platform encrypted connections built right into your app

<a href="./examples">Examples</a> |
<a href="https://docs.zerotier.com/sockets/tutorial.html">Documentation</a> |
<a href="https://discuss.zerotier.com/">Community</a> |
<a href="https://github.com/zerotier/libzt/issues">Report a Bug</a>


Expand All @@ -19,7 +18,7 @@ Peer-to-peer and cross-platform encrypted connections built right into your app


<img alt="latest libzt version" src="https://img.shields.io/github/v/tag/zerotier/libzt?label=latest"/></a>
<a href="https://github.com/zerotier/libzt/commits/master"><img alt="Last Commit" src="https://img.shields.io/github/last-commit/zerotier/libzt"/></a>
<a href="https://github.com/zerotier/libzt/commits/main"><img alt="Last Commit" src="https://img.shields.io/github/last-commit/zerotier/libzt"/></a>
<a href="https://github.com/zerotier/libzt/actions"><img alt="Build Status (master branch)" src="https://img.shields.io/github/workflow/status/zerotier/libzt/CMake/master"/></a>
</div>

Expand All @@ -29,7 +28,7 @@ Peer-to-peer and cross-platform encrypted connections built right into your app
| C# | `Install-Package ZeroTier.Sockets` |<a href="https://www.nuget.org/packages/ZeroTier.Sockets/"><img src="https://img.shields.io/github/v/tag/zerotier/libzt?label=NuGet"/></a> |[C#](./examples/csharp) |
| Python | `pip install libzt`|<a href="https://pypi.org/project/libzt/"><img src="https://img.shields.io/pypi/v/libzt?label=PyPI"/></a> |[Python](./examples/python) |
| Rust | See: [crates.io/crates/libzt](https://crates.io/crates/libzt) | <img alt="version" src="https://img.shields.io/crates/v/libzt?color=blue"/>|[Rust](./examples/rust) |
| Java | `./build.sh host-jar` |<img src="https://img.shields.io/github/v/tag/zerotier/libzt?label="/> |[Java](./examples/java) |
| Java | Install JDK, then: `./build.sh host-jar` |<img src="https://img.shields.io/github/v/tag/zerotier/libzt?label="/> |[Java](./examples/java) |
| Linux | `brew install zerotier/tap/libzt` | <img alt="version" src="https://img.shields.io/github/v/tag/zerotier/libzt?label="/></a>| [C/C++](./examples/c) |
| macOS | `brew install zerotier/tap/libzt`| <img alt="version" src="https://img.shields.io/github/v/tag/zerotier/libzt?label=Homebrew"/></a>| [C/C++](./examples/c) |
| iOS / iPadOS | `./build.sh iphoneos-framework` | <img src="https://img.shields.io/github/v/tag/zerotier/libzt?label="/>| [Objective-C](./attic/objective-c), [Swift](./attic/swift) |
Expand Down Expand Up @@ -93,7 +92,7 @@ Important directories:

We provide ways for your app or enterprise to function independently from any of our services if desired.

While we do operate a global network of redundant root servers, network controllers and an admin API/UI called [Central](https://my.zerotier.com), some use-cases require full control over the infrastructure and we try to make it as easy as possible to set up your own controllers and root servers: See [here](https://github.com/zerotier/ZeroTierOne/tree/master/controller) to learn more about how to set up your own network controller, and [here](https://www.zerotier.com/manual/#4_4) to learn more about setting up your own roots.
While we do operate a global network of redundant root servers, network controllers and an admin API/UI called [Central](https://my.zerotier.com), some use-cases require full control over the infrastructure and we try to make it as easy as possible to set up your own controllers and root servers: See [here](https://github.com/zerotier/ZeroTierOne/tree/main/controller) to learn more about how to set up your own network controller, and [here](https://docs.zerotier.com/zerotier/moons) to learn more about setting up your own roots.

# Help

Expand Down
51 changes: 23 additions & 28 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ host()
mkdir -p $BIN_OUTPUT_DIR
$CMAKE $VARIANT -H. -B$CACHE_DIR -DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE --build $CACHE_DIR $BUILD_CONCURRENCY
rm -f $BUILD_OUTPUT_DIR/native
ln -s $TARGET_BUILD_DIR $BUILD_OUTPUT_DIR/native
cp -f $CACHE_DIR/lib/libzt.* $LIB_OUTPUT_DIR
cp -f $CACHE_DIR/bin/* $BIN_OUTPUT_DIR
echo -e "\n - Build cache : $CACHE_DIR\n - Build output : $BUILD_OUTPUT_DIR\n"
Expand Down Expand Up @@ -494,12 +496,12 @@ host-jar()
{
check_submodules
ARTIFACT="jar"
PKG_VERSION=$(cat .version)
PKG_VERSION=$(git describe --tags --abbrev=0)
# Default to release
BUILD_TYPE=${1:-release}
if [[ $1 = *"docs"* ]]; then
# Generate documentation
javadoc src/bindings/java/*.java -d docs/java
javadoc src/bindings/java/com/zerotier/sockets/*.java -d docs/java
exit 0
fi
VARIANT="-DZTS_ENABLE_JAVA=True"
Expand All @@ -512,15 +514,15 @@ host-jar()
JAVA_JAR_DIR=$CACHE_DIR/pkg/jar
JAVA_JAR_SOURCE_TREE_DIR=$JAVA_JAR_DIR/com/zerotier/sockets/
mkdir -p $JAVA_JAR_SOURCE_TREE_DIR
cp -f src/bindings/java/*.java $JAVA_JAR_SOURCE_TREE_DIR
cp -f src/bindings/java/com/zerotier/sockets/*.java $JAVA_JAR_SOURCE_TREE_DIR
# Build
$CMAKE $VARIANT -H. -B$CACHE_DIR -DCMAKE_BUILD_TYPE=$BUILD_TYPE
$CMAKE --build $CACHE_DIR $BUILD_CONCURRENCY
# Package everything
cp -f $CACHE_DIR/lib/libzt.* $JAVA_JAR_DIR
cd $JAVA_JAR_DIR
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
javac -Xlint:deprecation com/zerotier/sockets/*.java
javac -Xlint:all com/zerotier/sockets/*.java

jar cf libzt-$PKG_VERSION.jar $SHARED_LIB_NAME com/zerotier/sockets/*.class
rm -rf com $SHARED_LIB_NAME
Expand Down Expand Up @@ -596,18 +598,12 @@ android-aar()
PKG_OUTPUT_DIR=$BUILD_OUTPUT_DIR/$TARGET_PLATFORM-$TARGET_MACHINE_TYPE-$ARTIFACT-$BUILD_TYPE
mkdir -p $CACHE_DIR
mkdir -p $PKG_OUTPUT_DIR
# Unsure why, but Gradle's build script chokes on this non-source file now
rm -rf ext/ZeroTierOne/ext/miniupnpc/VERSION
export PATH=$ANDROID_HOME/cmdline-tools/tools/bin:$PATH
# Copy source files into project
mkdir -p ${ANDROID_PKG_PROJ_DIR}/app/src/main/java/com/zerotier/sockets
cp -f src/bindings/java/*.java ${ANDROID_PKG_PROJ_DIR}/app/src/main/java/com/zerotier/sockets
# Build
UPPERCASE_BUILD_TYPE="$(tr '[:lower:]' '[:upper:]' <<< ${BUILD_TYPE:0:1})${BUILD_TYPE:1}"
CMAKE_FLAGS="-D${CMAKE_SWITCH}=1 -D${CMAKE_SWITCH}=ON"
cd $ANDROID_PKG_PROJ_DIR
./gradlew $GRADLE_ARGS assemble$UPPERCASE_BUILD_TYPE # assembleRelease / assembleDebug
mv $ANDROID_PKG_PROJ_DIR/app/build/outputs/aar/*.aar \
cp $ANDROID_PKG_PROJ_DIR/app/build/outputs/aar/libzt-$BUILD_TYPE.aar \
$PKG_OUTPUT_DIR/libzt-$BUILD_TYPE.aar
cd -
echo -e "\n - Build cache : $CACHE_DIR\n - Build output : $BUILD_OUTPUT_DIR\n"
Expand Down Expand Up @@ -652,21 +648,21 @@ format-code()
if [[ ! $(which $CLANG_FORMAT) = "" ]];
then
# Eventually: find . -path ./ext -prune -false -o -type f \( -iname \*.c -o -iname \*.h -o -iname \*.cpp -o -iname \*.hpp \) -exec clang-format -i {} \;
$CLANG_FORMAT -i --verbose include/*.h \
src/*.c \
src/*.cpp \
src/*.hpp \
examples/c/*.c \
examples/csharp/*.cs \
examples/java/*.java \
test/*.c \
test/*.cs \
src/bindings/csharp/*.cs \
src/bindings/csharp/*.cxx \
src/bindings/java/*.java \
src/bindings/java/*.cxx \
examples/csharp/*.cs \
src/bindings/python/PythonSockets.cxx \
$CLANG_FORMAT -i --verbose include/*.h \
src/*.c \
src/*.cpp \
src/*.hpp \
examples/c/*.c \
examples/csharp/*.cs \
examples/java/*.java \
test/*.c \
test/*.cs \
src/bindings/csharp/*.cs \
src/bindings/csharp/*.cxx \
src/bindings/java/com/zerotier/sockets/*.java \
src/bindings/java/*.cxx \
examples/csharp/*.cs \
src/bindings/python/PythonSockets.cxx \
src/bindings/python/PythonSocket.h
return 0
else
Expand Down Expand Up @@ -745,13 +741,12 @@ clean()

find . -type d -name "__pycache__" -exec rm -rf {} +
# Python pkg
cd pkg/pypi && ./build.sh clean
# cd pkg/pypi && ./build.sh clean
}

tag_release()
{
git tag -a $1 -m $2
"$(git describe --tags --abbrev=0)" >> .version
git push origin --tags
}

Expand Down
2 changes: 1 addition & 1 deletion examples/c/callbackapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char** argv)
{
if (argc != 2) {
printf("\nUsage:\n");
printf("pingable-node <net_id>\n");
printf("callbackapi <net_id>\n");
exit(0);
}
long long int net_id = strtoull(argv[1], NULL, 16); // At least 64 bits
Expand Down
2 changes: 1 addition & 1 deletion examples/c/nonblockingclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main(int argc, char** argv)
{
if (argc != 5) {
printf("\nlibzt example client\n");
printf("client <id_storage_path> <net_id> <remote_addr> <remote_port>\n");
printf("nonblockingclient <id_storage_path> <net_id> <remote_addr> <remote_port>\n");
exit(0);
}
char* storage_path = argv[1];
Expand Down
4 changes: 2 additions & 2 deletions examples/c/nonblockingserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main(int argc, char** argv)
{
if (argc != 5) {
printf("\nlibzt example server\n");
printf("server <id_storage_path> <net_id> <local_addr> <local_port>\n");
printf("nonblockingserver <id_storage_path> <net_id> <local_addr> <local_port>\n");
exit(0);
}
char* storage_path = argv[1];
Expand Down Expand Up @@ -95,7 +95,7 @@ int main(int argc, char** argv)
// zts_bsd_accept(int fd, struct zts_sockaddr* addr, zts_socklen_t* addrlen)

char remote_ipstr[ZTS_INET6_ADDRSTRLEN] = { 0 };
unsigned int port = 0;
unsigned short port = 0;
printf("Accepting on listening socket...\n");
if ((accfd = zts_accept(fd, remote_ipstr, ZTS_INET6_ADDRSTRLEN, &port)) < 0) {
printf("Error (fd=%d, ret=%d, zts_errno=%d). Exiting.\n", fd, err, zts_errno);
Expand Down
2 changes: 1 addition & 1 deletion examples/c/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char** argv)
// Can also use traditional: zts_bsd_socket(), zts_bsd_bind(), zts_bsd_listen(), zts_bsd_accept(), etc.

char remote_addr[ZTS_INET6_ADDRSTRLEN] = { 0 };
int remote_port = 0;
unsigned short remote_port = 0;
int len = ZTS_INET6_ADDRSTRLEN;
if ((accfd = zts_tcp_server(local_addr, local_port, remote_addr, len, &remote_port)) < 0) {
printf("Error (fd=%d, zts_errno=%d). Exiting.\n", accfd, zts_errno);
Expand Down
2 changes: 1 addition & 1 deletion examples/c/statistics.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main(int argc, char** argv)
{
if (argc != 2) {
printf("\nUsage:\n");
printf("pingable-node <net_id>\n");
printf("statistics <net_id>\n");
exit(0);
}
long long int net_id = strtoull(argv[1], NULL, 16); // At least 64 bits
Expand Down
4 changes: 2 additions & 2 deletions examples/java/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.net.DatagramPacket;
import java.net.InetAddress;

public class selftest {
public class Example {
public static void main(String[] args)
{
if (args.length < 4 || args.length > 5) {
Expand Down Expand Up @@ -110,7 +110,7 @@ public static void main(String[] args)
/**
* (OPTIONAL) event handler
*/
class MyZeroTierEventListener implements ZeroTierEventListener {
class MyZeroTierEventListener implements com.zerotier.sockets.ZeroTierEventListener {
public void onZeroTierEvent(long id, int eventCode)
{
if (eventCode == ZeroTierNative.ZTS_EVENT_NODE_UP) {
Expand Down
Loading