Add low-bandwidth mode

This commit is contained in:
Joseph Henry
2023-07-18 13:04:40 -07:00
parent e60239329c
commit 27805f8ff2
3 changed files with 19 additions and 0 deletions

View File

@@ -133,6 +133,12 @@ int zts_init_set_roots(const void* roots_data, unsigned int len)
return zts_service->setRoots(roots_data, len);
}
int zts_init_set_low_bandwidth_mode(bool enabled)
{
ACQUIRE_SERVICE_OFFLINE();
return zts_service->setLowBandwidthMode(enabled);
}
int zts_init_set_port(unsigned short port)
{
ACQUIRE_SERVICE_OFFLINE();

View File

@@ -1829,6 +1829,16 @@ int NodeService::setRoots(const void* rootsData, unsigned int len)
return ZTS_ERR_OK;
}
int_fast32_t NodeService::setLowBandwidthMode(bool enabled)
{
Mutex::Lock _lr(_run_m);
if (_run) {
return ZTS_ERR_SERVICE;
}
_node->setLowBandwidthMode(enabled);
return ZTS_ERR_OK;
}
int NodeService::addInterfacePrefixToBlacklist(const char* prefix, unsigned int len)
{
if (! prefix || len == 0 || len > 15) {

View File

@@ -398,6 +398,9 @@ class NodeService {
/** Set the roots definition */
int setRoots(const void* data, unsigned int len);
/** Enable or disable low-bandwidth mode (sends less ambient traffic, network updates happen less frequently) */
int setLowBandwidthMode(bool enabled);
/** Add Interface prefix to blacklist (prevents ZeroTier from using that interface) */
int addInterfacePrefixToBlacklist(const char* prefix, unsigned int len);