Started adding Wireguard support
This commit is contained in:
parent
eaf5cdfc8d
commit
bd15b524fb
13
src/main.ino
13
src/main.ino
@ -12,6 +12,7 @@
|
|||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <WiFiClientSecure.h>
|
#include <WiFiClientSecure.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
#include <WireGuard-ESP32.h>
|
||||||
|
|
||||||
// Local includes
|
// Local includes
|
||||||
#include "bootScreen.h"
|
#include "bootScreen.h"
|
||||||
@ -81,6 +82,9 @@ bool readyToJoinChannel = false;
|
|||||||
bool screenOn = true;
|
bool screenOn = true;
|
||||||
int selectedNetworkIndex = 0;
|
int selectedNetworkIndex = 0;
|
||||||
|
|
||||||
|
static WireGuard wg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Main functions ---------------------------------------------------------------------------------
|
// Main functions ---------------------------------------------------------------------------------
|
||||||
void displayXBM() {
|
void displayXBM() {
|
||||||
@ -110,6 +114,13 @@ void displayXBM() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wgConnect(const IPAddress& localIp, const char* privateKey, const char* endpointAddress, const char* publicKey, uint16_t endpointPort) {
|
||||||
|
//IPAddress localIp(192, 168, 1, 100);
|
||||||
|
//IPAddress endpointIp(192, 168, 1, 1);
|
||||||
|
wg.begin(localIp, privateKey, endpointAddress, publicKey, endpointPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Initialize serial communication
|
// Initialize serial communication
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
@ -830,7 +841,7 @@ void turnOnScreen() {
|
|||||||
|
|
||||||
void updateTimeFromNTP() {
|
void updateTimeFromNTP() {
|
||||||
Serial.println("Syncing time with NTP server...");
|
Serial.println("Syncing time with NTP server...");
|
||||||
configTime(-5 * 3600, 0, "pool.ntp.org", "time.nist.gov");
|
configTime(-5 * 3600, 3600, "pool.ntp.org", "north-america.pool.ntp.org", "time.nist.gov");
|
||||||
|
|
||||||
for (int i = 0; i < 10; ++i) { // Try up to 10 times
|
for (int i = 0; i < 10; ++i) { // Try up to 10 times
|
||||||
delay(2000);
|
delay(2000);
|
||||||
|
Loading…
Reference in New Issue
Block a user