ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.28k stars 943 forks source link

Add some JSON interfaces to the edge management port #854

Closed hamishcoleman closed 3 years ago

hamishcoleman commented 3 years ago

This allows a couple of things:

codecov-commenter commented 3 years ago

Codecov Report

Merging #854 (e97e976) into dev (1670b14) will decrease coverage by 0.13%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #854      +/-   ##
==========================================
- Coverage   18.96%   18.83%   -0.14%     
==========================================
  Files          39       39              
  Lines        8247     8305      +58     
==========================================
  Hits         1564     1564              
- Misses       6683     6741      +58     
Impacted Files Coverage Δ
src/edge_utils.c 1.04% <0.00%> (-0.04%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1670b14...e97e976. Read the comment docs.

Logan007 commented 3 years ago

What a wonderful idea!

As you brought up json, I would like to reveal an idea we were pondering for a while. We have actually been thinking of implementing a tiny http-server for management port output maybe also allowing to make some settings, such as a reload_communities button (instead of command to management port), or verb+ or verb-...

Do you know if there is some simple java script delivered along with the json data in an html-doc and which can make the json data be displayed in a nice way?

Oh, and let me know when I can merge this PR.

hamishcoleman commented 3 years ago

I imagine that having a small webserver would help a lot of people who cannot or do not want to use netcat :-) - it does run the risk of adding feature bloat to the core.

Javascript is not my usual playground, but the simple python logic I have used in my str_table() should be easily portable to javascript (and there would be a zillion heavier-weight options floating around the net)

You can merge this PR

hamishcoleman commented 3 years ago

@Logan007 As an alternative to embedding a http server in the edge process, I've added a simple http gateway server to this commit.

Logan007 commented 3 years ago

WOW! :open_mouth:

Thank you so much!