old101 / ztcpp

User-friendly C++ wrapper over libzt's C interface

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZTCpp

User-friendly C++ wrapper over libzt's C interface.

Also available as Conan package.

Latest version: 3.0.2

Note: ZTCpp does not currently expose all features that libzt offers. Feel free to make a feature request or a PR if you need something that's missing.

Why ZTCpp?

While libzt is a great and capable tool, its C-based API is very low-level and thus not always the most comfortable to use. In some places it can be confusing if you're not very familiar with the Berkeley socket model.

License

MIT (see LICENSE). The license applies ONLY to files in this repository, and NOT to the library being wrapped (libzt).

Instructions

Getting the package

The package artifacts are not stored in any global repository, so you will have to build the package locally yourself.

To do that, download the repository, and in it run the following command from your terminal:

conan create . --profile=<profile> --build=outdated -s compiler.cppstd=<std>

For profile, use default or one of your own.

ZTCpp is supported for C++ standards C++17 and newer, so put at least 17 as <std> above. This setting can be skipped if it is included in the profile you're using.

IMPORTANT: ZTCpp has a dependency on libzt, so make sure to get that first!

Consuming the package

Consumed through a conanfile (.txt or .py) like any other Conan package. Supports both build-types (Debug and Release) as you'd expect.

The only supported options are fPIC (except on Windows) and shared. Both are boolean (True/False). Note: due to a defect in the CMake files, builds with ztcpp:shared=False will not work for now.

Building without Conan

While building without Conan is not currently officially supported, it is possible, but requires some modifications to the CMake files: remove all Conan-related stuff, and add appropriate commands so it can find libzt headers and libraries.

Usage

Just #include <ZTCpp.hpp> and you're good to go. I also recommend making a namespace alias, for example namespace zt = jbatnozic::ztcpp;.

While all APIs have doc comments, you can also take a look at:

Also see

libzt-conan, a Conan package for the ZeroTier SDK.

About

User-friendly C++ wrapper over libzt's C interface

License:MIT License


Languages

Language:C++ 95.8%Language:Python 2.9%Language:CMake 0.9%Language:Batchfile 0.3%