n2n/doc/Scripts.md
Hamish Coleman 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

1.6 KiB

Scripts

There are a number of useful scripts included with the distribution. Some of these scripts are only useful during build and development, but other scripts are intended for end users to be able to use. These scripts may be installed with n2n as part of your operating system package.

Short descriptions of these scripts are below.

scripts/hack_fakeautoconf

This shell script is used during development to help build on Windows systems. An example of how to use it is shown in the Building document

scripts/indent.sh

This shell script is a wrapper for the uncrustify C code style checker which checks or applies a set of rules to the code. It is used during the automated lint checks.

scripts/test_harness.sh

This shell script is used to run automated tests during development.

scripts/n2nctl

This python script provides an easy command line interface to the running n2n processes. It uses UDP communications to talk to the Management API. By specifying the right UDP port, it can talk to both the edge and the supernode daemons.

Example:

  • scripts/n2nctl --help
  • scripts/n2nctl help

scripts/n2nhttpd

This python script is a simple http gateway to the running edge. It provides a proxy for REST-like HTTP requests to talk to the Management API.

By default it runs on port 8080.

It also provides a simple HTML page showing some edge information, which when run with default settings can be seen at http://localhost:8080/ (Also a http://localhost:8080/supernode.html page for the supernode)

Example:

  • scripts/n2nhttpd --help
  • scripts/n2nhttpd 8087