From bd285d9908adbbc7cf1ea1d16342014392e3d75a Mon Sep 17 00:00:00 2001
From: Martin Weinelt <martin@darmstadt.freifunk.net>
Date: Tue, 12 Apr 2022 20:26:12 +0200
Subject: [PATCH 1/2] gluon-mesh-vpn-fastd: Expose negotiated method

---
 package/gluon-mesh-vpn-fastd/src/respondd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/package/gluon-mesh-vpn-fastd/src/respondd.c b/package/gluon-mesh-vpn-fastd/src/respondd.c
index a7237216..410bfac2 100644
--- a/package/gluon-mesh-vpn-fastd/src/respondd.c
+++ b/package/gluon-mesh-vpn-fastd/src/respondd.c
@@ -217,7 +217,7 @@ static bool get_peer_connection(struct json_object **ret, struct json_object *co
 	if (!key)
 		return false;
 
-	struct json_object *peer, *connection, *established;
+	struct json_object *peer, *connection, *established, *method;
 	if (!json_object_object_get_ex(peers, key, &peer) ||
 			!json_object_object_get_ex(peer, "connection", &connection))
 		return false;
@@ -229,6 +229,10 @@ static bool get_peer_connection(struct json_object **ret, struct json_object *co
 		struct json_object *jso = json_object_new_double(established_time/1000.0);
 		json_object_set_serializer(jso, json_object_double_to_json_string, "%.3f", NULL);
 		json_object_object_add(*ret, "established", jso);
+
+		if (json_object_object_get_ex(connection, "method", &method)) {
+			json_object_object_add(*ret, "method", json_object_get(method));
+		}
 	}
 	else {
 		*ret = NULL;

From 726f02ba9d86a839c703813c36dea0abf2a261ab Mon Sep 17 00:00:00 2001
From: Martin Weinelt <martin@darmstadt.freifunk.net>
Date: Tue, 12 Apr 2022 20:37:31 +0200
Subject: [PATCH 2/2] gluon-status-page: Expose method for VPN peers

---
 package/gluon-status-page/javascript/status-page.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/gluon-status-page/javascript/status-page.js b/package/gluon-status-page/javascript/status-page.js
index 016e20ee..39cbf3f9 100644
--- a/package/gluon-status-page/javascript/status-page.js
+++ b/package/gluon-status-page/javascript/status-page.js
@@ -210,7 +210,8 @@
 
 			var td = document.createElement('td');
 			if (peer[1] && peer[1].established != null)
-				td.textContent = _['connected'] + ' (' + formats.time(peer[1].established) + ')';
+				const method = peer[1].method ? ', ' + peer[1].method : '';
+				td.textContent = _['connected'] + ' (' + formats.time(peer[1].established) + method + ')';
 			else
 				td.textContent = _['not connected'];
 			tr.appendChild(td);