2023-06-19 11:08:42 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
#include <spdlog/spdlog.h>
|
2023-07-31 06:07:11 +00:00
|
|
|
|
#include "common.h"
|
2023-06-19 11:08:42 +00:00
|
|
|
|
|
2023-08-02 08:41:15 +00:00
|
|
|
|
#include <winsock2.h>
|
|
|
|
|
|
2023-07-31 06:07:11 +00:00
|
|
|
|
#if 0
|
2023-06-20 09:25:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* @brief WireGuard 配置项
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
|
|
|
|
TCHAR wireguardPath[MAX_PATH]; ///< wireguard.exe 路径
|
|
|
|
|
BOOL wireguardExists; ///< wireguard.exe 是否存在
|
|
|
|
|
TCHAR wgPath[MAX_PATH]; ///< wg.exe 路径
|
|
|
|
|
BOOL wgExists; ///< wg.exe 是否存在
|
2023-06-19 11:08:42 +00:00
|
|
|
|
} WIREGUARD_CFG, *PWIREGUARD_CFG;
|
2023-07-31 06:07:11 +00:00
|
|
|
|
#endif
|
2023-06-19 11:08:42 +00:00
|
|
|
|
|
2023-07-10 08:36:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* @brief WireGuard 网络接口配置项
|
|
|
|
|
*/
|
2023-06-21 10:04:16 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
TCHAR wgName[260]; ///< 网卡名称, Windows标识为 UUID
|
|
|
|
|
TCHAR wgIpaddr[MAX_IP_LEN]; ///< 网卡 IP 地址
|
|
|
|
|
TCHAR wgNetmask[MAX_IP_LEN]; ///< 网卡子网掩码
|
|
|
|
|
TCHAR wgCfgPath[MAX_PATH]; ///< 配置文件路径
|
|
|
|
|
} WGINTERFACE_CFG, *PWGINTERFACE_CFG;
|
|
|
|
|
|
2023-07-10 08:36:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* @brief 用户信息配置
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
|
|
|
|
TCHAR userName[MAX_PATH]; ///< 用户名
|
|
|
|
|
TCHAR userToken[MAX_PATH]; ///< 用户访问令牌
|
|
|
|
|
USER_CLIENT_CONFIG cliConfig; ///< 用户客户端配置
|
2023-07-14 09:29:02 +00:00
|
|
|
|
USER_SERVER_CONFIG svrConfig; ///< 用户服务端配置
|
2023-07-10 08:36:19 +00:00
|
|
|
|
} USER_CONFIG, *PUSER_CONFIG;
|
|
|
|
|
|
2023-08-02 08:41:15 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
TCHAR targetIp[MAX_IP_LEN];
|
|
|
|
|
UINT16 targetPort;
|
|
|
|
|
UINT16 proxyPort;
|
|
|
|
|
UINT16 scgGwPort;
|
|
|
|
|
TCHAR scgIpAddr[MAX_IP_LEN];
|
|
|
|
|
SOCKET udpProxySock;
|
|
|
|
|
SOCKET scgGwSock;
|
|
|
|
|
HANDLE hProxyTunnelThread;
|
|
|
|
|
HANDLE hProxySCGThread;
|
|
|
|
|
bool exitNow;
|
|
|
|
|
} SCG_PROXY_INFO, *PSCG_PROXY_INFO;
|
|
|
|
|
|
2023-06-20 09:25:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* @brief SDK 全局配置项
|
|
|
|
|
*/
|
|
|
|
|
typedef struct {
|
2023-07-10 08:36:19 +00:00
|
|
|
|
TCHAR platformServerUrl[MAX_PATH]; ///< 管理平台IP地址
|
|
|
|
|
TCHAR configDirectory[MAX_PATH]; ///< 配置存放目录
|
|
|
|
|
TCHAR systemDirectory[MAX_PATH]; ///< 操作系统目录
|
|
|
|
|
TCHAR workDirectory[MAX_PATH]; ///< SDK 当前工作目录
|
|
|
|
|
bool isWorkServer; ///< SDK 当前模式 客户端/服务端
|
|
|
|
|
PROTO_CRYPTO_TYPE proCryptoType; ///< 协议加密类型
|
|
|
|
|
TCHAR proKeyBuf[256]; ///< 协议加密秘钥
|
|
|
|
|
BOOL enableLog; ///< 是否启用日志
|
|
|
|
|
spdlog::level::level_enum logLevel; ///< 日志等级
|
|
|
|
|
TCHAR cfgPath[MAX_PATH]; ///< 配置文件路径
|
|
|
|
|
WGINTERFACE_CFG wgServerCfg; ///< wireguard 服务端网络接口配置
|
|
|
|
|
WGINTERFACE_CFG wgClientCfg; ///< wireguard 客户端网络接口配置
|
|
|
|
|
USER_CONFIG userCfg; ///< 用户配置项
|
2023-08-03 09:13:03 +00:00
|
|
|
|
SCG_PROXY_INFO scgProxy; ///< SCG UDP 代理信息
|
2023-07-25 01:02:16 +00:00
|
|
|
|
int curConnVmId; ///< 当前连接的VM
|
2023-08-14 01:20:25 +00:00
|
|
|
|
TCHAR clientId[MAX_PATH]; ///< 客户端验证签名 ID
|
|
|
|
|
TCHAR clientSecret[MAX_PATH]; ///< 客户端验证签名秘钥
|
2023-06-19 11:08:42 +00:00
|
|
|
|
} SDK_CONFIG, *PSDK_CONFIG;
|
|
|
|
|
|
2023-06-20 09:25:14 +00:00
|
|
|
|
#ifdef __cplusplus // If used by C++ code,
|
|
|
|
|
extern "C" {
|
|
|
|
|
// we need to export the C interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-06-19 11:08:42 +00:00
|
|
|
|
PSDK_CONFIG GetGlobalCfgInfo();
|
2023-06-20 09:25:14 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|