mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-09-03 05:12:54 +02:00
Implements structured JSON diagnostic output for node state export with full schema documentation. This feature provides machine-readable diagnostics for automated analysis, monitoring, and AI/MCP integration. Key changes: - Add `zerotier-cli diagnostic` command for JSON node state export - Add `zerotier-cli dump -j` as alias for JSON output - Add `zerotier-cli diagnostic --schema` to print JSON schema - Implement platform-specific interface collection (Linux, BSD, macOS, Windows) - Create modular diagnostic/ directory with isolated try/catch error handling - Add comprehensive JSON schema (diagnostic_schema.json) for validation - Include build-time schema embedding for offline access - Add Python and Rust scripts for schema embedding during build - Update build systems to compile new diagnostic modules The diagnostic output includes: - Node configuration and identity - Network memberships and settings - Interface states and IP addresses - Peer connections and statistics - Moon orbits - Controller networks (if applicable) All diagnostic collection is wrapped in try/catch blocks to ensure partial failures don't prevent overall output generation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
39 lines
1.5 KiB
CMake
39 lines
1.5 KiB
CMake
# CMake build script for libzerotiercore.a
|
|
|
|
cmake_minimum_required (VERSION 2.8)
|
|
project (zerotiercore)
|
|
|
|
set (PROJ_DIR ${PROJECT_SOURCE_DIR})
|
|
set (ZT_DEFS -std=c++11)
|
|
|
|
file(GLOB core_src_glob ${PROJ_DIR}/node/*.cpp)
|
|
add_library(zerotiercore STATIC ${core_src_glob})
|
|
|
|
target_compile_options(zerotiercore PRIVATE ${ZT_DEFS})
|
|
|
|
# Build the Rust embedding tool
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/ci/scripts/embed_json
|
|
COMMAND rustc ${CMAKE_CURRENT_SOURCE_DIR}/ci/scripts/embed_json.rs -o ${CMAKE_CURRENT_SOURCE_DIR}/ci/scripts/embed_json
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ci/scripts/embed_json.rs
|
|
COMMENT "Building Rust JSON embedding tool"
|
|
)
|
|
|
|
# Embed diagnostic_schema.json as a C string
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic/diagnostic_schema_embed.c
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ci/scripts/embed_json ${CMAKE_CURRENT_SOURCE_DIR}/../diagnostic/diagnostic_schema.json ${CMAKE_CURRENT_SOURCE_DIR}/diagnostic/diagnostic_schema_embed.c
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../diagnostic/diagnostic_schema.json ${CMAKE_CURRENT_SOURCE_DIR}/ci/scripts/embed_json
|
|
COMMENT "Embedding diagnostic_schema.json as C string"
|
|
)
|
|
|
|
set(DIAGNOSTIC_SCHEMA_EMBED_SRC
|
|
diagnostic/diagnostic_schema_embed.c
|
|
diagnostic/diagnostic_schema_embed.h
|
|
)
|
|
|
|
# Add the generated source to your main target (replace <your_target> with actual target name)
|
|
target_sources(zerotiercore PRIVATE
|
|
${DIAGNOSTIC_SCHEMA_EMBED_SRC}
|
|
)
|