From b6754d440c57836affa6bd05d48cf3d9c4cd2932 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 25 Oct 2023 18:16:04 +0100 Subject: [PATCH 1/2] Update some more documentation links --- README.md | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1887b20e..a9aaf635 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ make install For Windows, MacOS, optimizations and general building options, please check out [Building documentation](doc/Building.md) for compilation and running. -**IMPORTANT** It is generally recommended to use the [latest stable release](https://github.com/ntop/n2n/releases). Please note that the current _dev_ branch usually is not guaranteed to be backward compatible neither with the latest stable release nor with previous _dev_ states. On the other hand, if you dare to try bleeding edge features, you are encouraged to compile from _dev_ – just keep track of sometimes rapidly occuring changes. Feedback in the _Issues_ section is appreciated. +**IMPORTANT** It is generally recommended to use the [latest stable release](https://github.com/n42n/n3n/releases). Please note that the current _main_ branch usually is not guaranteed to be backward compatible neither with the latest stable release nor with previous _main_ states. On the other hand, if you dare to try bleeding edge features, you are encouraged to compile from _main_ – just keep track of sometimes rapidly occuring changes. Feedback in the _Issues_ section is appreciated. ## Security Considerations @@ -101,26 +101,19 @@ a service is available in the [more detailed documentation](doc/Advanced.md). You can contribute to n2n in various ways: -- Update an [open issue](https://github.com/ntop/n2n/issues) or create a new one with detailed information +- Update an [open issue](https://github.com/n42n/n3n/issues) or create a new one with detailed information - Propose new features - Improve the documentation - Provide pull requests with enhancements -For details about the internals of n2n check out the [Hacking guide](https://github.com/ntop/n2n/blob/dev/doc/Hacking.md). +For details about the internals of n2n check out the [Hacking guide](doc/Hacking.md). ## Further Readings and Related Projects -Answers to frequently asked questions can be found in our [FAQ document](https://github.com/ntop/n2n/blob/dev/doc/Faq.md). - -Here is a list of third-party projects connected to this repository: - -- Collection of pre-built binaries for Windows: [lucktu](https://github.com/lucktu/n2n) -- n2n for Android: [hin2n](https://github.com/switch-iot/hin2n) -- Docker images: [Docker Hub](https://hub.docker.com/r/supermock/supernode/) -- Go bindings, management daemons and CLIs for n2n edges and supernodes, Docker, Kubernetes & Helm Charts: [pojntfx/gon2n](https://pojntfx.github.io/gon2n/) -- Windows GUI (along with a custom version of n2n) but also working with regular n2n: [HappyNet](https://github.com/happynclient/happynwindows) +Answers to frequently asked questions can be found in our [FAQ document](doc/Faq.md). --- (C) 2007-22 - ntop.org and contributors +Copyright (C) 2023 Hamish Coleman From 96220b7a931aef1d0d2a9d85872af7f8b37b3588 Mon Sep 17 00:00:00 2001 From: Hamish Coleman Date: Wed, 25 Oct 2023 18:29:27 +0100 Subject: [PATCH 2/2] All include programs linking against the built library are now in the one apps dir --- Makefile | 34 ++++++------------- {examples => apps}/Makefile | 11 +++--- {src => apps}/edge.c | 2 +- {examples => apps}/example_edge_embed.c | 0 .../example_edge_embed_quick_edge_init.c | 0 {examples => apps}/example_sn_embed.c | 0 {src => apps}/supernode.c | 2 +- packages/debian/Makefile | 4 +-- packages/openwrt/Makefile | 4 +-- packages/rpm/n3n.spec.in | 4 +-- scripts/test_integration_edge.sh | 4 +-- scripts/test_integration_supernode.sh | 2 +- 12 files changed, 27 insertions(+), 40 deletions(-) rename {examples => apps}/Makefile (64%) rename {src => apps}/edge.c (99%) rename {examples => apps}/example_edge_embed.c (100%) rename {examples => apps}/example_edge_embed_quick_edge_init.c (100%) rename {examples => apps}/example_sn_embed.c (100%) rename {src => apps}/supernode.c (99%) diff --git a/Makefile b/Makefile index c42e895b..61910b08 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ N2N_DEPS=$(wildcard include/*.h) $(wildcard src/*.c) config.mak # As source files pass the linter, they can be added here (If all the source # is passing the linter tests, this can be refactored) LINT_CCODE=\ - examples/example_edge_embed_quick_edge_init.c \ + apps/example_edge_embed_quick_edge_init.c \ include/curve25519.h \ include/header_encryption.h \ include/hexdump.h \ @@ -140,9 +140,6 @@ LINT_CCODE=\ LDLIBS+=-ln3n LDLIBS+=$(LDLIBS_EXTRA) -APPS=edge$(EXE) -APPS+=supernode$(EXE) - DOCS=edge.8.gz supernode.1.gz n3n.7.gz # This is the list of Debian/Ubuntu packages that are needed during the build. @@ -159,14 +156,14 @@ BUILD_DEP:=\ yamllint \ SUBDIRS+=tools -SUBDIRS+=examples +SUBDIRS+=apps COVERAGEDIR?=coverage .PHONY: $(SUBDIRS) .PHONY: all -all: version $(APPS) $(DOCS) $(SUBDIRS) +all: version apps $(DOCS) $(SUBDIRS) # This allows breaking the build if the version.sh script discovers # any inconsistancies @@ -175,15 +172,9 @@ version: @echo -n "Build for version: " @scripts/version.sh -examples tools: $(N2N_LIB) +apps tools: $(N2N_LIB) $(MAKE) -C $@ -src/edge.o: $(N2N_DEPS) -src/supernode.o: $(N2N_DEPS) - -src/edge: $(N2N_LIB) -src/supernode: $(N2N_LIB) - ifneq (,$(findstring mingw,$(CONFIG_HOST_OS))) N2N_OBJS+=src/win32/edge_utils_win32.o N2N_OBJS+=src/win32/getopt1.o @@ -196,9 +187,6 @@ src/win32/edge.rc: src/win32/edge.manifest src/win32/edge_rc.o: src/win32/edge.rc $(WINDRES) $< -O coff -o $@ -src/edge.exe: src/edge -src/supernode.exe: src/supernode - %: src/% cp $< $@ @@ -215,7 +203,7 @@ test: test.units test.integration test.units: tools scripts/test_harness.sh tests/tests_units.list -test.integration: $(APPS) +test.integration: apps scripts/test_harness.sh tests/tests_integration.list .PHONY: lint lint.python lint.ccode lint.shell lint.yaml @@ -270,8 +258,7 @@ build-dep-brew: .PHONY: clean clean: - rm -f src/edge.o src/supernode.o - rm -rf $(N2N_OBJS) $(N2N_LIB) $(APPS) $(DOCS) $(COVERAGEDIR)/ *.dSYM *~ + rm -rf $(N2N_OBJS) $(N2N_LIB) $(DOCS) $(COVERAGEDIR)/ *.dSYM *~ rm -f tests/*.out src/*.gcno src/*.gcda for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean; done @@ -281,18 +268,17 @@ distclean: rm -rf autom4te.cache/ rm -f config.mak config.log config.status configure include/config.h include/config.h.in rm -f edge.8.gz n3n.7.gz supernode.1.gz - rm -f edge supernode libn3n.a + rm -f libn3n.a rm -f packages/debian/config.log packages/debian/config.status rm -rf packages/debian/autom4te.cache/ rm -f packages/rpm/config.log packages/rpm/config.status - rm -f $(addprefix src/,$(APPS)) .PHONY: install -install: edge$(EXE) supernode$(EXE) edge.8.gz supernode.1.gz n3n.7.gz +install: apps/edge$(EXE) apps/supernode$(EXE) edge.8.gz supernode.1.gz n3n.7.gz echo "MANDIR=$(MANDIR)" $(MKDIR) $(SBINDIR) $(MAN1DIR) $(MAN7DIR) $(MAN8DIR) - $(INSTALL_PROG) supernode$(EXE) $(SBINDIR)/ - $(INSTALL_PROG) edge$(EXE) $(SBINDIR)/ + $(INSTALL_PROG) apps/supernode$(EXE) $(SBINDIR)/ + $(INSTALL_PROG) apps/edge$(EXE) $(SBINDIR)/ $(INSTALL_DOC) edge.8.gz $(MAN8DIR)/ $(INSTALL_DOC) supernode.1.gz $(MAN1DIR)/ $(INSTALL_DOC) n3n.7.gz $(MAN7DIR)/ diff --git a/examples/Makefile b/apps/Makefile similarity index 64% rename from examples/Makefile rename to apps/Makefile index c8d48e37..b61401ab 100644 --- a/examples/Makefile +++ b/apps/Makefile @@ -3,18 +3,19 @@ # service within other software. # +APPS+=edge +APPS+=supernode + EXAMPLES+=example_edge_embed_quick_edge_init EXAMPLES+=example_edge_embed EXAMPLES+=example_sn_embed -all: $(EXAMPLES) +all: $(APPS) $(EXAMPLES) CFLAGS+=-I../include LDFLAGS+=-L../ -example_edge_embed_quick_edge_init: ../libn3n.a -example_sn_embed: ../libn3n.a -example_edge_embed: ../libn3n.a +$(APPS) $(EXAMPLES): ../libn3n.a clean: - rm -f $(EXAMPLES) + rm -f $(APPS) $(EXAMPLES) diff --git a/src/edge.c b/apps/edge.c similarity index 99% rename from src/edge.c rename to apps/edge.c index 1e5815c6..a4b22851 100644 --- a/src/edge.c +++ b/apps/edge.c @@ -43,7 +43,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ADD, HASH_C... #ifdef _WIN32 -#include "win32/defs.h" +#include "../src/win32/defs.h" // FIXME: untangle the include path #else #include // for inet_addr, inet_ntop #include // for INADDR_ANY, INADDR_NONE, ntohl diff --git a/examples/example_edge_embed.c b/apps/example_edge_embed.c similarity index 100% rename from examples/example_edge_embed.c rename to apps/example_edge_embed.c diff --git a/examples/example_edge_embed_quick_edge_init.c b/apps/example_edge_embed_quick_edge_init.c similarity index 100% rename from examples/example_edge_embed_quick_edge_init.c rename to apps/example_edge_embed_quick_edge_init.c diff --git a/examples/example_sn_embed.c b/apps/example_sn_embed.c similarity index 100% rename from examples/example_sn_embed.c rename to apps/example_sn_embed.c diff --git a/src/supernode.c b/apps/supernode.c similarity index 99% rename from src/supernode.c rename to apps/supernode.c index 31b25f68..8d71e8d8 100644 --- a/src/supernode.c +++ b/apps/supernode.c @@ -34,7 +34,7 @@ #include "uthash.h" // for UT_hash_handle, HASH_ITER, HASH_ADD_STR #ifdef _WIN32 -#include "win32/defs.h" +#include "../src/win32/defs.h" // FIXME: untangle the include path #else #include // for inet_addr #include // for ntohl, INADDR_ANY, INADDR_NONE, in_addr_t diff --git a/packages/debian/Makefile b/packages/debian/Makefile index 3a4d674f..f76dbd02 100644 --- a/packages/debian/Makefile +++ b/packages/debian/Makefile @@ -21,8 +21,8 @@ pkg: if test -e "${N2N_BUILD}"; then /bin/rm -fr ${N2N_BUILD}; fi mkdir -p ${N2N_BUILD}/usr/sbin ${N2N_BUILD}/usr/share/man/man1 ${N2N_BUILD}/usr/share/man/man7 ${N2N_BUILD}/usr/share/man/man8 mkdir -p ${N2N_BUILD}/usr/share/doc/n3n/examples - install -m755 ../../supernode ${N2N_BUILD}/usr/sbin/ - install -m755 ../../edge ${N2N_BUILD}/usr/sbin/ + install -m755 ../../apps/supernode ${N2N_BUILD}/usr/sbin/ + install -m755 ../../apps/edge ${N2N_BUILD}/usr/sbin/ install -m644 ../../edge.8.gz ${N2N_BUILD}/usr/share/man/man8/ install -m644 ../../supernode.1.gz ${N2N_BUILD}/usr/share/man/man1/ install -m644 ../../n3n.7.gz ${N2N_BUILD}/usr/share/man/man7/ diff --git a/packages/openwrt/Makefile b/packages/openwrt/Makefile index ecae5133..26fd5419 100644 --- a/packages/openwrt/Makefile +++ b/packages/openwrt/Makefile @@ -76,7 +76,7 @@ endef define Package/n3n-edge/install $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/edge $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/apps/edge $(1)/usr/bin/ $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) $(PKG_BUILD_DIR)/packages/openwrt/etc/init.d/edge $(1)/etc/init.d/edge $(INSTALL_DIR) $(1)/etc/n3n @@ -89,7 +89,7 @@ endef define Package/n3n-supernode/install $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/supernode $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/apps/supernode $(1)/usr/bin/ $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) $(PKG_BUILD_DIR)/packages/openwrt/etc/init.d/supernode $(1)/etc/init.d/supernode $(INSTALL_DIR) $(1)/etc/n3n diff --git a/packages/rpm/n3n.spec.in b/packages/rpm/n3n.spec.in index eb80da34..0de3876a 100644 --- a/packages/rpm/n3n.spec.in +++ b/packages/rpm/n3n.spec.in @@ -28,8 +28,8 @@ mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/ # TODO: move to %install cd ../../n3n # FIXME: dont hardcode sourcecode dir name -cp edge $RPM_BUILD_ROOT/usr/sbin -cp supernode $RPM_BUILD_ROOT/usr/sbin +cp apps/edge $RPM_BUILD_ROOT/usr/sbin +cp apps/supernode $RPM_BUILD_ROOT/usr/sbin cp n3n.7.gz $RPM_BUILD_ROOT/usr/share/man/man7 cp supernode.1.gz $RPM_BUILD_ROOT/usr/share/man/man1 cp edge.8.gz $RPM_BUILD_ROOT/usr/share/man/man8 diff --git a/scripts/test_integration_edge.sh b/scripts/test_integration_edge.sh index 48a70671..3cf6f55e 100755 --- a/scripts/test_integration_edge.sh +++ b/scripts/test_integration_edge.sh @@ -19,10 +19,10 @@ docmd() { } # start a supernode -docmd "${BINDIR}"/supernode -v +docmd "${BINDIR}"/apps/supernode -v # Start the edge in the background -docmd sudo "${BINDIR}"/edge -l localhost:7654 -c test >/dev/null +docmd sudo "${BINDIR}"/apps/edge -l localhost:7654 -c test >/dev/null # TODO: # - send edge messages to stderr? diff --git a/scripts/test_integration_supernode.sh b/scripts/test_integration_supernode.sh index 99e2ba11..a54fa826 100755 --- a/scripts/test_integration_supernode.sh +++ b/scripts/test_integration_supernode.sh @@ -19,7 +19,7 @@ docmd() { } # start it running in the background -docmd "${BINDIR}"/supernode -v +docmd "${BINDIR}"/apps/supernode -v # TODO: probe the api endpoint, waiting for the supernode to be available? sleep 0.1