reorganize rustybits into a single library with smeeclient behind the ztcontroller feature flag

This commit is contained in:
Grant Limberg 2025-08-05 15:52:58 -07:00
commit e822811f29
22 changed files with 3491 additions and 492 deletions

View file

@ -27,7 +27,7 @@
#include <climits> #include <climits>
#include <iomanip> #include <iomanip>
#include <libpq-fe.h> #include <libpq-fe.h>
#include <smeeclient.h> #include <rustybits.h>
#include <sstream> #include <sstream>
// #define REDIS_TRACE 1 // #define REDIS_TRACE 1
@ -153,7 +153,7 @@ CV1::CV1(const Identity& myId, const char* path, int listenPort, RedisConfig* rc
CV1::~CV1() CV1::~CV1()
{ {
if (_smee != NULL) { if (_smee != NULL) {
smeeclient::smee_client_delete(_smee); rustybits::smee_client_delete(_smee);
_smee = NULL; _smee = NULL;
} }
@ -195,7 +195,7 @@ void CV1::configureSmee()
if (scheme != NULL && host != NULL && port != NULL && ns != NULL && task_queue != NULL) { if (scheme != NULL && host != NULL && port != NULL && ns != NULL && task_queue != NULL) {
fprintf(stderr, "creating smee client\n"); fprintf(stderr, "creating smee client\n");
std::string hostPort = std::string(scheme) + std::string("://") + std::string(host) + std::string(":") + std::string(port); std::string hostPort = std::string(scheme) + std::string("://") + std::string(host) + std::string(":") + std::string(port);
this->_smee = smeeclient::smee_client_new(hostPort.c_str(), ns, task_queue); this->_smee = rustybits::smee_client_new(hostPort.c_str(), ns, task_queue);
} }
else { else {
fprintf(stderr, "Smee client not configured\n"); fprintf(stderr, "Smee client not configured\n");
@ -1850,7 +1850,7 @@ void CV1::notifyNewMember(const std::string& networkID, const std::string& membe
auto span = tracer->StartSpan("cv1::notifyNewMember"); auto span = tracer->StartSpan("cv1::notifyNewMember");
auto scope = tracer->WithActiveSpan(span); auto scope = tracer->WithActiveSpan(span);
smeeclient::smee_client_notify_network_joined(_smee, networkID.c_str(), memberID.c_str()); rustybits::smee_client_notify_network_joined(_smee, networkID.c_str(), memberID.c_str());
} }
void CV1::onlineNotificationThread() void CV1::onlineNotificationThread()

View file

@ -28,7 +28,7 @@
#include <pqxx/pqxx> #include <pqxx/pqxx>
#include <redis++/redis++.h> #include <redis++/redis++.h>
namespace smeeclient { namespace rustybits {
struct SmeeClient; struct SmeeClient;
} }
@ -134,7 +134,7 @@ class CV1 : public DB {
std::shared_ptr<sw::redis::RedisCluster> _cluster; std::shared_ptr<sw::redis::RedisCluster> _cluster;
bool _redisMemberStatus; bool _redisMemberStatus;
smeeclient::SmeeClient* _smee; rustybits::SmeeClient* _smee;
}; };
} // namespace ZeroTier } // namespace ZeroTier

View file

@ -14,6 +14,7 @@ DEFS?=
LDLIBS?= LDLIBS?=
DESTDIR?= DESTDIR?=
EXTRA_DEPS?= EXTRA_DEPS?=
ZT_CARGO_FLAGS?=
include objects.mk include objects.mk
ifeq ($(ZT_EXTOSDEP),1) ifeq ($(ZT_EXTOSDEP),1)
@ -67,7 +68,6 @@ ifeq ($(ZT_DEBUG),1)
override CFLAGS+=-Wall -Wno-deprecated -g -O -pthread $(INCLUDES) $(DEFS) override CFLAGS+=-Wall -Wno-deprecated -g -O -pthread $(INCLUDES) $(DEFS)
override CXXFLAGS+=-Wall -Wno-deprecated -g -O -std=c++17 -pthread $(INCLUDES) $(DEFS) override CXXFLAGS+=-Wall -Wno-deprecated -g -O -std=c++17 -pthread $(INCLUDES) $(DEFS)
ZT_TRACE=1 ZT_TRACE=1
ZT_CARGO_FLAGS=
# The following line enables optimization for the crypto code, since # The following line enables optimization for the crypto code, since
# C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box! # C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box!
node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CXXFLAGS=-Wall -O2 -g -pthread $(INCLUDES) $(DEFS) node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CXXFLAGS=-Wall -O2 -g -pthread $(INCLUDES) $(DEFS)
@ -77,7 +77,7 @@ else
CXXFLAGS?=-O3 -fstack-protector CXXFLAGS?=-O3 -fstack-protector
override CXXFLAGS+=-Wall -Wno-deprecated -std=c++17 -pthread $(INCLUDES) -DNDEBUG $(DEFS) override CXXFLAGS+=-Wall -Wno-deprecated -std=c++17 -pthread $(INCLUDES) -DNDEBUG $(DEFS)
LDFLAGS?=-pie -Wl,-z,relro,-z,now LDFLAGS?=-pie -Wl,-z,relro,-z,now
ZT_CARGO_FLAGS=--release ZT_CARGO_FLAGS+=--release
endif endif
ifeq ($(ZT_QNAP), 1) ifeq ($(ZT_QNAP), 1)
@ -305,9 +305,9 @@ ifeq ($(ZT_SSO_SUPPORTED), 1)
ifeq ($(ZT_EMBEDDED),) ifeq ($(ZT_EMBEDDED),)
override DEFS+=-DZT_SSO_SUPPORTED=1 override DEFS+=-DZT_SSO_SUPPORTED=1
ifeq ($(ZT_DEBUG),1) ifeq ($(ZT_DEBUG),1)
LDLIBS+=rustybits/target/debug/libzeroidc.a -ldl -lssl -lcrypto LDLIBS+=rustybits/target/debug/librustybits.a -ldl -lssl -lcrypto
else else
LDLIBS+=rustybits/target/release/libzeroidc.a -ldl -lssl -lcrypto LDLIBS+=rustybits/target/release/librustybits.a -ldl -lssl -lcrypto
endif endif
endif endif
endif endif
@ -345,10 +345,11 @@ ifeq ($(ZT_CONTROLLER),1)
override LDLIBS+=-Lext/libpqxx-7.7.3/install/ubuntu22.04/$(EXT_ARCH)/lib -lpqxx -lpq ext/hiredis-1.0.2/lib/ubuntu22.04/$(EXT_ARCH)/libhiredis.a ext/redis-plus-plus-1.3.3/install/ubuntu22.04/$(EXT_ARCH)/lib/libredis++.a -lssl -lcrypto override LDLIBS+=-Lext/libpqxx-7.7.3/install/ubuntu22.04/$(EXT_ARCH)/lib -lpqxx -lpq ext/hiredis-1.0.2/lib/ubuntu22.04/$(EXT_ARCH)/libhiredis.a ext/redis-plus-plus-1.3.3/install/ubuntu22.04/$(EXT_ARCH)/lib/libredis++.a -lssl -lcrypto
override DEFS+=-DZT_CONTROLLER_USE_LIBPQ -DZT_NO_PEER_METRICS -DZT_OPENTELEMETRY_ENABLED override DEFS+=-DZT_CONTROLLER_USE_LIBPQ -DZT_NO_PEER_METRICS -DZT_OPENTELEMETRY_ENABLED
override INCLUDES+=-I/usr/include/postgresql -Iext/libpqxx-7.7.3/install/ubuntu22.04/$(EXT_ARCH)/include -Iext/hiredis-1.0.2/include/ -Iext/redis-plus-plus-1.3.3/install/ubuntu22.04/$(EXT_ARCH)/include/sw/ override INCLUDES+=-I/usr/include/postgresql -Iext/libpqxx-7.7.3/install/ubuntu22.04/$(EXT_ARCH)/include -Iext/hiredis-1.0.2/include/ -Iext/redis-plus-plus-1.3.3/install/ubuntu22.04/$(EXT_ARCH)/include/sw/
override ZT_CARGO_FLAGS+=-F ztcontroller
ifeq ($(ZT_DEBUG),1) ifeq ($(ZT_DEBUG),1)
override LDLIBS+=rustybits/target/debug/libsmeeclient.a override LDLIBS+=rustybits/target/debug/librustybits.a
else else
override LDLIBS+=rustybits/target/release/libsmeeclient.a override LDLIBS+=rustybits/target/release/librustybits.a
endif endif
endif endif
@ -409,7 +410,7 @@ zerotier-idtool: zerotier-one
zerotier-cli: zerotier-one zerotier-cli: zerotier-one
ln -sf zerotier-one zerotier-cli ln -sf zerotier-one zerotier-cli
$(ONE_OBJS): zeroidc smeeclient $(ONE_OBJS): zeroidc rustybits
libzerotiercore.a: FORCE libzerotiercore.a: FORCE
make CFLAGS="-O3 -fstack-protector -fPIC" CXXFLAGS="-O3 -std=c++17 -fstack-protector -fPIC" $(CORE_OBJS) make CFLAGS="-O3 -fstack-protector -fPIC" CXXFLAGS="-O3 -std=c++17 -fstack-protector -fPIC" $(CORE_OBJS)
@ -477,19 +478,12 @@ debug: FORCE
ifeq ($(ZT_SSO_SUPPORTED), 1) ifeq ($(ZT_SSO_SUPPORTED), 1)
ifeq ($(ZT_EMBEDDED),) ifeq ($(ZT_EMBEDDED),)
zeroidc: FORCE zeroidc: FORCE
export PATH=/${HOME}/.cargo/bin:$$PATH; cd rustybits && cargo build $(ZT_CARGO_FLAGS) -p zeroidc export PATH=/${HOME}/.cargo/bin:$$PATH; cd rustybits && cargo build $(ZT_CARGO_FLAGS)
endif endif
else else
zeroidc: zeroidc:
endif endif
ifeq ($(ZT_CONTROLLER), 1)
smeeclient: FORCE
export PATH=/${HOME}/.cargo/bin:$$PATH; cd rustybits && cargo build $(ZT_CARGO_FLAGS) -p smeeclient
else
smeeclient:
endif
# Note: keep the symlinks in /var/lib/zerotier-one to the binaries since these # Note: keep the symlinks in /var/lib/zerotier-one to the binaries since these
# provide backward compatibility with old releases where the binaries actually # provide backward compatibility with old releases where the binaries actually
# lived here. Folks got scripts. # lived here. Folks got scripts.

View file

@ -31,6 +31,8 @@ include objects.mk
ONE_OBJS+=osdep/MacEthernetTap.o osdep/MacKextEthernetTap.o osdep/MacDNSHelper.o ext/http-parser/http_parser.o ONE_OBJS+=osdep/MacEthernetTap.o osdep/MacKextEthernetTap.o osdep/MacDNSHelper.o ext/http-parser/http_parser.o
LIBS+=-framework CoreServices -framework SystemConfiguration -framework CoreFoundation -framework Security LIBS+=-framework CoreServices -framework SystemConfiguration -framework CoreFoundation -framework Security
EXTRA_CARGO_FLAGS?=
# Official releases are signed with our Apple cert and apply software updates by default # Official releases are signed with our Apple cert and apply software updates by default
ifeq ($(ZT_OFFICIAL_RELEASE),1) ifeq ($(ZT_OFFICIAL_RELEASE),1)
DEFS+=-DZT_SOFTWARE_UPDATE_DEFAULT="\"apply\"" DEFS+=-DZT_SOFTWARE_UPDATE_DEFAULT="\"apply\""
@ -57,9 +59,10 @@ ONE_OBJS+=ext/libnatpmp/natpmp.o ext/libnatpmp/getgateway.o ext/miniupnpc/connec
ifeq ($(ZT_CONTROLLER),1) ifeq ($(ZT_CONTROLLER),1)
MACOS_VERSION_MIN=10.15 MACOS_VERSION_MIN=10.15
override CXXFLAGS=$(CFLAGS) -std=c++17 -stdlib=libc++ override CXXFLAGS=$(CFLAGS) -std=c++17 -stdlib=libc++
LIBS+=-L/opt/homebrew/lib -L/usr/local/opt/libpqxx/lib -L/usr/local/opt/libpq/lib -L/usr/local/opt/openssl/lib/ -lpqxx -lpq -lssl -lcrypto -lgssapi_krb5 ext/redis-plus-plus-1.1.1/install/macos/lib/libredis++.a ext/hiredis-0.14.1/lib/macos/libhiredis.a rustybits/target/libsmeeclient.a LIBS+=-L/opt/homebrew/lib -L/usr/local/opt/libpqxx/lib -L/usr/local/opt/libpq/lib -L/usr/local/opt/openssl/lib/ -lpqxx -lpq -lssl -lcrypto -lgssapi_krb5 ext/redis-plus-plus-1.1.1/install/macos/lib/libredis++.a ext/hiredis-0.14.1/lib/macos/libhiredis.a rustybits/target/librustybits.a
DEFS+=-DZT_CONTROLLER_USE_LIBPQ -DZT_CONTROLLER_USE_REDIS -DZT_CONTROLLER DEFS+=-DZT_CONTROLLER_USE_LIBPQ -DZT_CONTROLLER_USE_REDIS -DZT_CONTROLLER
INCLUDES+=-I/opt/homebrew/include -I/opt/homebrew/opt/libpq/include -I/usr/local/opt/libpq/include -I/usr/local/opt/libpqxx/include -Iext/hiredis-0.14.1/include/ -Iext/redis-plus-plus-1.1.1/install/macos/include/sw/ -Irustybits/target/ INCLUDES+=-I/opt/homebrew/include -I/opt/homebrew/opt/libpq/include -I/usr/local/opt/libpq/include -I/usr/local/opt/libpqxx/include -Iext/hiredis-0.14.1/include/ -Iext/redis-plus-plus-1.1.1/install/macos/include/sw/ -Irustybits/target/
EXTRA_CARGO_FLAGS+=-F ztcontroller
else else
MACOS_VERSION_MIN=10.13 MACOS_VERSION_MIN=10.13
endif endif
@ -77,7 +80,6 @@ ifeq ($(ZT_DEBUG),1)
ARCH_FLAGS= ARCH_FLAGS=
CFLAGS+=-Wall -g $(INCLUDES) $(DEFS) $(ARCH_FLAGS) CFLAGS+=-Wall -g $(INCLUDES) $(DEFS) $(ARCH_FLAGS)
STRIP=echo STRIP=echo
EXTRA_CARGO_FLAGS=
RUST_VARIANT=debug RUST_VARIANT=debug
# The following line enables optimization for the crypto code, since # The following line enables optimization for the crypto code, since
# C25519 in particular is almost UNUSABLE in heavy testing without it. # C25519 in particular is almost UNUSABLE in heavy testing without it.
@ -86,7 +88,7 @@ else
CFLAGS?=-O3 -fstack-protector-strong CFLAGS?=-O3 -fstack-protector-strong
CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -mmacosx-version-min=$(MACOS_VERSION_MIN) -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS) CFLAGS+=$(ARCH_FLAGS) -Wall -flto -fPIE -mmacosx-version-min=$(MACOS_VERSION_MIN) -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
STRIP=strip STRIP=strip
EXTRA_CARGO_FLAGS=--release EXTRA_CARGO_FLAGS+=--release
RUST_VARIANT=release RUST_VARIANT=release
endif endif
@ -131,7 +133,7 @@ one: otel zeroidc smeeclient $(CORE_OBJS) $(ONE_OBJS) one.o mac-agent
else else
one: otel zeroidc $(CORE_OBJS) $(ONE_OBJS) one.o mac-agent one: otel zeroidc $(CORE_OBJS) $(ONE_OBJS) one.o mac-agent
endif endif
$(CXX) $(CXXFLAGS) -o zerotier-one $(CORE_OBJS) $(ONE_OBJS) one.o $(LIBS) rustybits/target/libzeroidc.a $(CXX) $(CXXFLAGS) -o zerotier-one $(CORE_OBJS) $(ONE_OBJS) one.o $(LIBS) rustybits/target/librustybits.a
# $(STRIP) zerotier-one # $(STRIP) zerotier-one
ln -sf zerotier-one zerotier-idtool ln -sf zerotier-one zerotier-idtool
ln -sf zerotier-one zerotier-cli ln -sf zerotier-one zerotier-cli
@ -139,21 +141,21 @@ endif
zerotier-one: one zerotier-one: one
zeroidc: rustybits/target/libzeroidc.a rustybits: rustybits/target/rustybits.a
ifeq ($(ZT_CONTROLLER),1) # ifeq ($(ZT_CONTROLLER),1)
smeeclient: rustybits/target/libsmeeclient.a # smeeclient: rustybits/target/libsmeeclient.a
rustybits/target/libsmeeclient.a: FORCE # rustybits/target/libsmeeclient.a: FORCE
cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -p smeeclient --target=x86_64-apple-darwin $(EXTRA_CARGO_FLAGS) # cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -F smeeclient --target=x86_64-apple-darwin $(EXTRA_CARGO_FLAGS)
cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -p smeeclient --target=aarch64-apple-darwin $(EXTRA_CARGO_FLAGS) # cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -F smeeclient --target=aarch64-apple-darwin $(EXTRA_CARGO_FLAGS)
cd rustybits && lipo -create target/x86_64-apple-darwin/$(RUST_VARIANT)/libsmeeclient.a target/aarch64-apple-darwin/$(RUST_VARIANT)/libsmeeclient.a -output target/libsmeeclient.a # cd rustybits && lipo -create target/x86_64-apple-darwin/$(RUST_VARIANT)/libsmeeclient.a target/aarch64-apple-darwin/$(RUST_VARIANT)/libsmeeclient.a -output target/libsmeeclient.a
endif # endif
rustybits/target/libzeroidc.a: FORCE rustybits/target/rustybits.a: FORCE
cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -p zeroidc --target=x86_64-apple-darwin $(EXTRA_CARGO_FLAGS) cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build --target=x86_64-apple-darwin $(EXTRA_CARGO_FLAGS)
cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build -p zeroidc --target=aarch64-apple-darwin $(EXTRA_CARGO_FLAGS) cd rustybits && MACOSX_DEPLOYMENT_TARGET=$(MACOS_VERSION_MIN) cargo build --target=aarch64-apple-darwin $(EXTRA_CARGO_FLAGS)
cd rustybits && lipo -create target/x86_64-apple-darwin/$(RUST_VARIANT)/libzeroidc.a target/aarch64-apple-darwin/$(RUST_VARIANT)/libzeroidc.a -output target/libzeroidc.a cd rustybits && lipo -create target/x86_64-apple-darwin/$(RUST_VARIANT)/librustybits.a target/aarch64-apple-darwin/$(RUST_VARIANT)/librustybits.a -output target/librustybits.a
central-controller: central-controller:
make ARCH_FLAGS="-arch x86_64" ZT_CONTROLLER=1 one make ARCH_FLAGS="-arch x86_64" ZT_CONTROLLER=1 one
@ -175,7 +177,7 @@ core: libzerotiercore.a
# $(STRIP) zerotier # $(STRIP) zerotier
selftest: $(CORE_OBJS) $(ONE_OBJS) selftest.o selftest: $(CORE_OBJS) $(ONE_OBJS) selftest.o
$(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(CORE_OBJS) $(ONE_OBJS) $(LIBS) rustybits/target/libzeroidc.a $(CXX) $(CXXFLAGS) -o zerotier-selftest selftest.o $(CORE_OBJS) $(ONE_OBJS) $(LIBS) rustybits/target/librustybits.a
$(STRIP) zerotier-selftest $(STRIP) zerotier-selftest
zerotier-selftest: selftest zerotier-selftest: selftest

368
rustybits/Cargo.lock generated
View file

@ -48,12 +48,18 @@ dependencies = [
] ]
[[package]] [[package]]
name = "ansi_term" name = "anstream"
version = "0.12.1" version = "0.6.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192"
dependencies = [ dependencies = [
"winapi", "anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is_terminal_polyfill",
"utf8parse",
] ]
[[package]] [[package]]
@ -62,6 +68,35 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
[[package]]
name = "anstyle-parse"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"
dependencies = [
"windows-sys 0.60.2",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"
dependencies = [
"anstyle",
"once_cell_polyfill",
"windows-sys 0.60.2",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.98" version = "1.0.98"
@ -76,7 +111,7 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -85,17 +120,6 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.5.0" version = "1.5.0"
@ -244,19 +268,19 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
[[package]] [[package]]
name = "cbindgen" name = "cbindgen"
version = "0.20.0" version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51e3973b165dc0f435831a9e426de67e894de532754ff7a3f307c03ee5dec7dc" checksum = "975982cdb7ad6a142be15bdf84aea7ec6a9e5d4d797c004d43185b24cfe4e684"
dependencies = [ dependencies = [
"clap", "clap",
"heck 0.3.3", "heck",
"indexmap 1.9.3", "indexmap 2.10.0",
"log", "log",
"proc-macro2", "proc-macro2",
"quote", "quote",
"serde", "serde",
"serde_json", "serde_json",
"syn 1.0.109", "syn",
"tempfile", "tempfile",
"toml", "toml",
] ]
@ -293,19 +317,37 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.34.0" version = "4.5.42"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" checksum = "ed87a9d530bb41a67537289bafcac159cb3ee28460e0a4571123d2a778a6a882"
dependencies = [ dependencies = [
"ansi_term", "clap_builder",
"atty",
"bitflags 1.3.2",
"strsim 0.8.0",
"textwrap",
"unicode-width",
"vec_map",
] ]
[[package]]
name = "clap_builder"
version = "4.5.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64f4f3f3c77c94aff3c7e9aac9a2ca1974a5adf392a8bb751e827d6d127ab966"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_lex"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675"
[[package]]
name = "colorchoice"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
[[package]] [[package]]
name = "const-oid" name = "const-oid"
version = "0.9.6" version = "0.9.6"
@ -417,7 +459,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -440,8 +482,8 @@ dependencies = [
"ident_case", "ident_case",
"proc-macro2", "proc-macro2",
"quote", "quote",
"strsim 0.11.1", "strsim",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -452,7 +494,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
dependencies = [ dependencies = [
"darling_core", "darling_core",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -508,7 +550,7 @@ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -518,7 +560,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
dependencies = [ dependencies = [
"derive_builder_core", "derive_builder_core",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -538,7 +580,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
"unicode-xid", "unicode-xid",
] ]
@ -562,7 +604,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -668,7 +710,7 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -680,7 +722,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -835,7 +877,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -1024,30 +1066,12 @@ dependencies = [
"foldhash", "foldhash",
] ]
[[package]]
name = "heck"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
dependencies = [
"unicode-segmentation",
]
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.5.0" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "hex" name = "hex"
version = "0.4.3" version = "0.4.3"
@ -1426,6 +1450,12 @@ version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.10.5" version = "0.10.5"
@ -1602,7 +1632,7 @@ dependencies = [
"cfg-if", "cfg-if",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -1747,6 +1777,12 @@ version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
[[package]]
name = "once_cell_polyfill"
version = "1.70.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"
[[package]] [[package]]
name = "openidconnect" name = "openidconnect"
version = "3.5.0" version = "3.5.0"
@ -1802,7 +1838,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -1950,7 +1986,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -2064,7 +2100,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -2101,7 +2137,7 @@ version = "0.13.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf"
dependencies = [ dependencies = [
"heck 0.5.0", "heck",
"itertools 0.14.0", "itertools 0.14.0",
"log", "log",
"multimap", "multimap",
@ -2111,7 +2147,7 @@ dependencies = [
"prost", "prost",
"prost-types", "prost-types",
"regex", "regex",
"syn 2.0.104", "syn",
"tempfile", "tempfile",
] ]
@ -2125,7 +2161,7 @@ dependencies = [
"itertools 0.14.0", "itertools 0.14.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -2158,7 +2194,7 @@ version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07b8bf115b70a7aa5af1fd5d6e9418492e9ccb6e4785e858c938e28d132a884b" checksum = "07b8bf115b70a7aa5af1fd5d6e9418492e9ccb6e4785e858c938e28d132a884b"
dependencies = [ dependencies = [
"heck 0.5.0", "heck",
"prost", "prost",
"prost-build", "prost-build",
"prost-types", "prost-types",
@ -2307,7 +2343,7 @@ checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -2482,7 +2518,7 @@ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustfsm_trait", "rustfsm_trait",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -2565,6 +2601,27 @@ version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d"
[[package]]
name = "rustybits"
version = "0.1.0"
dependencies = [
"base64 0.21.7",
"bytes",
"cbindgen",
"jwt",
"openidconnect",
"reqwest",
"serde",
"temporal-client",
"temporal-sdk",
"temporal-sdk-core-protos",
"thiserror 1.0.69",
"time",
"tokio",
"url",
"uuid",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.20" version = "1.0.20"
@ -2693,7 +2750,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -2727,6 +2784,15 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_spanned"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "serde_urlencoded" name = "serde_urlencoded"
version = "0.7.1" version = "0.7.1"
@ -2768,7 +2834,7 @@ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -2843,20 +2909,6 @@ version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
[[package]]
name = "smeeclient"
version = "0.1.0"
dependencies = [
"cbindgen",
"serde",
"temporal-client",
"temporal-sdk",
"temporal-sdk-core-protos",
"tokio",
"url",
"uuid",
]
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.5.10" version = "0.5.10"
@ -2898,12 +2950,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "strsim"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.11.1" version = "0.11.1"
@ -2916,17 +2962,6 @@ version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.104" version = "2.0.104"
@ -2958,7 +2993,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3157,15 +3192,6 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"
[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.69" version = "1.0.69"
@ -3192,7 +3218,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3203,7 +3229,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3284,7 +3310,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3333,13 +3359,45 @@ dependencies = [
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.5.11" version = "0.8.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
dependencies = [
"serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
]
[[package]]
name = "toml_datetime"
version = "0.6.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "toml_edit"
version = "0.22.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
dependencies = [
"indexmap 2.10.0",
"serde",
"serde_spanned",
"toml_datetime",
"toml_write",
"winnow",
]
[[package]]
name = "toml_write"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
[[package]] [[package]]
name = "tonic" name = "tonic"
version = "0.13.1" version = "0.13.1"
@ -3382,7 +3440,7 @@ dependencies = [
"prost-build", "prost-build",
"prost-types", "prost-types",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3435,7 +3493,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3504,7 +3562,7 @@ checksum = "35f5380909ffc31b4de4f4bdf96b877175a016aa2ca98cee39fcfd8c4d53d952"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3513,18 +3571,6 @@ version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
[[package]]
name = "unicode-segmentation"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"
[[package]]
name = "unicode-width"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
[[package]] [[package]]
name = "unicode-xid" name = "unicode-xid"
version = "0.2.6" version = "0.2.6"
@ -3555,6 +3601,12 @@ version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
[[package]]
name = "utf8parse"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.17.0" version = "1.17.0"
@ -3578,12 +3630,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vec_map"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]] [[package]]
name = "version_check" name = "version_check"
version = "0.9.5" version = "0.9.5"
@ -3636,7 +3682,7 @@ dependencies = [
"log", "log",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3671,7 +3717,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -3770,7 +3816,7 @@ checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3781,7 +3827,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3792,7 +3838,7 @@ checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -3803,7 +3849,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -4060,6 +4106,15 @@ version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
[[package]]
name = "winnow"
version = "0.7.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "winreg" name = "winreg"
version = "0.50.0" version = "0.50.0"
@ -4105,7 +4160,7 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
"synstructure", "synstructure",
] ]
@ -4126,7 +4181,7 @@ checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]
[[package]] [[package]]
@ -4146,27 +4201,10 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
"synstructure", "synstructure",
] ]
[[package]]
name = "zeroidc"
version = "0.1.0"
dependencies = [
"base64 0.21.7",
"bytes",
"cbindgen",
"jwt",
"openidconnect",
"reqwest",
"serde",
"thiserror 1.0.69",
"time",
"tokio",
"url",
]
[[package]] [[package]]
name = "zeroize" name = "zeroize"
version = "1.8.1" version = "1.8.1"
@ -4203,5 +4241,5 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.104", "syn",
] ]

View file

@ -1,6 +1,40 @@
[workspace] [package]
resolver = "2" name = "rustybits"
members = ["smeeclient", "zeroidc"] version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["staticlib", "rlib"]
[features]
default = ["zeroidc"]
zeroidc = []
ztcontroller = []
[dependencies]
serde = { version = "1", features = ["derive"] }
temporal-sdk = { git = "https://github.com/temporalio/sdk-core", branch = "master" }
temporal-client = { git = "https://github.com/temporalio/sdk-core", branch = "master", features = [
"telemetry",
] }
temporal-sdk-core-protos = { git = "https://github.com/temporalio/sdk-core", branch = "master" }
tokio = { version = "1.43", features = ["full"] }
uuid = { version = "1.4", features = ["v4"] }
openidconnect = { version = "3.4", default-features = false, features = [
"reqwest",
"native-tls",
"accept-rfc3339-timestamps",
] }
base64 = "0.21"
url = "2.3"
reqwest = "0.11"
jwt = { version = "0.16", git = "https://github.com/glimberg/rust-jwt" }
time = { version = "~0.3", features = ["formatting"] }
bytes = "1.3"
thiserror = "1"
[build-dependencies]
cbindgen = "0.29"
[profile.release] [profile.release]
strip = "debuginfo" strip = "debuginfo"

View file

@ -1,6 +1,6 @@
extern crate cbindgen; extern crate cbindgen;
use cbindgen::{Config, Language}; use cbindgen::{Config, Language, MacroExpansionConfig};
use std::env; use std::env;
use std::path::PathBuf; use std::path::PathBuf;
@ -10,10 +10,13 @@ fn main() {
let package_name = env::var("CARGO_PKG_NAME").unwrap(); let package_name = env::var("CARGO_PKG_NAME").unwrap();
let output_file = target_dir().join(format!("{package_name}.h")).display().to_string(); let output_file = target_dir().join(format!("{package_name}.h")).display().to_string();
let meconfig = MacroExpansionConfig { bitflags: true, ..Default::default() };
let config = Config { let config = Config {
language: Language::C, language: Language::C,
cpp_compat: true, cpp_compat: true,
namespace: Some(String::from("smeeclient")), namespace: Some(String::from("rustybits")),
macro_expansion: meconfig,
..Default::default() ..Default::default()
}; };
@ -29,8 +32,6 @@ fn target_dir() -> PathBuf {
if let Ok(target) = env::var("CARGO_TARGET_DIR") { if let Ok(target) = env::var("CARGO_TARGET_DIR") {
PathBuf::from(target) PathBuf::from(target)
} else { } else {
PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()) PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("target")
.join("..")
.join("target")
} }
} }

2998
rustybits/smeeclient/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,21 +0,0 @@
[package]
name = "smeeclient"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["staticlib", "rlib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde = { version = "1", features = ["derive"] }
temporal-sdk = { git = "https://github.com/temporalio/sdk-core", branch = "master" }
temporal-client = { git = "https://github.com/temporalio/sdk-core", branch = "master", features = ["telemetry"] }
temporal-sdk-core-protos = { git = "https://github.com/temporalio/sdk-core", branch = "master" }
tokio = { version = "1.43", features = ["full"] }
url = { version = "2" }
uuid = { version = "1.4", features = ["v4"] }
[build-dependencies]
cbindgen = "0.20"

View file

@ -1 +0,0 @@
../rustfmt.toml

View file

@ -1,94 +0,0 @@
/*
* Copyright (c)2021 ZeroTier, Inc.
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file in the project's root directory.
*
* Change Date: 2026-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2.0 of the Apache License.
*/
#![allow(clippy::uninlined_format_args, clippy::missing_safety_doc)]
use std::ffi::CStr;
use std::os::raw::c_char;
use crate::NetworkJoinedParams;
use crate::SmeeClient;
#[no_mangle]
pub unsafe extern "C" fn smee_client_new(
temporal_url: *const c_char,
namespace: *const c_char,
task_queue: *const c_char,
) -> *mut SmeeClient {
let url = unsafe {
assert!(!temporal_url.is_null());
CStr::from_ptr(temporal_url).to_str().unwrap()
};
let ns = unsafe {
assert!(!namespace.is_null());
CStr::from_ptr(namespace).to_str().unwrap()
};
let tq = unsafe {
assert!(!task_queue.is_null());
CStr::from_ptr(task_queue).to_str().unwrap()
};
match SmeeClient::new(url, ns, tq) {
Ok(c) => Box::into_raw(Box::new(c)),
Err(e) => {
println!("error creating smee client instance: {}", e);
std::ptr::null_mut()
}
}
}
#[no_mangle]
pub unsafe extern "C" fn smee_client_delete(ptr: *mut SmeeClient) {
if ptr.is_null() {
return;
}
let smee = unsafe {
assert!(!ptr.is_null());
Box::from_raw(&mut *ptr)
};
smee.shutdown();
}
#[no_mangle]
pub unsafe extern "C" fn smee_client_notify_network_joined(
smee_instance: *mut SmeeClient,
network_id: *const c_char,
member_id: *const c_char,
) -> bool {
let nwid = unsafe {
assert!(!network_id.is_null());
CStr::from_ptr(network_id).to_str().unwrap()
};
let mem_id = unsafe {
assert!(!member_id.is_null());
CStr::from_ptr(member_id).to_str().unwrap()
};
let smee = unsafe {
assert!(!smee_instance.is_null());
&mut *smee_instance
};
let params = NetworkJoinedParams::new(nwid, mem_id);
match smee.notify_network_joined(params) {
Ok(()) => true,
Err(e) => {
println!("error notifying network joined: {0}", e);
false
}
}
}

View file

@ -14,14 +14,18 @@ use std::ffi::{CStr, CString};
use std::os::raw::c_char; use std::os::raw::c_char;
use url::Url; use url::Url;
use crate::ZeroIDC; #[cfg(feature = "zeroidc")]
use crate::zeroidc::ZeroIDC;
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_new( pub unsafe extern "C" fn zeroidc_new(
@ -70,12 +74,15 @@ pub unsafe extern "C" fn zeroidc_new(
} }
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) { pub unsafe extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
@ -93,12 +100,15 @@ pub unsafe extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
} }
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) { pub unsafe extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) {
@ -109,12 +119,15 @@ pub unsafe extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) {
idc.start(); idc.start();
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) { pub unsafe extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) {
@ -125,12 +138,15 @@ pub unsafe extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) {
idc.stop(); idc.stop();
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool { pub unsafe extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool {
@ -142,6 +158,16 @@ pub unsafe extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool {
idc.is_running() idc.is_running()
} }
#[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows",
target_os = "macos",
)
))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 { pub unsafe extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 {
let id = unsafe { let id = unsafe {
@ -152,12 +178,15 @@ pub unsafe extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 {
id.get_exp_time() id.get_exp_time()
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_set_nonce_and_csrf( pub unsafe extern "C" fn zeroidc_set_nonce_and_csrf(
@ -186,12 +215,15 @@ pub unsafe extern "C" fn zeroidc_set_nonce_and_csrf(
idc.set_nonce_and_csrf(csrf_token, nonce); idc.set_nonce_and_csrf(csrf_token, nonce);
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn free_cstr(s: *mut c_char) { pub unsafe extern "C" fn free_cstr(s: *mut c_char) {
@ -205,12 +237,15 @@ pub unsafe extern "C" fn free_cstr(s: *mut c_char) {
} }
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char { pub unsafe extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char {
@ -224,12 +259,15 @@ pub unsafe extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char
s.into_raw() s.into_raw()
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char) -> *mut c_char { pub unsafe extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char) -> *mut c_char {
@ -314,12 +352,15 @@ pub unsafe extern "C" fn zeroidc_network_id_from_state(state: *const c_char) ->
s.into_raw() s.into_raw()
} }
#[cfg(any( #[cfg(all(
feature = "zeroidc",
any(
all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86"),
all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86_64"),
all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "aarch64"),
target_os = "windows", target_os = "windows",
target_os = "macos", target_os = "macos",
)
))] ))]
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn zeroidc_kick_refresh_thread(idc: *mut ZeroIDC) { pub unsafe extern "C" fn zeroidc_kick_refresh_thread(idc: *mut ZeroIDC) {
@ -331,3 +372,86 @@ pub unsafe extern "C" fn zeroidc_kick_refresh_thread(idc: *mut ZeroIDC) {
idc.kick_refresh_thread(); idc.kick_refresh_thread();
} }
#[cfg(feature = "ztcontroller")]
use crate::smeeclient::NetworkJoinedParams;
#[cfg(feature = "ztcontroller")]
use crate::smeeclient::SmeeClient;
#[cfg(feature = "ztcontroller")]
#[no_mangle]
pub unsafe extern "C" fn smee_client_new(
temporal_url: *const c_char,
namespace: *const c_char,
task_queue: *const c_char,
) -> *mut SmeeClient {
let url = unsafe {
assert!(!temporal_url.is_null());
CStr::from_ptr(temporal_url).to_str().unwrap()
};
let ns = unsafe {
assert!(!namespace.is_null());
CStr::from_ptr(namespace).to_str().unwrap()
};
let tq = unsafe {
assert!(!task_queue.is_null());
CStr::from_ptr(task_queue).to_str().unwrap()
};
match SmeeClient::new(url, ns, tq) {
Ok(c) => Box::into_raw(Box::new(c)),
Err(e) => {
println!("error creating smee client instance: {}", e);
std::ptr::null_mut()
}
}
}
#[cfg(feature = "ztcontroller")]
#[no_mangle]
pub unsafe extern "C" fn smee_client_delete(ptr: *mut SmeeClient) {
if ptr.is_null() {
return;
}
let smee = unsafe {
assert!(!ptr.is_null());
Box::from_raw(&mut *ptr)
};
smee.shutdown();
}
#[cfg(feature = "ztcontroller")]
#[no_mangle]
pub unsafe extern "C" fn smee_client_notify_network_joined(
smee_instance: *mut SmeeClient,
network_id: *const c_char,
member_id: *const c_char,
) -> bool {
let nwid = unsafe {
assert!(!network_id.is_null());
CStr::from_ptr(network_id).to_str().unwrap()
};
let mem_id = unsafe {
assert!(!member_id.is_null());
CStr::from_ptr(member_id).to_str().unwrap()
};
let smee = unsafe {
assert!(!smee_instance.is_null());
&mut *smee_instance
};
let params = NetworkJoinedParams::new(nwid, mem_id);
match smee.notify_network_joined(params) {
Ok(()) => true,
Err(e) => {
println!("error notifying network joined: {0}", e);
false
}
}
}

5
rustybits/src/lib.rs Normal file
View file

@ -0,0 +1,5 @@
pub mod ext;
#[cfg(feature = "ztcontroller")]
pub mod smeeclient;
#[cfg(feature = "zeroidc")]
pub mod zeroidc;

View file

@ -1,3 +1,4 @@
#![cfg(feature = "ztcontroller")]
/* /*
* Copyright (c)2023 ZeroTier, Inc. * Copyright (c)2023 ZeroTier, Inc.
* *
@ -10,8 +11,6 @@
* of this software will be governed by version 2.0 of the Apache License. * of this software will be governed by version 2.0 of the Apache License.
*/ */
pub mod ext;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::str::FromStr; use std::str::FromStr;
use std::time::Duration; use std::time::Duration;
@ -37,7 +36,7 @@ pub struct NetworkJoinedParams {
} }
impl NetworkJoinedParams { impl NetworkJoinedParams {
fn new(network_id: &str, member_id: &str) -> Self { pub fn new(network_id: &str, member_id: &str) -> Self {
Self { Self {
network_id: network_id.to_string(), network_id: network_id.to_string(),
member_id: member_id.to_string(), member_id: member_id.to_string(),

View file

@ -17,7 +17,6 @@
)] )]
pub mod error; pub mod error;
pub mod ext;
extern crate base64; extern crate base64;
extern crate bytes; extern crate bytes;
@ -25,7 +24,7 @@ extern crate openidconnect;
extern crate time; extern crate time;
extern crate url; extern crate url;
use crate::error::*; use crate::zeroidc::error::*;
use bytes::Bytes; use bytes::Bytes;
use jwt::Token; use jwt::Token;
@ -166,12 +165,12 @@ impl ZeroIDC {
Ok(idc) Ok(idc)
} }
fn kick_refresh_thread(&mut self) { pub fn kick_refresh_thread(&mut self) {
let local = Arc::clone(&self.inner); let local = Arc::clone(&self.inner);
local.lock().unwrap().kick = true; local.lock().unwrap().kick = true;
} }
fn start(&mut self) { pub fn start(&mut self) {
let local = Arc::clone(&self.inner); let local = Arc::clone(&self.inner);
if !local.lock().unwrap().running { if !local.lock().unwrap().running {

View file

@ -1,11 +0,0 @@
[target.x86_64-apple-darwin]
rustflags=["-C", "link-arg=-mmacosx-version-min=10.13"]
[target.aarch64-apple-darwin]
rustflags=["-C", "link-arg=-mmacosx-version-min=10.13"]
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
[target.i686-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

View file

@ -1,3 +0,0 @@
# disable autocrlf because it doesn't mix well with
# vendored rust packages
* text=false

View file

@ -1,28 +0,0 @@
[package]
name = "zeroidc"
version = "0.1.0"
edition = "2021"
build = "build.rs"
publish = false
[lib]
crate-type = ["staticlib", "rlib"]
[dependencies]
openidconnect = { version = "3.4", default-features = false, features = [
"reqwest",
"native-tls",
"accept-rfc3339-timestamps",
] }
base64 = "0.21"
url = "2.3"
reqwest = "0.11"
jwt = { version = "0.16", git = "https://github.com/glimberg/rust-jwt" }
serde = "1.0"
time = { version = "~0.3", features = ["formatting"] }
bytes = "1.3"
thiserror = "1"
tokio = { version = ">=1.24" }
[build-dependencies]
cbindgen = "0.20"

View file

@ -1,36 +0,0 @@
extern crate cbindgen;
use cbindgen::{Config, Language};
use std::env;
use std::path::PathBuf;
fn main() {
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let package_name = env::var("CARGO_PKG_NAME").unwrap();
let output_file = target_dir().join(format!("{package_name}.h")).display().to_string();
let config = Config {
language: Language::C,
cpp_compat: true,
namespace: Some(String::from("zeroidc")),
..Default::default()
};
cbindgen::generate_with_config(&crate_dir, config)
.unwrap()
.write_to_file(&output_file);
}
/// Find the location of the `target/` directory. Note that this may be
/// overridden by `cmake`, so we also need to check the `CARGO_TARGET_DIR`
/// variable.
fn target_dir() -> PathBuf {
if let Ok(target) = env::var("CARGO_TARGET_DIR") {
PathBuf::from(target)
} else {
PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.join("..")
.join("target")
}
}

View file

@ -1 +0,0 @@
../rustfmt.toml

View file

@ -92,7 +92,7 @@ namespace sdkresource = opentelemetry::v1::sdk::resource;
#endif #endif
#if ZT_SSO_ENABLED #if ZT_SSO_ENABLED
#include <zeroidc.h> #include <rustybits.h>
#endif #endif
#ifdef __WINDOWS__ #ifdef __WINDOWS__
@ -334,8 +334,8 @@ class NetworkState {
#if ZT_SSO_ENABLED #if ZT_SSO_ENABLED
if (_idc) { if (_idc) {
zeroidc::zeroidc_stop(_idc); rustybits::zeroidc_stop(_idc);
zeroidc::zeroidc_delete(_idc); rustybits::zeroidc_delete(_idc);
_idc = nullptr; _idc = nullptr;
} }
#endif #endif
@ -433,7 +433,7 @@ class NetworkState {
assert(_config.centralAuthURL != nullptr); assert(_config.centralAuthURL != nullptr);
assert(_config.ssoProvider != nullptr); assert(_config.ssoProvider != nullptr);
_idc = zeroidc::zeroidc_new(_config.issuerURL, _config.ssoClientID, _config.centralAuthURL, _config.ssoProvider, _webPort); _idc = rustybits::zeroidc_new(_config.issuerURL, _config.ssoClientID, _config.centralAuthURL, _config.ssoProvider, _webPort);
if (_idc == nullptr) { if (_idc == nullptr) {
fprintf(stderr, "idc is null\n"); fprintf(stderr, "idc is null\n");
@ -441,15 +441,15 @@ class NetworkState {
} }
} }
zeroidc::zeroidc_set_nonce_and_csrf(_idc, _config.ssoState, _config.ssoNonce); rustybits::zeroidc_set_nonce_and_csrf(_idc, _config.ssoState, _config.ssoNonce);
char* url = zeroidc::zeroidc_get_auth_url(_idc); char* url = rustybits::zeroidc_get_auth_url(_idc);
memcpy(_config.authenticationURL, url, strlen(url)); memcpy(_config.authenticationURL, url, strlen(url));
_config.authenticationURL[strlen(url)] = 0; _config.authenticationURL[strlen(url)] = 0;
zeroidc::free_cstr(url); rustybits::free_cstr(url);
if (zeroidc::zeroidc_is_running(_idc) && nwc->status == ZT_NETWORK_STATUS_AUTHENTICATION_REQUIRED) { if (rustybits::zeroidc_is_running(_idc) && nwc->status == ZT_NETWORK_STATUS_AUTHENTICATION_REQUIRED) {
zeroidc::zeroidc_kick_refresh_thread(_idc); rustybits::zeroidc_kick_refresh_thread(_idc);
} }
#endif #endif
} }
@ -479,13 +479,13 @@ class NetworkState {
return ret; return ret;
} }
ret = zeroidc::zeroidc_token_exchange(_idc, code); ret = rustybits::zeroidc_token_exchange(_idc, code);
zeroidc::zeroidc_set_nonce_and_csrf(_idc, _config.ssoState, _config.ssoNonce); rustybits::zeroidc_set_nonce_and_csrf(_idc, _config.ssoState, _config.ssoNonce);
char* url = zeroidc::zeroidc_get_auth_url(_idc); char* url = rustybits::zeroidc_get_auth_url(_idc);
memcpy(_config.authenticationURL, url, strlen(url)); memcpy(_config.authenticationURL, url, strlen(url));
_config.authenticationURL[strlen(url)] = 0; _config.authenticationURL[strlen(url)] = 0;
zeroidc::free_cstr(url); rustybits::free_cstr(url);
#endif #endif
return ret; return ret;
} }
@ -497,7 +497,7 @@ class NetworkState {
fprintf(stderr, "idc is null\n"); fprintf(stderr, "idc is null\n");
return 0; return 0;
} }
return zeroidc::zeroidc_get_exp_time(_idc); return rustybits::zeroidc_get_exp_time(_idc);
#else #else
return 0; return 0;
#endif #endif
@ -511,7 +511,7 @@ class NetworkState {
std::map<InetAddress, SharedPtr<ManagedRoute> > _managedRoutes; std::map<InetAddress, SharedPtr<ManagedRoute> > _managedRoutes;
OneService::NetworkSettings _settings; OneService::NetworkSettings _settings;
#if ZT_SSO_ENABLED #if ZT_SSO_ENABLED
zeroidc::ZeroIDC* _idc; rustybits::ZeroIDC* _idc;
#endif #endif
}; };
@ -2536,13 +2536,13 @@ class OneServiceImpl : public OneService {
// SSO redirect handling // SSO redirect handling
std::string state = req.get_param_value("state"); std::string state = req.get_param_value("state");
char* nwid = zeroidc::zeroidc_network_id_from_state(state.c_str()); char* nwid = rustybits::zeroidc_network_id_from_state(state.c_str());
outData["networkId"] = std::string(nwid); outData["networkId"] = std::string(nwid);
const uint64_t id = Utils::hexStrToU64(nwid); const uint64_t id = Utils::hexStrToU64(nwid);
zeroidc::free_cstr(nwid); rustybits::free_cstr(nwid);
Mutex::Lock l(_nets_m); Mutex::Lock l(_nets_m);
if (_nets.find(id) != _nets.end()) { if (_nets.find(id) != _nets.end()) {
@ -2574,7 +2574,7 @@ class OneServiceImpl : public OneService {
res.status = 500; res.status = 500;
} }
zeroidc::free_cstr(ret); rustybits::free_cstr(ret);
} }
}; };
_controlPlane.Get(ssoPath, ssoGet); _controlPlane.Get(ssoPath, ssoGet);