Skip to content

Commit 01dba8d

Browse files
committed
samples: net: http-server: Add Wireguard VPN support
Add Wireguard configuration to http-server application. Signed-off-by: Jukka Rissanen <[email protected]>
1 parent ae9581d commit 01dba8d

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

samples/net/sockets/http_server/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ set(gen_dir ${ZEPHYR_BINARY_DIR}/include/generated/)
4343
target_sources_ifdef(CONFIG_NET_SAMPLE_WEBSOCKET_SERVICE app PRIVATE src/ws.c)
4444
target_sources_ifdef(CONFIG_USB_DEVICE_STACK app PRIVATE src/usb.c)
4545

46+
include(${ZEPHYR_BASE}/samples/net/common/common.cmake)
47+
4648
target_link_libraries(app PRIVATE zephyr_interface zephyr)
4749

4850
zephyr_linker_sources(SECTIONS sections-rom.ld)

samples/net/sockets/http_server/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,5 @@ config NET_SAMPLE_WEBSOCKET_STATS_INTERVAL
6969
This interval controls how often the net stats data shown on the web page
7070
will be updated.
7171

72+
source "samples/net/common/Kconfig"
7273
source "Kconfig.zephyr"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# First VPN interface will use these settings
2+
CONFIG_NET_SAMPLE_COMMON_VPN_PEER_IP_ADDR="192.0.2.2"
3+
CONFIG_NET_SAMPLE_COMMON_VPN_MY_ADDR="198.51.100.1/24"
4+
CONFIG_NET_SAMPLE_COMMON_VPN_ALLOWED_PEER_ADDR="192.0.2.0/24,2001:db8::/64,198.51.100.0/24"
5+
CONFIG_NET_SAMPLE_COMMON_VPN_MY_PRIVATE_KEY="lmAIbJR8PQOpgJxmfOydBiDbexTMEKsjglZ1sj3kIjs="

samples/net/sockets/http_server/src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <zephyr/sys/util_macro.h>
2222

2323
#include "ws.h"
24+
#include "net_sample_common.h"
2425

2526
#include <zephyr/logging/log.h>
2627
LOG_MODULE_REGISTER(net_http_server_sample, LOG_LEVEL_DBG);
@@ -359,6 +360,7 @@ static inline int init_usb(void)
359360
int main(void)
360361
{
361362
init_usb();
363+
init_vpn();
362364

363365
setup_tls();
364366
http_server_start();

0 commit comments

Comments
 (0)