This documentation is for version v1.3.0 of NNG, but the latest released version is v1.8.0. see the documentation for v1.8.0 for the most up-to-date information.


#include <nng/nng.h>

enum sockaddr_family {
NNG_AF_ZT = 5,

typedef struct {
uint16_t sa_family;
uint64_t sa_nwid;
uint64_t sa_nodeid;
uint32_t sa_port;
} nng_sockaddr_zt;


An nng_sockaddr_zt is the flavor of nng_sockaddr used to represent ZeroTier addresses, including the port number used by the zt transport.

The ZeroTier transport, and the details of this structure, are still considered experimental, and subject to change.

The following structure members are present:


This field will always have the value NNG_AF_ZT.


This field holds the ZeroTier network number (or ID). This value is in native byte order.


This field holds the ZeroTier node ID. This value is in native byte order, and only the lower 40 bits are significant. (ZeroTier node numbers are 40 bits long.) A zero value here is used for a wild-card to indicate that the caller’s own node number be used.


This field holds the “port number” used by the zt transport to distinguish different sockets. This value in native byte order. A zero value here indicates that a port number should be chosen randomly from the ephemeral ports. Only the lower 24 bits of the port number are used.

ZeroTier port numbers are in native byte order, and are larger than TCP/IP port numbers. They are also not part of the ZeroTier protocol itself, but defined by the Scalability Protocols binding for them.