550 Commits
Author SHA1 Message Date
Hamish Coleman 26e3ad5377 Ah, standards, they are what windows lives to kill 2022-04-17 00:43:27 +01:00
Hamish Coleman a3fcc15472 Fix escaped extra brace 2022-04-17 00:32:01 +01:00
Hamish Coleman b98fd8552d Address lint issues 2022-04-17 00:29:18 +01:00
Hamish Coleman 71dbaf0bdc Refactor as much as possible of sn_management to use shared code 2022-04-17 00:25:04 +01:00
Hamish Coleman d81908d6a2 Move as much as simply possible from edge_management into shared code 2022-04-17 00:25:04 +01:00
Hamish Coleman 7590ed51d5 Factor out strbuf abstraction into its own header 2022-04-17 00:25:04 +01:00
Logan oos EvenandGitHub 5f60a6b333 made supernode ignore own registration attempts to allow unified configuration (command line-provided supernodes) of federated supernodes (#970) 2022-03-20 12:48:40 +01:00
Logan oos EvenandGitHub e686b9592c (C) update (#965) 2022-03-12 10:22:42 +01:00
Logan oos EvenandGitHub 19e1bf87c9 fixed sn sort return value (#936) 2022-03-03 23:22:32 +01:00
Logan oos EvenandGitHub f59c6900a1 moved compression code into transforms (#961) 2022-02-21 10:09:06 +01:00
Hamish ColemanandGitHub 4b8aaa7f6e Merge pull request #947 from hamishcoleman/json_pubsub
Add JSON pubsub framework for edge
2022-02-12 10:59:52 +00:00
Logan oos EvenandGitHub cbad152994 limited federation broadcast to active supernodes only (#958) 2022-02-12 11:35:22 +01:00
Hamish Coleman aab0d508df Ensure an error is generated when compiling with invalid options 2022-02-11 21:23:34 +00:00
Hamish Coleman 30a5694cfe Ensure definitions are included before ifdef
Addresses issue raised in (#934)
2022-02-10 07:51:17 +00:00
Hamish Coleman 017f1cf60e Address lint issues 2022-02-05 20:06:31 +00:00
Hamish Coleman 860b27d97c Add event publishing for adding and removing P2P peers 2022-02-05 20:06:31 +00:00
Hamish Coleman a40ed15d93 Add pubsub system to edge, with one example TEST channel 2022-02-05 20:06:31 +00:00
Hamish Coleman 509a8bcd14 Add a buffer object with a known size field to replace multiple hardcoded N2N_PKT_BUF_SIZE 2022-02-05 20:06:31 +00:00
Hamish Coleman 598ce63981 Use getnameinfo to show the subscribed socket details 2022-02-05 20:06:31 +00:00
Hamish Coleman 9c77d0becd Address warning 2022-02-05 20:06:31 +00:00
Hamish Coleman 58fedeed95 Add a helper for simple 1 arg json replies 2022-02-05 20:06:31 +00:00
Hamish Coleman 64e5329bca Refactor command handler lookup into a macro for reuse in the topic lookup 2022-02-05 20:06:31 +00:00
Hamish Coleman e2a33b7571 Implement initial help command for subscription topics 2022-02-05 20:06:31 +00:00
Hamish Coleman 3fd1dc5fa8 keep private enum definition local to the management code 2022-02-05 20:06:31 +00:00
Hamish Coleman e3899d1b76 Give a magic number a better name 2022-02-05 20:06:31 +00:00
Hamish Coleman 06b8f1a08f Refactor management command list to allow it to be declared const with no warnings 2022-02-05 20:06:31 +00:00
Hamish Coleman 3e2c2d63bc Add basic structures to be used for pubsub 2022-02-05 20:06:31 +00:00
Hamish Coleman 40773b4e4d Ensure we have a local copy of the tag in our request structure - which will be useful for the event framework 2022-02-05 20:06:31 +00:00
Hamish Coleman 35c83a0825 Simplify edge mgmt handling by building a request structure and using it for replies 2022-02-05 20:06:31 +00:00
Hamish Coleman 6e4cf85915 As we are in our own namespace, we can ditch the n2n_ prefix to some definitions 2022-02-05 20:06:31 +00:00
Hamish Coleman ace3dbc44f Move all supernode management handling into one source file 2022-02-05 20:06:31 +00:00
Hamish Coleman a8e2704b41 Move all management packet handling for edge into the one source file 2022-02-05 20:06:31 +00:00
Hamish Coleman 3713d357c8 Document the tricky code - TODO, make it less tricky 2022-02-05 20:06:31 +00:00
Hamish Coleman 954547a9c1 Remove the only obstacle that stopped running the supernode as a normal user 2022-02-05 20:06:31 +00:00
Hamish ColemanandGitHub 4f568b03c1 Autoconf simplification (#927)
* Convert zstd feature to default disable

* All autoconf test use one standard template

To simplify the testing, cross-compilation and repeatable build process,
no configure options are automatically probed for - they all default to
off and are all using the same template.

The --with-x options should be deprecated and replaced with --enable-x
because there is no syntax checking for --with options in autoconf.

There are still some differences between the config options, but this
should provide a starting point.

* Remove unused code from the autoconf

* Remove warnings from default build

* Avoid calling port mapping functions if none are enabled

* Start with all builds in neutral config

* Add more missing code guards

* Adjust code guard location to placate cmake
2022-01-10 19:58:15 +00:00
Hamish ColemanandGitHub da9ba27b0a Minor build document improvments (#926)
* Improve some build documentation

* Address build failure
2022-01-09 18:07:29 +00:00
fengdaolongandGitHub 2378ea0be2 simplified the path in the log (#910) 2021-12-24 20:56:35 +01:00
e6e8cb038a added port forwarding (upnp and natpmp) (#905)
* UPnP port redirection is supported.

* compile fixes

* compile fix

* optimize reconnection code

* prepared upnp threadification to counter main loop stall at supernode change

* NAT-PMP port forwarding support, temporarily merge codes to resolve conflicts.

* make compile fix

* prepared threadification in more detail

* adopted threadification to new file setup

* cleaned up

* renamed functions and data structures

* fixes

* differentiated between miniupnp and natpmp and added corresponding lib support to makefile

* name

* commented unused header includes

* comments

* license

* fixes

* fixes

* fixes

* NAT-PMP is already available.

* added CLI parameter to disable port forwarding if required

* preliminary made use of multithreading

* adjusted log level

* added man page documentation

* def'ed conf

* made pmpnat adjustments

Co-authored-by: fengdaolong <fengdaolong@gmail.com>
2021-12-23 12:27:55 +01:00
Logan oos EvenandGitHub c5f9e8198b had the edge output supernode version to log on incoming PONG (#894) 2021-11-07 16:53:01 +05:45
Hamish Coleman 00a2bdc307 Remove all use of N2N_VERSION_SHORT in favor of PACKAGE_VERSION 2021-11-01 19:15:23 +00:00
Hamish Coleman a9216f1097 Remove GIT_RELEASE variable and use the semantically identical N2N_VERSION instead 2021-11-01 19:15:23 +00:00
Logan oos EvenandGitHub 81bd79a82a assured correct supernode MAC address properties (#888) 2021-11-02 00:01:44 +05:45
Logan oos EvenandGitHub e0a9bb95fc differentiated between 'active' and 'standby' in sn-selection-by-mac mode (#887) 2021-11-01 23:31:03 +05:45
Logan oos EvenandGitHub f4e7e513a8 added MAC address based supernode selection (#885) 2021-11-01 16:35:05 +05:45
Logan oos EvenandGitHub ecff46a043 applied tiny optimization to PACKET's code path (#882) 2021-10-31 22:38:56 +05:45
Logan oos EvenandGitHub 3b187b4ac8 updated JSON API password handling '--management-password <pw>' (#869) 2021-10-24 15:22:36 +05:45
Logan oos EvenandGitHub c61b62ab1b choose supernode selection strategy at run-time '--select-rtt' (#864) 2021-10-24 12:53:25 +05:45
Hamish ColemanandGitHub 7b7449c813 Minor JSON field name fixes and additions (#865)
* Change JSON supernodes field to match the struct member name

* Add some missing fields to the edge json output.
2021-10-24 04:05:36 +05:45
Hamish ColemanandGitHub 80b33cd1a9 Basic C Code lint checker and shell checker (#859)
* Factor build packages out into a more maintainable list

* Create a location for scripts to live

* Provide a make target to return the source dir as close as reasonable to the original distributed state

* Add a code lint step, checking the coding style

* Change test harness as recommended by shellcheck

* Ensure we actually have the linter tool installed

* Use the correct directory for cmake to run the tests

* Adjust for the older uncrustify in the current github ubuntu-latest

* Make one file pass the linter

* Integrate the lint with the existing test workflow

* Add files with minimal changes needed to the linter

* Add more files with minimal changes needed to the linter

* Dont build binaries if we fail the lint test

* Update the phony targets with the lint steps

* Ensure the flake8 package is installed in the new lint workflow job

* Use the makefile to drive the packages needed to install for linting

* No need to add dependancies on lint, just rely on the workflow status to show failure

* Update the scripts dir README to reflect current assumptions

* Rename and briefly document the indent.sh script

* Fix the ignore to ignore the right Makefile

* Rename the test_harness script to make it clear it is a shell script

* Provide a master lint make target and add a shell script lint tool

* Elminate stray tabs

* Drop include/auth.h from linter - there are inconsistant results with function definitions when using the current uncrustify rules
2021-10-24 01:21:18 +05:45
Hamish ColemanandGitHub ae502d9181 JSON Reply Management API - feature parity with old management interfaces (#861)
* Ensure that recent code additions pass the linter

* Include some of the more obviously correct lint fixes to edge_utils.c

* Refactor edge JSON api into its own source file

* Use shorter names for static management functions

* Implement a JSON RPC way of managing the verbosity

* Tidy up help display in n2nctl script

* Make note of issue with implementing the stop command

* Implement a JSON RPC call to fetch current community

* Make n2nhttpd time value be more self-contained

* Make n2nhttpd order more closely match the existing management stats output

* Wire up status page to the verbosity setting

* Add JSON versions of the remainder of the edge management stats

* Add new file to cmake

* Properly define management handler

* Only update the last updated timestamp after a successful data fetch

* Function and types definition cleanup

* Force correct type for python scripts mgmt port

* Implement initial JSON API for supernode

* Fix whitespace error

* Use helper function for rendering peers ip4 address

* Proxy the auth requirement back out to the http client, allowing normal http auth to be used

* Ensure that we do not leak the federation community

* Use the same rpc method name and output for both edge and supernode for peers/edges

* Allow n2nctl to show raw data returned without resorting to tricks

* Make n2nctl pretty printer understandable with an empty table

* Use the full name for supernodes RPC call

* Use same RPC method name (but some missing fields) for getting communities from both edge and supernode

* Add *_sup_broadcast stats to edge packet stats output

* Refacter the stats into a packetstats method for supernode RPC

* Even if I am not going to prettyprint the timestamps, at least make all the timestamps on the page the same unit

* Simplify the RPC handlers by flagging some as writable and checking that in the multiplexer

* Remove invalid edges data

* Avoid crash on bad data to verbose RPC

* Avoid showing bad or inconsistant protocol data in communities RPC

* Minor clarification on when --write is handled

* Make linter happy

* Fix changed method name in n2nhttpd

* Move mainloop stop flag into the n2n_edge_t structure, allowing access from management commands

* Implement edge RPC stop command

* Move mainloop stop flag into the n2n_sn_t structure, allowing access from management commands

* Implement supernode RPC stop command

* Allow multiple pages to be served from mini httpd

* Extract common script functions into a separate URL

* Handle an edge case in the python rpc class

With a proper tag-based demultiplexer, this case should be a nop,
but we are single-threaded and rely on the packet ordering in this
library.

* Add n2nhttpd support to query supernode using urls prefixed with /supernode/

* Handle missing values in javascript table print

* Add another less filtering javascript key/value renderer

* Add a supernode.html page to the n2nhttpd

* Address lint issue

* Mention the second html page on the Scripts doc

* Remove purgable column from supernode edges list - it looks like it is rarely going to be set

* Add a simple one-line example command at the top of the API documentation

* Acknowledge that this is not the most efficient protocol, but point out that it was not supposed to be

* Make it clear that the n2nctl script works for both edge and supernode

* Fight with inconsistant github runner results

* Turn off the /right/ coverage generator
2021-10-23 11:05:05 +05:45