MCPcopy Index your code
hub / github.com/ciniml/WireGuard-ESP32-Arduino

github.com/ciniml/WireGuard-ESP32-Arduino @0.1.5

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.1.5 ↗ · + Follow
191 symbols 568 edges 21 files 23 documented · 12%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

WireGuard Implementation for ESP32 Arduino

This is an implementation of the WireGuard® for ESP32 Arduino.

Almost all of this code is based on the WireGuard Implementation for 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.
#include <WireGuard-ESP32.h>
  1. Define the instance of the WireGuard class at module level.
static WireGuard wg;
  1. Connect to WiFi AP by using WiFi class.
WiFi.begin(ssid, password);
while( !WiFi.isConnected() ) {
    delay(1000);
}
  1. Sync the system time via NTP.
configTime(9 * 60 * 60, 0, "ntp.jst.mfeed.ad.jp", "ntp.nict.jp", "time.google.com");
  1. Start the WireGuard interface.
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

Core symbols most depended-on inside this repo

crypto_zero
called by 44
src/crypto.c
U8TO32
called by 14
src/crypto/refc/poly1305-donna-32.h
wireguard_mix_hash
called by 13
src/wireguard.c
mul1
called by 13
src/crypto/refc/x25519.c
wireguard_sys_now
called by 12
src/wireguard-platform.c
wireguard_expired
called by 12
src/wireguard.c
keypair_destroy
called by 12
src/wireguard.c
poly1305_update
called by 12
src/crypto/refc/poly1305-donna.c

Shape

Function 131
Class 57
Method 3

Languages

C80%
C++20%

Modules by API surface

src/wireguard.c51 symbols
src/wireguardif.c48 symbols
src/crypto/refc/x25519.c23 symbols
src/wireguard.h15 symbols
src/wireguard-platform.c9 symbols
src/WireGuard.cpp8 symbols
src/crypto/refc/chacha20poly1305.c7 symbols
src/crypto/refc/poly1305-donna-32.h6 symbols
src/crypto/refc/chacha20.c6 symbols
src/crypto/refc/blake2s.c5 symbols
src/wireguardif.h4 symbols
src/crypto/refc/x25519.h2 symbols

For agents

$ claude mcp add WireGuard-ESP32-Arduino \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact