Repository: lanthora/candy
Branch: master
Commit: fa41f0172719
Files: 86
Total size: 288.4 KB
Directory structure:
gitextract_0f5sny5p/
├── .clang-format
├── .dockerignore
├── .github/
│ └── workflows/
│ ├── check.yaml
│ ├── release.yaml
│ └── standalone.yaml
├── .gitignore
├── .vscode/
│ ├── c_cpp_properties.json
│ ├── extensions.json
│ ├── launch.json
│ ├── settings.json
│ └── tasks.json
├── CMakeLists.txt
├── LICENSE
├── README.md
├── candy/
│ ├── .vscode/
│ │ ├── c_cpp_properties.json
│ │ └── settings.json
│ ├── CMakeLists.txt
│ ├── include/
│ │ └── candy/
│ │ ├── candy.h
│ │ ├── client.h
│ │ ├── common.h
│ │ └── server.h
│ └── src/
│ ├── candy/
│ │ ├── client.cc
│ │ └── server.cc
│ ├── core/
│ │ ├── client.cc
│ │ ├── client.h
│ │ ├── common.cc
│ │ ├── message.cc
│ │ ├── message.h
│ │ ├── net.cc
│ │ ├── net.h
│ │ ├── server.cc
│ │ ├── server.h
│ │ └── version.h
│ ├── peer/
│ │ ├── manager.cc
│ │ ├── manager.h
│ │ ├── message.cc
│ │ ├── message.h
│ │ ├── peer.cc
│ │ └── peer.h
│ ├── tun/
│ │ ├── linux.cc
│ │ ├── macos.cc
│ │ ├── tun.cc
│ │ ├── tun.h
│ │ ├── unknown.cc
│ │ └── windows.cc
│ ├── utils/
│ │ ├── atomic.h
│ │ ├── codecvt.cc
│ │ ├── codecvt.h
│ │ ├── random.cc
│ │ ├── random.h
│ │ ├── time.cc
│ │ └── time.h
│ └── websocket/
│ ├── client.cc
│ ├── client.h
│ ├── message.cc
│ ├── message.h
│ ├── server.cc
│ └── server.h
├── candy-cli/
│ ├── CMakeLists.txt
│ └── src/
│ ├── argparse.h
│ ├── config.cc
│ ├── config.h
│ └── main.cc
├── candy-service/
│ ├── CMakeLists.txt
│ ├── README.md
│ └── src/
│ └── main.cc
├── candy.cfg
├── candy.initd
├── candy.service
├── candy@.service
├── cmake/
│ ├── Fetch.cmake
│ └── openssl/
│ └── CMakeLists.txt
├── dockerfile
├── docs/
│ ├── CNAME
│ ├── _config.yml
│ ├── deploy-cli-server.md
│ ├── deploy-web-server.md
│ ├── index.md
│ ├── install-client-for-linux.md
│ ├── install-client-for-macos.md
│ ├── install-client-for-windows.md
│ ├── software-defined-wide-area-network.md
│ └── use-the-community-server.md
└── scripts/
├── build-standalone.sh
├── search-deps.sh
└── standalone.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .clang-format
================================================
---
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 8
AccessModifierOffset: -4
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
ColumnLimit: 130
IndentCaseLabels: false
SortIncludes: true
...
================================================
FILE: .dockerignore
================================================
.git
.github
.vscode
build/*
================================================
FILE: .github/workflows/check.yaml
================================================
name: check
on:
pull_request:
branches: [master]
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: check format
uses: jidicula/clang-format-action@v4.11.0
with:
check-path: 'src'
exclude-regex: 'argparse.h'
linux:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: build
run: docker build .
macos:
runs-on: macos-latest
steps:
- name: depends
run: brew update && brew install fmt poco spdlog
- name: checkout
uses: actions/checkout@v4
- name: build
run: |
if [ "$RUNNER_ARCH" == "ARM64" ]; then
export CPATH=/opt/homebrew/include
export LIBRARY_PATH=/opt/homebrew/lib
else
export CPATH=/usr/local/include
export LIBRARY_PATH=/usr/local/lib
fi
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build build
windows:
runs-on: windows-latest
steps:
- name: depends
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-gcc
mingw-w64-x86_64-spdlog
mingw-w64-x86_64-poco
- name: checkout
uses: actions/checkout@v4
- name: cache
uses: actions/cache@v4
with:
path: build
key: ${{ hashFiles('CMakeLists.txt') }}
- name: build
shell: msys2 {0}
run: cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build build
================================================
FILE: .github/workflows/release.yaml
================================================
name: release
on:
push:
branches: [ master ]
release:
types: [ published ]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup qemu
uses: docker/setup-qemu-action@v3
- name: setup docker buildx
uses: docker/setup-buildx-action@v3
- name: login docker hub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: login github container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: setup version
if: github.event_name == 'release'
run: |
GIT_TAG=${{ github.event.release.tag_name }}
echo "IMAGE_TAG=${GIT_TAG#v}" >> $GITHUB_ENV
- name: build and push
uses: docker/build-push-action@v5
if: github.event_name == 'release'
with:
context: .
provenance: false
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/candy:${{ env.IMAGE_TAG }}
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/candy:latest
ghcr.io/${{ github.actor }}/candy:${{ env.IMAGE_TAG }}
ghcr.io/${{ github.actor }}/candy:latest
windows:
runs-on: windows-latest
steps:
- name: setup msys2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-gcc
mingw-w64-x86_64-spdlog
mingw-w64-x86_64-poco
- name: checkout
uses: actions/checkout@v4
- name: cache
uses: actions/cache@v4
with:
path: build
key: ${{ hashFiles('CMakeLists.txt') }}
- name: build
shell: msys2 {0}
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo && cmake --build build
mkdir artifact
cp candy.cfg artifact
cp build/candy/wintun/bin/amd64/wintun.dll artifact
scripts/search-deps.sh build/candy-cli/candy.exe artifact
scripts/search-deps.sh build/candy-service/candy-service.exe artifact
- name: set release package name
shell: bash
if: github.event_name == 'release'
run: |
GIT_TAG=${{ github.event.release.tag_name }}
echo "PKGNAME=candy_${GIT_TAG#v}+windows_amd64" >> $GITHUB_ENV
- name: upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-${{ github.event.release.tag_name || github.sha }}
path: artifact
- name: zip release
uses: thedoctor0/zip-release@0.7.5
if: github.event_name == 'release'
with:
type: 'zip'
filename: ${{ env.PKGNAME }}.zip
directory: artifact
- name: upload release
uses: softprops/action-gh-release@v2
if: github.event_name == 'release'
with:
files: artifact/${{ env.PKGNAME }}.zip
================================================
FILE: .github/workflows/standalone.yaml
================================================
name: standalone
on:
workflow_dispatch:
release:
types: [ published ]
pull_request:
branches: [master]
paths:
- 'scripts/build-standalone.sh'
- 'scripts/standalone.json'
jobs:
configure:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.fetch.outputs.matrix }}
steps:
- name: Checkout to repository
uses: actions/checkout@v4
- name: fetch matrix data
id: fetch
run: echo "matrix=$(jq -c . < scripts/standalone.json)" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: configure
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.configure.outputs.matrix) }}
env:
WORKSPACE: "/opt"
steps:
- name: checkout
uses: actions/checkout@v4
- name: Install UPX
uses: crazy-max/ghaction-upx@v3
with:
install-only: true
- name: cache
uses: actions/cache@v4
with:
path: ${{ env.WORKSPACE }}/toolchains
key: ${{ matrix.os }}-${{ matrix.arch }}-${{ hashFiles('scripts/build-standalone.sh') }}
- name: Cross compile
run: |
./scripts/build-standalone.sh
env:
CANDY_WORKSPACE: ${{ env.WORKSPACE }}
CANDY_OS: ${{ matrix.os }}
CANDY_ARCH: ${{ matrix.arch }}
CANDY_STRIP: "0"
CANDY_UPX: "0"
CANDY_TGZ: "1"
- name: upload
uses: actions/upload-artifact@v4
with:
name: candy-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ env.WORKSPACE }}/output/${{ matrix.os }}-${{ matrix.arch }}
- name: prepare package
shell: bash
if: github.event_name == 'release'
run: |
GIT_TAG=${{ github.event.release.tag_name }}
PKG_PATH=${{ env.WORKSPACE }}/output/candy_${GIT_TAG#v}+${{ matrix.os }}_${{ matrix.arch }}.tar.gz
mv ${{ env.WORKSPACE }}/output/candy-${{ matrix.os }}-${{ matrix.arch }}.tar.gz $PKG_PATH
echo "PKG_PATH=$PKG_PATH" >> $GITHUB_ENV
- name: release
uses: softprops/action-gh-release@v2
if: github.event_name == 'release'
with:
files: ${{ env.PKG_PATH }}
================================================
FILE: .gitignore
================================================
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# CMake Build files
.cache
build
================================================
FILE: .vscode/c_cpp_properties.json
================================================
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}
================================================
FILE: .vscode/extensions.json
================================================
{
"recommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
================================================
FILE: .vscode/launch.json
================================================
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/src/main/candy",
"args": [
"-c",
"candy.cfg"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
================================================
FILE: .vscode/settings.json
================================================
{
"editor.detectIndentation": false,
"editor.tabSize": 4,
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.formatOnSaveMode": "modifications",
"files.insertFinalNewline": true,
"json.format.enable": true,
"C_Cpp.default.cppStandard": "c++23",
"C_Cpp.autoAddFileAssociations": false,
"C_Cpp.errorSquiggles": "disabled"
}
================================================
FILE: .vscode/tasks.json
================================================
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "/usr/bin/g++",
"args": [
"-fdiagnostics-color=always",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.16)
project(Candy VERSION 6.1.7)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_definitions(CANDY_VERSION="${PROJECT_VERSION}")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
if (${CANDY_STATIC})
set(CANDY_STATIC_OPENSSL 1)
set(CANDY_STATIC_SPDLOG 1)
set(CANDY_STATIC_NLOHMANN_JSON 1)
set(CANDY_STATIC_POCO 1)
endif()
find_package(PkgConfig REQUIRED)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Fetch.cmake)
if (${CANDY_STATIC_OPENSSL})
execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/openssl
)
execute_process(
COMMAND ${CMAKE_COMMAND} -DTARGET_OPENSSL=${TARGET_OPENSSL} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/openssl
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/openssl
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "OpenSSL CMake failed")
endif()
execute_process(
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/openssl
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "OpenSSL Download or Configure failed")
endif()
include(ProcessorCount)
ProcessorCount(nproc)
if(nproc EQUAL 0)
set(nproc 1)
endif()
set(OPENSSL_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/openssl/openssl/src/openssl)
execute_process(
COMMAND make -j${nproc}
WORKING_DIRECTORY ${OPENSSL_ROOT_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL "0")
message(FATAL_ERROR "OpenSSL Build failed")
endif()
set(OPENSSL_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/openssl/openssl/src/openssl)
set(OPENSSL_INCLUDE ${OPENSSL_ROOT_DIR}/include)
set(OPENSSL_LIB_CRYPTO ${OPENSSL_ROOT_DIR}/libcrypto.a)
set(OPENSSL_LIB_SSL ${OPENSSL_ROOT_DIR}/libssl.a)
include_directories(${OPENSSL_INCLUDE})
else()
find_package(OpenSSL REQUIRED)
endif()
if (${CANDY_STATIC_SPDLOG})
Fetch(spdlog "https://github.com/gabime/spdlog.git" "v1.15.3")
else()
find_package(spdlog REQUIRED)
endif()
if (${CANDY_STATIC_POCO})
set(ENABLE_DATA OFF CACHE BOOL "" FORCE)
set(ENABLE_DATA_MYSQL OFF CACHE BOOL "" FORCE)
set(ENABLE_DATA_POSTGRESQL OFF CACHE BOOL "" FORCE)
set(ENABLE_DATA_SQLITE OFF CACHE BOOL "" FORCE)
set(ENABLE_DATA_ODBC OFF CACHE BOOL "" FORCE)
set(ENABLE_MONGODB OFF CACHE BOOL "" FORCE)
set(ENABLE_REDIS OFF CACHE BOOL "" FORCE)
set(ENABLE_ENCODINGS OFF CACHE BOOL "" FORCE)
set(ENABLE_PROMETHEUS OFF CACHE BOOL "" FORCE)
set(ENABLE_PAGECOMPILER OFF CACHE BOOL "" FORCE)
set(ENABLE_PAGECOMPILER_FILE2PAGE OFF CACHE BOOL "" FORCE)
set(ENABLE_ACTIVERECORD OFF CACHE BOOL "" FORCE)
set(ENABLE_ACTIVERECORD_COMPILER OFF CACHE BOOL "" FORCE)
set(ENABLE_ZIP OFF CACHE BOOL "" FORCE)
set(ENABLE_JWT OFF CACHE BOOL "" FORCE)
Fetch(poco "https://github.com/pocoproject/poco.git" "poco-1.13.3-release")
else()
find_package(Poco REQUIRED COMPONENTS Foundation XML JSON Net NetSSL Util)
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_subdirectory(candy)
add_subdirectory(candy-cli)
add_subdirectory(candy-service)
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2023 lanthora
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Candy
一个简单的组网工具.
## 如何使用
- [安装 Windows 客户端](https://docs.canets.org/install-client-for-windows)
- [安装 macOS 客户端](https://docs.canets.org/install-client-for-macos)
- [安装 Linux 客户端](https://docs.canets.org/install-client-for-linux)
- [部署 Web 服务端](https://docs.canets.org/deploy-web-server)
- [部署 CLI 服务端](https://docs.canets.org/deploy-cli-server)
- [使用社区服务器](https://docs.canets.org/use-the-community-server)
- [多局域网组网](https://docs.canets.org/software-defined-wide-area-network)
## 相关项目
- [Cacao](https://github.com/lanthora/cacao): WebUI 版的 Candy 服务器
- [Cake](https://github.com/lanthora/cake): Qt 实现的 Candy GUI 桌面应用程序
- [Candy Android](https://github.com/Jercrox/Candy_Android_Client): Android 客户端
- [EasyTier](https://github.com/EasyTier/EasyTier): 一个简单、安全、去中心化的内网穿透 VPN 组网方案,使用 Rust 语言和 Tokio 框架实现
- [candygo](https://github.com/SoraKasvgano/candygo): 一个简单的与candy原项目配置文件兼容的go版本
## 交流群
- QQ: 768305206
- TG: [Click to Join](https://t.me/CandyUserGroup)
================================================
FILE: candy/.vscode/c_cpp_properties.json
================================================
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}
================================================
FILE: candy/.vscode/settings.json
================================================
{
"editor.detectIndentation": false,
"editor.tabSize": 4,
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.formatOnSaveMode": "modifications",
"files.insertFinalNewline": true,
"json.format.enable": true,
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.autoAddFileAssociations": false,
"C_Cpp.errorSquiggles": "disabled"
}
================================================
FILE: candy/CMakeLists.txt
================================================
add_library(candy-library)
file(GLOB_RECURSE SOURCES "src/*.cc")
target_sources(candy-library PRIVATE ${SOURCES})
target_include_directories(candy-library PUBLIC
$
$
$
)
if (${CANDY_STATIC_OPENSSL})
target_link_libraries(candy-library PRIVATE ${OPENSSL_LIB_CRYPTO} ${OPENSSL_LIB_SSL})
else()
target_link_libraries(candy-library PRIVATE OpenSSL::SSL OpenSSL::Crypto)
endif()
target_link_libraries(candy-library PRIVATE spdlog::spdlog)
target_link_libraries(candy-library PRIVATE Poco::Foundation Poco::JSON Poco::Net Poco::NetSSL)
target_link_libraries(candy-library PRIVATE Threads::Threads)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(candy-library PRIVATE ws2_32)
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
target_link_libraries(candy-library PRIVATE iphlpapi)
target_link_libraries(candy-library PRIVATE ws2_32)
set(WINTUN_VERSION 0.14.1)
set(WINTUN_ZIP wintun-${WINTUN_VERSION}.zip)
set(WINTUN_URL https://www.wintun.net/builds/${WINTUN_ZIP})
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${WINTUN_ZIP})
file(DOWNLOAD ${WINTUN_URL} ${CMAKE_CURRENT_BINARY_DIR}/${WINTUN_ZIP} STATUS DOWNLOAD_STATUS)
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
if(${STATUS_CODE} EQUAL 0)
message(STATUS "wintun download success")
else()
message(FATAL_ERROR "wintun download failed: ${ERROR_MESSAGE}")
endif()
else()
message(STATUS "use wintun cache")
endif()
file(ARCHIVE_EXTRACT INPUT ${CMAKE_CURRENT_BINARY_DIR}/${WINTUN_ZIP})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/wintun/include)
endif()
set_target_properties(candy-library PROPERTIES OUTPUT_NAME "candy")
add_library(Candy::Library ALIAS candy-library)
================================================
FILE: candy/include/candy/candy.h
================================================
// SPDX-License-Identifier: MIT
#ifndef CANDY_CANDY_H
#define CANDY_CANDY_H
#include "client.h"
#include "common.h"
#include "server.h"
#endif
================================================
FILE: candy/include/candy/client.h
================================================
// SPDX-License-Identifier: MIT
#ifndef CANDY_CLIENT_H
#define CANDY_CLIENT_H
#include
#include
#include
namespace candy {
namespace client {
bool run(const std::string &id, const Poco::JSON::Object &config);
bool shutdown(const std::string &id);
std::optional status(const std::string &id);
} // namespace client
} // namespace candy
#endif
================================================
FILE: candy/include/candy/common.h
================================================
// SPDX-License-Identifier: MIT
#ifndef CANDY_COMMON_H
#define CANDY_COMMON_H
#include
namespace candy {
static const int VMAC_SIZE = 16;
std::string version();
std::string create_vmac();
} // namespace candy
#endif
================================================
FILE: candy/include/candy/server.h
================================================
// SPDX-License-Identifier: MIT
#ifndef CANDY_SERVER_H
#define CANDY_SERVER_H
#include
#include
namespace candy {
namespace server {
bool run(const Poco::JSON::Object &config);
bool shutdown();
} // namespace server
} // namespace candy
#endif
================================================
FILE: candy/src/candy/client.cc
================================================
// SPDX-License-Identifier: MIT
#include "candy/client.h"
#include "core/client.h"
#include "utils/atomic.h"
#include
#include
#include