Skip to content

Commit 9c0fa87

Browse files
committed
Update README
1 parent 2960351 commit 9c0fa87

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

README.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,52 @@
1-
# WireGuard Implementation for ESP-IDF
1+
# WireGuard Implementation for ESP32 Arduino
22

3-
This is an implementation of the [WireGuard®](https://www.wireguard.com/) for ESP-IDF.
3+
This is an implementation of the [WireGuard®](https://www.wireguard.com/) for ESP32 Arduino.
44

5-
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 ESP- to run on ESP32 devices.
5+
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.
66

7-
# License
7+
## How to use
8+
9+
1. Include `WireGuard.hpp` at the early part of the sketch.
10+
11+
```c++
12+
#include <WireGuard.hpp>
13+
```
14+
15+
2. Define the instance of the `WireGuard` class at module level.
16+
17+
```c++
18+
static WireGuard wg;
19+
```
20+
21+
3. Connect to WiFi AP by using `WiFi` class.
22+
23+
```c++
24+
WiFi.begin(ssid, password);
25+
while( !WiFi.isConnected() ) {
26+
delay(1000);
27+
}
28+
```
29+
30+
4. Sync the system time via NTP.
31+
32+
```c++
33+
configTime(9 * 60 * 60, 0, "ntp.jst.mfeed.ad.jp", "ntp.nict.jp", "time.google.com");
34+
```
35+
36+
5. Start the WireGuard interface.
37+
38+
```c++
39+
wg.begin(
40+
local_ip, // IP address of the local interface
41+
private_key, // Private key of the local interface
42+
endpoint_address, // Address of the endpoint peer.
43+
public_key, // Public key of the endpoint peer.
44+
endpoint_port); // Port pf the endpoint peer.
45+
```
46+
47+
You can see an example sketch `uptime_post.ino`, which connects SORACOM Arc WireGuard endpoint and post uptime to SORACOM Harvest via WireGuard connection.
48+
49+
## License
850

951
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.
1052

0 commit comments

Comments
 (0)