No description
This repository has been archived on 2026-06-16. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • C++ 58%
  • C 21.6%
  • C# 5.8%
  • Java 5%
  • Rust 3.3%
  • Other 6.3%
Find a file
2024-01-18 01:01:09 -05:00
.github/workflows Add update step to selftest workflow 2022-05-12 20:47:59 -07:00
attic Remove old Node.js wrapper 2021-08-04 10:06:15 -07:00
examples example update: wannat 2024-01-12 02:57:46 -05:00
ext Update ZeroTierOne submodule to 1.12 + ipv6 tx fix 2023-08-21 15:14:37 -07:00
include Remove vestigial version file 2023-08-23 10:14:28 -07:00
pkg fix 'No such file or directory' error 2023-07-19 15:48:53 -04:00
src LWIP_RAW IP_FORWARD and debug flag 2024-01-12 02:57:21 -05:00
test Fix https://github.com/zerotier/libzt/issues/242 2023-08-04 10:50:30 -04:00
.clang-format Update .clang-format to reflect new ZeroTier standard 2021-04-26 21:56:33 -07:00
.gitattributes Tweaked .gitattributes 2019-05-07 12:22:58 -07:00
.gitignore Resolved conflict for PR #161 2022-01-11 17:39:24 -08:00
.gitmodules replace default submodule 2024-01-18 01:01:09 -05:00
build.ps1 Fix compile-time errors for C# binding on Windows 2021-05-11 14:34:22 -07:00
build.sh Fix warning: [cast] redundant cast to int 2023-08-18 08:46:21 -04:00
CMakeLists.txt lots of commit 2024-01-12 02:55:15 -05:00
LICENSE.txt Add Python copyright and license text for wrapper 2021-05-28 16:06:43 -07:00
README Minor Windows build fixes 2021-05-05 19:55:47 -07:00
README.md Update README.md 2023-08-23 10:08:29 -07:00

ZeroTier Sockets

Part of the ZeroTier SDK

P2P cross-platform encrypted sockets library using ZeroTier


Examples | Docs | Report an issue

@zerotier r/zerotier

latest libzt version Last Commit Build Status (master branch)

Language/Platform Install Version Example
C/C++ Build from source version C/C++
C# Install-Package ZeroTier.Sockets C#
Python pip install libzt Python
Rust See: crates.io/crates/libzt version Rust
Java Install JDK, then: ./build.sh host-jar Java
Linux brew install zerotier/tap/libzt version C/C++
macOS brew install zerotier/tap/libzt version C/C++
iOS / iPadOS ./build.sh iphoneos-framework Objective-C, Swift
Android ./build.sh android-aar Java

#include "ZeroTierSockets.h"

int main()
{
    zts_node_start();
    zts_net_join(net_id);
    int fd = zts_bsd_socket(ZTS_AF_INET, ZTS_SOCK_STREAM, 0);
    zts_bsd_connect(fd, ...);
    ...
}

Build from source (optional)

git submodule update --init

This project uses CMake as a build system generator. The scripts build.* simplify building and packaging for various targets. There are many targets and configurations not mentioned here.

Platform Build instructions Notes
Linux ./build.sh host "release" build.sh
macOS ./build.sh host "release" build.sh
Windows . .\build.ps1; Build-Host -BuildType "Release" -Arch "x64" build.ps1, Requires PowerShell

Using the host keyword will automatically detect the current machine type and build standard libzt for use in C/C++ (no additional language bindings.) See ./build.sh list for additional target options. libzt depends on cURL for the optional portion of the API that interfaces with our hosted web offering (my.zerotier.com). If you do not need this functionality you can omit it by passing -DZTS_DISABLE_CENTRAL_API=1 to CMake.

Example output:

~/libzt/dist/macos-x64-host-release
├── bin
│   ├── client
│   ├── server
│   └── ...
└── lib
    ├── libzt.a
    └── libzt.dylib

Important directories:

Directory Purpose
dist Contains finished targets (libraries, binaries, packages, etc.)
cache Contains build system caches that can safely be deleted after use.
pkg Contains project, script and spec files to generate packages.

Self-hosting

If you'd like to use your own infrastructure we make it easy to set up your own controllers and roots.

Help

Licensing

ZeroTier and the ZeroTier SDK (libzt and libztcore) are licensed under the BSL version 1.1. ZeroTier is free to use internally in businesses and academic institutions and for non-commercial purposes. Certain types of commercial use such as building closed-source apps and devices based on ZeroTier or offering ZeroTier network controllers and network management as a SaaS service require a commercial license. A small amount of third party code is also included in ZeroTier and is not subject to our BSL license. See AUTHORS.md for a list of third party code, where it is included, and the licenses that apply to it. All of the third party code in ZeroTier is liberally licensed (MIT, BSD, Apache, public domain, etc.). If you want a commercial license to use the ZeroTier SDK in your product contact us directly via contact@zerotier.com