Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ciniml/WireGuard-ESP32-Arduino
WireGuard implementation for ESP32 Arduino
https://github.com/ciniml/WireGuard-ESP32-Arduino
Last synced: 3 months ago
JSON representation
WireGuard implementation for ESP32 Arduino
- Host: GitHub
- URL: https://github.com/ciniml/WireGuard-ESP32-Arduino
- Owner: ciniml
- License: other
- Created: 2021-07-18T19:14:08.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T13:57:36.000Z (7 months ago)
- Last Synced: 2024-05-27T21:43:41.451Z (5 months ago)
- Language: C
- Size: 74.2 KB
- Stars: 770
- Watchers: 18
- Forks: 61
- Open Issues: 29
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-wireguard - ciniml/WireGuard-ESP32-Arduino - WireGuard implementation for ESP32 Arduino in C. (Projects / Alternative Implementations)
README
# WireGuard Implementation for ESP32 Arduino
This is an implementation of the [WireGuard®](https://www.wireguard.com/) for ESP32 Arduino.
Almost all of this code is based on the [WireGuard Implementation for lwIP](https://github.com/smartalock/wireguard-lwip), but some potion of the code is adjusted to build with ESP32 Arduino.
## How to use
1. Include `WireGuard-ESP32.h` at the early part of the sketch.
```c++
#include
```2. Define the instance of the `WireGuard` class at module level.
```c++
static WireGuard wg;
```3. Connect to WiFi AP by using `WiFi` class.
```c++
WiFi.begin(ssid, password);
while( !WiFi.isConnected() ) {
delay(1000);
}
```4. Sync the system time via NTP.
```c++
configTime(9 * 60 * 60, 0, "ntp.jst.mfeed.ad.jp", "ntp.nict.jp", "time.google.com");
```5. Start the WireGuard interface.
```c++
wg.begin(
local_ip, // IP address of the local interface
private_key, // Private key of the local interface
endpoint_address, // Address of the endpoint peer.
public_key, // Public key of the endpoint peer.
endpoint_port); // Port pf the endpoint peer.
```You can see an example sketch `uptime_post.ino`, which connects SORACOM Arc WireGuard endpoint and post uptime to SORACOM Harvest via WireGuard connection.
## License
The original WireGuard implementation for lwIP is licensed under BSD 3 clause license so the code in this repository also licensed under the same license.
Original license is below:
The code is copyrighted under BSD 3 clause Copyright (c) 2021 Daniel Hope (www.floorsense.nz)
See LICENSE for details