feat: add ESP32 embedded agent + namespace VRF reference docs + update android-agent submodule
- apps/device-agent-embedded/: ESP32 WireGuard agent (C, ESP-IDF, mbedTLS) - reference/namespace-vrf/: Linux namespace/VRF network isolation docs - apps/android-agent: VPN permission check, StartResult sealed class
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @file config.h
|
||||
* @brief NVS Configuration Management
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <esp_err.h>
|
||||
|
||||
/* WireGuard configuration structure */
|
||||
typedef struct {
|
||||
char device_id[37]; /* UUID */
|
||||
char private_key[64]; /* WG private key hex */
|
||||
char preshared_key[64]; /* PSK hex */
|
||||
char internal_ip[18]; /* e.g. "10.172.21.2" */
|
||||
char server_pub[64]; /* Server WG public key hex */
|
||||
char endpoint[128]; /* e.g. "italy-twenty.gl.at.ply.gg:59750" */
|
||||
char dns[64]; /* DNS server */
|
||||
char allowed_ips[128]; /* e.g. "0.0.0.0/0" */
|
||||
char server_wg_ip[18]; /* e.g. "10.172.21.1" */
|
||||
char config_hash[64]; /* Last config hash */
|
||||
} wg_config_t;
|
||||
|
||||
/* Device state */
|
||||
typedef enum {
|
||||
STATE_BOOT,
|
||||
STATE_WIFI_INIT,
|
||||
STATE_WIFI_CONNECTED,
|
||||
STATE_PROVISIONING,
|
||||
STATE_PROVISIONED,
|
||||
STATE_TUNNEL_UP,
|
||||
STATE_TUNNEL_DOWN,
|
||||
STATE_HEARTBEAT,
|
||||
STATE_ERROR
|
||||
} device_state_t;
|
||||
|
||||
/**
|
||||
* @brief Initialize configuration module
|
||||
*/
|
||||
esp_err_t config_init(void);
|
||||
|
||||
/**
|
||||
* @brief Save configuration to NVS
|
||||
*/
|
||||
esp_err_t config_save(const wg_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Load configuration from NVS
|
||||
*/
|
||||
esp_err_t config_load(wg_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Clear configuration from NVS
|
||||
*/
|
||||
esp_err_t config_clear(void);
|
||||
|
||||
/**
|
||||
* @brief Check if configuration is valid
|
||||
*/
|
||||
bool config_is_valid(const wg_config_t *config);
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
Reference in New Issue
Block a user