I want to send random data about temperature and humidity to a server via HTTP POST while using the WireGuard protocol. When I run my code in the Arduino IDE, I get the following error:
c:\Users\my_name\Downloads\libraries\WireGuard-ESP32\src\wireguardif.c:51:10: fatal error: tcpip_adapter.h: No such file or directory
51 | #include "tcpip_adapter.h"
| ^~~~~~~~~~~~~~~~~
compilation terminated.
Alternatives for tcpip_adapter.h: []
ResolveLibrary(tcpip_adapter.h)
-> candidates: []
exit status 1
Compilation error: exit status 1
Here is my code:
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <WireGuard-ESP32.h>
#include <Wire.h>
const char* ssid="abc";
const char* password = "123456789";
WireGuard wg;
const char* server_public_key = "public key wireguard server"; // Public key from WireGuard server
const char* private_key = "private key esp32"; // Private key ESP32
const char* endpoint = "192.168.x`Teks terformat`.x:51820"; // Address of WireGuard server and port
IPAddress local_ip(192, 168, 43, 6); // Local IP address of ESP32 on VPN
IPAddress allowed_ip(192, 168, 43, 0);
void setup() {
Serial.begin(9600);
//Serial.println(F("DHTxx test!"));
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
int i=0;
while(WiFi.status() != WL_CONNECTED){
Serial.print(".");
delay(1000);
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
Serial.println();
delay(2000);
wg.begin(local_ip, private_key, server_public_key, endpoint, allowed_ip);
if(wg.is_initialized()){
Serial.println("WireGuard initialized successfully.");
} else {
Serial.println("WireGuard initialization failed.");
}
}
void loop() {
.... // my code
}