]> Cypherpunks.ru repositories - nncp.git/commitdiff
Merge branch 'develop' v5.0.0
authorSergey Matveev <stargrave@stargrave.org>
Fri, 15 Nov 2019 16:56:34 +0000 (19:56 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 15 Nov 2019 16:56:34 +0000 (19:56 +0300)
100 files changed:
.gitmodules [deleted file]
BSDmakefile [deleted file]
GNUmakefile [deleted file]
Makefile [new file with mode: 0644]
README
README.RU
VERSION
common.mk [deleted file]
doc/Makefile
doc/about.ru.texi
doc/about.texi
doc/building.texi [new file with mode: 0644]
doc/bundles.texi
doc/call.texi
doc/cfg.texi
doc/cmds.texi
doc/comparison.ru.texi
doc/comparison.texi
doc/download.texi
doc/git-bundler.sh [new file with mode: 0755]
doc/index.texi
doc/install.texi
doc/integration.texi
doc/integrity.texi
doc/news.ru.texi
doc/news.texi
doc/pkt.texi
doc/platforms.texi [deleted file]
doc/sources.texi
doc/usecases.ru.texi
doc/usecases.texi
doc/warcer.sh
doc/wgeter.sh
makedist.sh
ports/nncp/Makefile
ports/nncp/files/nncp-caller.in
ports/nncp/files/nncp-daemon.in
ports/nncp/files/nncp-toss.in
ports/nncp/files/pkg-deinstall.in
ports/nncp/files/pkg-message.in
src/base32.go [moved from src/cypherpunks.ru/nncp/base32.go with 100% similarity]
src/call.go [moved from src/cypherpunks.ru/nncp/call.go with 91% similarity]
src/cfg.go [moved from src/cypherpunks.ru/nncp/cfg.go with 68% similarity]
src/check.go [moved from src/cypherpunks.ru/nncp/check.go with 94% similarity]
src/chunked.go [moved from src/cypherpunks.ru/nncp/chunked.go with 90% similarity]
src/cmd/nncp-bundle/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-bundle/main.go with 98% similarity]
src/cmd/nncp-call/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-call/main.go with 97% similarity]
src/cmd/nncp-caller/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-caller/main.go with 96% similarity]
src/cmd/nncp-cfgenc/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-cfgenc/main.go with 89% similarity]
src/cmd/nncp-cfgmin/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-cfgmin/main.go with 87% similarity]
src/cmd/nncp-cfgnew/main.go [new file with mode: 0644]
src/cmd/nncp-check/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-check/main.go with 94% similarity]
src/cmd/nncp-daemon/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-daemon/main.go with 88% similarity]
src/cmd/nncp-exec/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go with 91% similarity]
src/cmd/nncp-file/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-file/main.go with 96% similarity]
src/cmd/nncp-freq/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go with 96% similarity]
src/cmd/nncp-log/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-log/main.go with 93% similarity]
src/cmd/nncp-pkt/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-pkt/main.go with 93% similarity]
src/cmd/nncp-reass/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go with 97% similarity]
src/cmd/nncp-rm/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go with 97% similarity]
src/cmd/nncp-stat/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go with 96% similarity]
src/cmd/nncp-toss/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-toss/main.go with 96% similarity]
src/cmd/nncp-xfer/main.go [moved from src/cypherpunks.ru/nncp/cmd/nncp-xfer/main.go with 96% similarity]
src/ctx.go [moved from src/cypherpunks.ru/nncp/ctx.go with 89% similarity]
src/cypherpunks.ru/nncp/cmd/nncp-cfgnew/main.go [deleted file]
src/cypherpunks.ru/nncp/go.mod [deleted file]
src/cypherpunks.ru/nncp/go.sum [deleted file]
src/cypherpunks.ru/nncp/vendor/cypherpunks.ru/balloon [deleted submodule]
src/cypherpunks.ru/nncp/vendor/github.com/davecgh/go-xdr [deleted submodule]
src/cypherpunks.ru/nncp/vendor/github.com/dustin/go-humanize [deleted submodule]
src/cypherpunks.ru/nncp/vendor/github.com/flynn/noise [deleted submodule]
src/cypherpunks.ru/nncp/vendor/github.com/gorhill/cronexpr [deleted submodule]
src/cypherpunks.ru/nncp/vendor/golang.org/x/crypto [deleted submodule]
src/cypherpunks.ru/nncp/vendor/golang.org/x/net [deleted submodule]
src/cypherpunks.ru/nncp/vendor/golang.org/x/sys [deleted submodule]
src/cypherpunks.ru/nncp/vendor/gopkg.in/check.v1 [deleted submodule]
src/cypherpunks.ru/nncp/vendor/gopkg.in/yaml.v2 [deleted submodule]
src/eblob.go [moved from src/cypherpunks.ru/nncp/eblob.go with 95% similarity]
src/go.mod [new file with mode: 0644]
src/go.sum [new file with mode: 0644]
src/humanizer.go [moved from src/cypherpunks.ru/nncp/humanizer.go with 98% similarity]
src/jobs.go [moved from src/cypherpunks.ru/nncp/jobs.go with 95% similarity]
src/lockdir.go [moved from src/cypherpunks.ru/nncp/lockdir.go with 91% similarity]
src/log.go [moved from src/cypherpunks.ru/nncp/log.go with 95% similarity]
src/nice.go [moved from src/cypherpunks.ru/nncp/nice.go with 100% similarity]
src/nice_test.go [moved from src/cypherpunks.ru/nncp/nice_test.go with 100% similarity]
src/nncp.go [moved from src/cypherpunks.ru/nncp/nncp.go with 84% similarity]
src/node.go [moved from src/cypherpunks.ru/nncp/node.go with 96% similarity]
src/pipe.go [new file with mode: 0644]
src/pkt.go [moved from src/cypherpunks.ru/nncp/pkt.go with 97% similarity]
src/pkt_test.go [moved from src/cypherpunks.ru/nncp/pkt_test.go with 96% similarity]
src/sortbynice.go [moved from src/cypherpunks.ru/nncp/sortbynice.go with 100% similarity]
src/sp.go [moved from src/cypherpunks.ru/nncp/sp.go with 99% similarity]
src/tmp.go [moved from src/cypherpunks.ru/nncp/tmp.go with 77% similarity]
src/toss.go [moved from src/cypherpunks.ru/nncp/toss.go with 95% similarity]
src/toss_test.go [moved from src/cypherpunks.ru/nncp/toss_test.go with 98% similarity]
src/tx.go [moved from src/cypherpunks.ru/nncp/tx.go with 97% similarity]
src/tx_test.go [moved from src/cypherpunks.ru/nncp/tx_test.go with 97% similarity]
src/via.go [moved from src/cypherpunks.ru/nncp/via.go with 92% similarity]
supplementary_files.sh [deleted file]

diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644 (file)
index 12047c5..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-[submodule "src/cypherpunks.ru/nncp/vendor/github.com/davecgh/go-xdr"]
-       path = src/cypherpunks.ru/nncp/vendor/github.com/davecgh/go-xdr
-       url = https://github.com/davecgh/go-xdr.git
-[submodule "src/cypherpunks.ru/nncp/vendor/github.com/dustin/go-humanize"]
-       path = src/cypherpunks.ru/nncp/vendor/github.com/dustin/go-humanize
-       url = https://github.com/dustin/go-humanize.git
-[submodule "src/cypherpunks.ru/nncp/vendor/github.com/flynn/noise"]
-       path = src/cypherpunks.ru/nncp/vendor/github.com/flynn/noise
-       url = https://github.com/flynn/noise.git
-[submodule "src/cypherpunks.ru/nncp/vendor/gopkg.in/check.v1"]
-       path = src/cypherpunks.ru/nncp/vendor/gopkg.in/check.v1
-       url = https://github.com/go-check/check.git
-       branch = v1
-[submodule "src/cypherpunks.ru/nncp/vendor/gopkg.in/yaml.v2"]
-       path = src/cypherpunks.ru/nncp/vendor/gopkg.in/yaml.v2
-       url = https://github.com/go-yaml/yaml.git
-       branch = v2
-[submodule "src/cypherpunks.ru/nncp/vendor/golang.org/x/crypto"]
-       path = src/cypherpunks.ru/nncp/vendor/golang.org/x/crypto
-       url = https://go.googlesource.com/crypto
-[submodule "src/cypherpunks.ru/nncp/vendor/golang.org/x/sys"]
-       path = src/cypherpunks.ru/nncp/vendor/golang.org/x/sys
-       url = https://go.googlesource.com/sys
-[submodule "src/cypherpunks.ru/nncp/vendor/golang.org/x/net"]
-       path = src/cypherpunks.ru/nncp/vendor/golang.org/x/net
-       url = https://go.googlesource.com/net
-[submodule "src/cypherpunks.ru/nncp/vendor/github.com/gorhill/cronexpr"]
-       path = src/cypherpunks.ru/nncp/vendor/github.com/gorhill/cronexpr
-       url = https://github.com/gorhill/cronexpr.git
-[submodule "src/cypherpunks.ru/nncp/vendor/cypherpunks.ru/balloon"]
-       path = src/cypherpunks.ru/nncp/vendor/cypherpunks.ru/balloon
-       url = git://git.cypherpunks.ru/balloon.git
diff --git a/BSDmakefile b/BSDmakefile
deleted file mode 100644 (file)
index 12bf97a..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-VERSION != cat VERSION
-GO ?= go
-
-GO_MOD_EXISTS != $(GO) help mod >/dev/null 2>&1 || echo no
-
-.if ${GO_MOD_EXISTS} == "no"
-BUILDMOD ?=
-GOPATH ?= $(PWD)
-.else
-BUILDMOD ?= -mod=vendor
-GOPATH ?= $(PWD)/gopath
-.endif
-
-include common.mk
diff --git a/GNUmakefile b/GNUmakefile
deleted file mode 100644 (file)
index 1bcb1be..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-VERSION = $(shell cat VERSION)
-GO ?= go
-
-GO_MOD_EXISTS = $(shell $(GO) help mod >/dev/null 2>&1 || echo no)
-
-ifeq ($(GO_MOD_EXISTS), no)
-BUILDMOD ?=
-GOPATH ?= $(PWD)
-else
-BUILDMOD ?= -mod=vendor
-GOPATH ?= $(PWD)/gopath
-endif
-
-include common.mk
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..46ddcf0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,79 @@
+GOPATH != pwd
+VERSION != cat VERSION
+
+GO ?= go
+PREFIX ?= /usr/local
+
+SENDMAIL ?= /usr/sbin/sendmail
+CFGPATH ?= $(PREFIX)/etc/nncp.hjson
+SPOOLPATH ?= /var/spool/nncp
+LOGPATH ?= /var/spool/nncp/log
+
+BINDIR = $(DESTDIR)$(PREFIX)/bin
+INFODIR = $(DESTDIR)$(PREFIX)/info
+DOCDIR = $(DESTDIR)$(PREFIX)/share/doc/nncp
+
+MOD = go.cypherpunks.ru/nncp/v5
+
+LDFLAGS = \
+       -X $(MOD).Version=$(VERSION) \
+       -X $(MOD).DefaultCfgPath=$(CFGPATH) \
+       -X $(MOD).DefaultSendmailPath=$(SENDMAIL) \
+       -X $(MOD).DefaultSpoolPath=$(SPOOLPATH) \
+       -X $(MOD).DefaultLogPath=$(LOGPATH)
+
+ALL = \
+       $(BIN)/nncp-bundle \
+       $(BIN)/nncp-call \
+       $(BIN)/nncp-caller \
+       $(BIN)/nncp-cfgenc \
+       $(BIN)/nncp-cfgmin \
+       $(BIN)/nncp-cfgnew \
+       $(BIN)/nncp-check \
+       $(BIN)/nncp-daemon \
+       $(BIN)/nncp-exec \
+       $(BIN)/nncp-file \
+       $(BIN)/nncp-freq \
+       $(BIN)/nncp-log \
+       $(BIN)/nncp-pkt \
+       $(BIN)/nncp-reass \
+       $(BIN)/nncp-rm \
+       $(BIN)/nncp-stat \
+       $(BIN)/nncp-toss \
+       $(BIN)/nncp-xfer
+
+SRC := $(PWD)/src
+BIN := $(PWD)/bin
+
+all: $(ALL)
+
+$(ALL):
+       mkdir -p $(BIN)
+       cd $(SRC) ; GOPATH=$(GOPATH) $(GO) build -ldflags "$(LDFLAGS)" \
+               $(MOD)/cmd/$$(basename $@)
+       mv $(SRC)/$$(basename $@) $(BIN)
+
+test:
+       cd $(SRC) ; GOPATH=$(GOPATH) $(GO) test -failfast $(MOD)/...
+
+clean:
+       rm -rf $(BIN)
+
+.PHONY: doc
+
+doc:
+       $(MAKE) -C doc
+
+install: all doc
+       mkdir -p $(BINDIR)
+       cp -f $(ALL) $(BINDIR)
+       for e in $(ALL) ; do chmod 755 $(BINDIR)/$$(basename $$e) ; done
+       mkdir -p $(INFODIR)
+       cp -f doc/nncp.info $(INFODIR)
+       chmod 644 $(INFODIR)/nncp.info
+       mkdir -p $(DOCDIR)
+       cp -f -L AUTHORS NEWS NEWS.RU README README.RU THANKS $(DOCDIR)
+       chmod 644 $(DOCDIR)/*
+
+install-strip: install
+       for e in $(ALL) ; do strip $(BINDIR)/$$(basename $$e) ; done
diff --git a/README b/README
index faf31c30440c92514d533aa79faf8ed8653106e9..11f7bc99bfab571685c05117a3420b5bc3a84b1d 100644 (file)
--- a/README
+++ b/README
@@ -16,7 +16,7 @@ online TCP daemon with full-duplex resumable data transmission exists.
 
 NNCP is copylefted free software: see the file COPYING for copying
 conditions. It should work on all POSIX-compatible systems. Easy
-integration with existing SMTP servers. Single YAML configuration file.
+integration with existing SMTP servers. Single Hjson configuration file.
 
 Home page: http://www.nncpgo.org/
 
index 30e40c321bfc29e8c28ab35f060babfbcec28300..f0ae3c1afccad522c3d992f432b12c463f6c95ad 100644 (file)
--- a/README.RU
+++ b/README.RU
@@ -21,7 +21,7 @@ NNCP (Node to Node copy) это набор утилит упрощающий б
 NNCP это свободное программное обеспечением: условия распространения
 находятся в файле COPYING. Оно должно работать на всех POSIX-совместимых
 системах. Лёгкая интеграция с существующими SMTP серверами. Единственный
-конфигурационный YAML файл.
+конфигурационный Hjson файл.
 
 Домашняя страница: http://www.nncpgo.org/
 
diff --git a/VERSION b/VERSION
index 7d5c902e777905446c67de7e52a945b88fd2038c..0062ac971805f7b700058db4bb0f5c5b771dda76 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.1
+5.0.0
diff --git a/common.mk b/common.mk
deleted file mode 100644 (file)
index 6c887a5..0000000
--- a/common.mk
+++ /dev/null
@@ -1,74 +0,0 @@
-PREFIX ?= /usr/local
-
-SENDMAIL ?= /usr/sbin/sendmail
-CFGPATH ?= $(PREFIX)/etc/nncp.yaml
-SPOOLPATH ?= /var/spool/nncp
-LOGPATH ?= /var/spool/nncp/log
-
-BINDIR = $(DESTDIR)$(PREFIX)/bin
-INFODIR = $(DESTDIR)$(PREFIX)/info
-DOCDIR = $(DESTDIR)$(PREFIX)/share/doc/nncp
-
-LDFLAGS = \
-       -X cypherpunks.ru/nncp.Version=$(VERSION) \
-       -X cypherpunks.ru/nncp.DefaultCfgPath=$(CFGPATH) \
-       -X cypherpunks.ru/nncp.DefaultSendmailPath=$(SENDMAIL) \
-       -X cypherpunks.ru/nncp.DefaultSpoolPath=$(SPOOLPATH) \
-       -X cypherpunks.ru/nncp.DefaultLogPath=$(LOGPATH)
-
-ALL = \
-       nncp-bundle \
-       nncp-call \
-       nncp-caller \
-       nncp-cfgenc \
-       nncp-cfgmin \
-       nncp-cfgnew \
-       nncp-check \
-       nncp-daemon \
-       nncp-exec \
-       nncp-file \
-       nncp-freq \
-       nncp-log \
-       nncp-pkt \
-       nncp-reass \
-       nncp-rm \
-       nncp-stat \
-       nncp-toss \
-       nncp-xfer
-
-SRC := $(PWD)/src/cypherpunks.ru/nncp
-BIN := $(PWD)/bin
-
-all: $(ALL)
-
-$(BIN):
-       mkdir -p $(BIN)
-
-$(ALL): $(BIN)
-       cd $(SRC) ; GOPATH=$(GOPATH) $(GO) build $(BUILDMOD) -ldflags "$(LDFLAGS)" cypherpunks.ru/nncp/cmd/$@
-       mv $(SRC)/$@ $(BIN)
-
-test:
-       cd $(SRC) ; GOPATH=$(GOPATH) $(GO) test $(BUILDMOD) -failfast cypherpunks.ru/nncp/...
-
-clean:
-       rm -rf bin
-
-.PHONY: doc
-
-doc:
-       $(MAKE) -C doc
-
-install: all doc
-       mkdir -p $(BINDIR)
-       (cd bin ; cp -f $(ALL) $(BINDIR))
-       for e in $(ALL) ; do chmod 755 $(BINDIR)/$$e ; done
-       mkdir -p $(INFODIR)
-       cp -f doc/nncp.info $(INFODIR)
-       chmod 644 $(INFODIR)/nncp.info
-       mkdir -p $(DOCDIR)
-       cp -f -L AUTHORS NEWS NEWS.RU README README.RU THANKS $(DOCDIR)
-       chmod 644 $(DOCDIR)/*
-
-install-strip: install
-       for e in $(ALL) ; do strip $(BINDIR)/$$e ; done
index 4e92b3e5a75ea41b6e37985c61de63792d603780..0223490c9cb798e7ac088297827af127c5eb8f79 100644 (file)
@@ -13,6 +13,7 @@ CSS != cat style.css
 nncp.html: *.texi sp.utxt pedro.txt
        rm -f nncp.html/*.html
        $(MAKEINFO) --html \
+               --set-customization-variable EXTRA_HEAD='<link rev="made" href="mailto:stargrave+webmaster@nncpgo.org">' \
                --set-customization-variable CSS_LINES='$(CSS)' \
                --set-customization-variable SHOW_TITLE=0 \
                --set-customization-variable USE_ACCESSKEY=0 \
index 497bc40a2aab8858d0b0c3957cb36946b3852a0d..bb9c2d0cb76a0f9480678d14e4aa366e8ea2e94d 100644 (file)
@@ -38,11 +38,11 @@ CD-ROM}/@url{https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%BC%D0%B5%
 NNCP это @url{https://www.gnu.org/philosophy/pragmatic.ru.html,
 копилефт} @url{https://www.gnu.org/philosophy/free-sw.ru.html, свободное
 программное обеспечение}: лицензировано под условиями
-@url{https://www.gnu.org/licenses/gpl-3.0.ru.html, GNU GPLv3+}. Оно
+@url{https://www.gnu.org/licenses/gpl-3.0.ru.html, GNU GPLv3}. Оно
 должно работать на всех @url{https://ru.wikipedia.org/wiki/POSIX,
 POSIX}-совместимых системах. Лёгкая @ref{Integration, интеграция} с
 существующими @url{https://ru.wikipedia.org/wiki/SMTP, SMTP} серверами.
-Единственный конфигурационный @url{http://yaml.org/, YAML} файл.
+Единственный конфигурационный @url{https://hjson.org/, Hjson} файл.
 
 Зачем создавать ещё одно решение с принципом сохранить-и-переслать когда
 уже существуют UUCP, FTN и даже SMTP? Посмотрите @ref{Сравнение, сравнение}!
index f8070f15a0e766338880e015891d4d84471a5450..f228d15ca099c671e2da7f13df247db2979221cf 100644 (file)
@@ -29,11 +29,11 @@ Look for possible @ref{Use cases, use cases}!
 
 NNCP is @url{https://www.gnu.org/philosophy/pragmatic.html, copylefted}
 @url{https://www.gnu.org/philosophy/free-sw.html, free software}
-licenced under @url{https://www.gnu.org/licenses/gpl-3.0.html, GNU GPLv3+}.
+licenced under @url{https://www.gnu.org/licenses/gpl-3.0.html, GNU GPLv3}.
 It should work on all @url{https://en.wikipedia.org/wiki/POSIX,
 POSIX}-compatible systems. Easy @ref{Integration, integration} with existing
 @url{https://en.wikipedia.org/wiki/SMTP, SMTP} servers. Single
-@url{http://yaml.org/, YAML} configuration file.
+@url{https://hjson.org/, Hjson} configuration file.
 
 Why create yet another store-and-forward solution when UUCP, FTN and
 even SMTP exists? Look in @ref{Comparison, comparison} section!
diff --git a/doc/building.texi b/doc/building.texi
new file mode 100644 (file)
index 0000000..1489294
--- /dev/null
@@ -0,0 +1,26 @@
+@node Build-instructions
+@section Build instructions
+
+Make sure that Go is installed. For example to install it from packages:
+
+@table @asis
+@item FreeBSD
+    @verb{|pkg install go|}
+@item Debian, Ubuntu
+    @verb{|apt install golang|}
+@end table
+
+@verbatim
+$ [fetch|wget] http://www.nncpgo.org/download/nncp-5.0.0.tar.xz
+$ [fetch|wget] http://www.nncpgo.org/download/nncp-5.0.0.tar.xz.sig
+$ gpg --verify nncp-5.0.0.tar.xz.sig nncp-5.0.0.tar.xz
+$ xz --decompress --stdout nncp-5.0.0.tar.xz | tar xf -
+$ make -C nncp-5.0.0 all
+@end verbatim
+
+There is @command{install} make-target respecting @env{DESTDIR}. It will
+install binaries and info-documentation:
+
+@verbatim
+# make -C nncp-5.0.0 install PREFIX=/usr/local
+@end verbatim
index e5235bce45cf656aebf63ff16f96d9d6b5c56b2c..8330cdf2565534bd480d28abf8e70ddb4b444799 100644 (file)
@@ -18,11 +18,11 @@ sequentially streamed for recording and digested back.
 @item They do not require intermediate storage before recording on
 either CD-ROM or tape drive.
 @verbatim
-% nncp-bundle -tx SOMENODE | cdrecord -tao -         # record directly to CD
-% nncp-bundle -tx SOMENODE | dd of=/dev/sa0 bs=10240 # record directly to tape
+$ nncp-bundle -tx SOMENODE | cdrecord -tao -         # record directly to CD
+$ nncp-bundle -tx SOMENODE | dd of=/dev/sa0 bs=10240 # record directly to tape
 
-% dd if=/dev/cd0 bs=2048 | nncp-bundle -rx  # read directly from CD
-% dd if=/dev/sa0 bs=10240 | nncp-bundle -rx # read directly from tape
+$ dd if=/dev/cd0 bs=2048 | nncp-bundle -rx  # read directly from CD
+$ dd if=/dev/sa0 bs=10240 | nncp-bundle -rx # read directly from tape
 @end verbatim
 
 @item They do not require filesystem existence to deal with, simplifying
@@ -30,9 +30,9 @@ administration when operating in heterogeneous systems with varying
 filesystems. No @command{mount}/@command{umount}, @command{zpool
 import}/@command{zpool export} and struggling with file permissions.
 @verbatim
-% nncp-bundle -tx SOMENODE | dd of=/dev/da0 bs=1M # record directly to
+$ nncp-bundle -tx SOMENODE | dd of=/dev/da0 bs=1M # record directly to
                                                   # hard/flash drive
-% dd if=/dev/da0 bs=1M | nncp-bundle -rx # read directly from drive
+$ dd if=/dev/da0 bs=1M | nncp-bundle -rx # read directly from drive
 @end verbatim
 
 @item This is the fastest way to record outbound packets for offline
index edf2d707ac51d6697568b343cf70b2643de57774..447b764615af969e24ec8917fbbc50b8f5f00c28 100644 (file)
@@ -6,22 +6,26 @@ Call is a rule when and how node can be called.
 Example list of call structures:
 
 @verbatim
-calls:
-  -
-    cron: "*/1 * * * MON-FRI"
-    onlinedeadline: 3600
-    nice: PRIORITY+10
-  -
-    cron: "30 * * * SAT,SUN"
-    onlinedeadline: 1800
-    maxonlinetime: 1750
-    nice: NORMAL
-    rxrate: 10
-    txrate: 20
-  -
-    cron: "0 * * * SAT,SUN"
-    xx: rx
-    addr: lan
+calls: [
+    {
+        cron: "*/1 * * * MON-FRI"
+        onlinedeadline: 3600
+        nice: PRIORITY+10
+    },
+    {
+        cron: "30 * * * SAT,SUN"
+        onlinedeadline: 1800
+        maxonlinetime: 1750
+        nice: NORMAL
+        rxrate: 10
+        txrate: 20
+    },
+    {
+        cron: "0 * * * SAT,SUN"
+        xx: rx
+        addr: lan
+    },
+]
 @end verbatim
 
 tells that on work days of the week call that node every minute,
index 410bee884e2ef7305ccbff340a3846ab09f43471..0aca8f9d5694b5a953289f895ef6fc8dd2192262 100644 (file)
@@ -1,70 +1,91 @@
 @node Configuration
 @unnumbered Configuration file
 
-Example YAML configuration file:
+Example @url{https://hjson.org/, Hjson} configuration file:
 
 @verbatim
-spool: /var/spool/nncp
-log: /var/spool/nncp/log
-notify:
-  file:
-    from: nncp@localhost
-    to: user+file@example.com
-  freq:
-    from: nncp@localhost
-    to: user+freq@example.com
-self:
-  id: TIJQL...2NGIA
-  exchpub: CYVGQ...PSEWQ
-  exchprv: 65PUY...MPZ3Q
-  signpub: 2NMVC...CMH5Q
-  signprv: 555JD...RGD6Y
-  noiseprv: D62XU...NKYPA
-  noisepub: KIBKK...ESM7Q
-neigh:
-  self:
+{
+  spool: /var/spool/nncp
+  log: /var/spool/nncp/log
+  umask: "022"
+
+  notify: {
+    file: {
+      from: nncp@localhost
+      to: user+file@example.com
+    }
+    freq: {
+      from: nncp@localhost
+      to: user+freq@example.com
+    }
+  }
+
+  self: {
     id: TIJQL...2NGIA
     exchpub: CYVGQ...PSEWQ
+    exchprv: 65PUY...MPZ3Q
     signpub: 2NMVC...CMH5Q
+    signprv: 555JD...RGD6Y
+    noiseprv: D62XU...NKYPA
     noisepub: KIBKK...ESM7Q
-    exec:
-      sendmail: [/usr/sbin/sendmail]
-  alice:
-    id: XJZBK...65IJQ
-    exchpub: MJACJ...FAI6A
-    signpub: T4AFC...N2FRQ
-    noisepub: UBM5K...VI42A
-    exec:
-      flag: ["/usr/bin/touch", "-t"]
-    incoming: /home/alice/incoming
-    onlinedeadline: 1800
-    maxonlinetime: 3600
-    addrs:
-      lan: "[fe80::1234%igb0]:5400"
-      internet: alice.com:3389
-    calls:
-      -
-        cron: "*/2 * * * *"
-  bob:
-    id: 2IZNP...UYGYA
-    exchpub: WFLMZ...B7NHA
-    signpub: GTGXG...IE3OA
-    exec:
-      sendmail: [/usr/sbin/sendmail]
-      warcer: [/path/to/warcer.sh]
-      wgeter: [/path/to/wgeter.sh]
-    freq: /home/bob/pub
-    freqchunked: 1024
-    freqminsize: 2048
-    via: [alice]
-    rxrate: 10
-    txrate: 20
+  }
+
+  neigh: {
+    self: {
+      id: TIJQL...2NGIA
+      exchpub: CYVGQ...PSEWQ
+      signpub: 2NMVC...CMH5Q
+      noisepub: KIBKK...ESM7Q
+      exec: {sendmail: ["/usr/sbin/sendmail"]}
+    }
+    alice: {
+      id: "XJZBK...65IJQ"
+      exchpub: MJACJ...FAI6A
+      signpub: T4AFC...N2FRQ
+      noisepub: UBM5K...VI42A
+      exec: {flag: ["/usr/bin/touch", "-t"]}
+      incoming: "/home/alice/incoming"
+      onlinedeadline: 1800
+      maxonlinetime: 3600
+      addrs: {
+        lan: "[fe80::1234%igb0]:5400"
+        internet: alice.com:3389
+        proxied: "|ssh remote.host nncp-daemon -inetd"
+      }
+      calls: [
+        {
+          cron: "*/2 * * * *"
+        },
+      ]
+    }
+    bob: {
+      id: 2IZNP...UYGYA
+      exchpub: WFLMZ...B7NHA
+      signpub: GTGXG...IE3OA
+      exec: {
+        sendmail: ["/usr/sbin/sendmail"]
+        warcer: ["/path/to/warcer.sh"]
+        wgeter: ["/path/to/wgeter.sh"]
+      }
+      freq: "/home/bob/pub"
+      freqchunked: 1024
+      freqminsize: 2048
+      via: ["alice"]
+      rxrate: 10
+      txrate: 20
+    }
+  }
+}
 @end verbatim
 
 @strong{spool} field contains an absolute path to @ref{Spool, spool}
 directory. @strong{log} field contains an absolute path to @ref{Log,
 log} file.
 
+Non-empty optional @strong{umask} will force all invoked commands to
+override their umask to specified octal mask. Useful for using with
+@ref{Shared spool, shared spool directories}.
+
 @anchor{CfgNotify}
 @strong{notify} section contains notification settings for successfully
 tossed file and freq packets. Corresponding @strong{from} and
@@ -105,13 +126,15 @@ arguments and the body fed to command's stdin.
 command, will execute:
 
 @verbatim
-echo hello world |
-    NNCP_SELF=OURNODE \
-    NNCP_SENDER=REMOTE \
-    NNCP_NICE=64 \
-    /usr/sbin/sendmail -t ARG0 ARG1 ARG2
+NNCP_SELF=OURNODE \
+NNCP_SENDER=REMOTE \
+NNCP_NICE=64 \
+/usr/sbin/sendmail -t ARG0 ARG1 ARG2
 @end verbatim
 
+feeding @verb{|hello world\n|} to that started @command{sendmail}
+process.
+
 @anchor{CfgIncoming}
 @item incoming
 Full path to directory where all file uploads will be saved. May be
@@ -140,9 +163,12 @@ omitted if direct connection exists and no relaying is required.
 @anchor{CfgAddrs}
 @item addrs
 Dictionary containing known network addresses of the node. Each key is
-human-readable name of the link/address. Values are @verb{|addr:port|}
-pairs pointing to @ref{nncp-daemon}'s listening instance. May be omitted
-if either no direct connection exists, or @ref{nncp-call} is used with
+human-readable name of the address. For direct TCP connections use
+@verb{|host:port|} format, pointing to @ref{nncp-daemon}'s listening
+instance. Also you can pipe connection through the external command
+using @verb{#|some command#} format. @code{/bin/sh -c "some command"}
+will start and its stdin/stdout used as a connection. May be omitted if
+either no direct connection exists, or @ref{nncp-call} is used with
 forced address specifying.
 
 @anchor{CfgXxRate}
@@ -173,3 +199,22 @@ List of @ref{Call, call configuration}s. Can be omitted if
 @ref{nncp-caller} won't be used to call that node.
 
 @end table
+
+@menu
+* Shared spool directory: Shared spool.
+@end menu
+
+@node Shared spool
+@section Shared spool directory
+
+If you want to share single spool directory with multiple grouped Unix
+users, then you can @command{setgid} it and assure that umask is group
+friendly. For convenience you can set @option{umask} globally for
+invoked NNCP commands in the configuration file. For example:
+
+@verbatim
+$ chgrp nncp /usr/local/etc/nncp.hjson /var/spool/nncp
+$ chmod g+r /usr/local/etc/nncp.hjson
+$ chmod g+rwxs /var/spool/nncp
+$ echo 'umask: "007"' >> /usr/local/etc/nncp.hjson
+@end verbatim
index b61492f31c464683829f27b042dd686ae0269909..4247054b10a4c0b73f21fac3e583d52c05b5c125 100644 (file)
@@ -44,9 +44,9 @@ Nearly all commands have the following common options:
 @section nncp-bundle
 
 @verbatim
-% nncp-bundle [options] -tx [-delete] NODE [NODE ...] > ...
-% nncp-bundle [options] -rx -delete [-dryrun] [NODE ...] < ...
-% nncp-bundle [options] -rx [-check] [-dryrun] [NODE ...] < ...
+$ nncp-bundle [options] -tx [-delete] NODE [NODE ...] > ...
+$ nncp-bundle [options] -rx -delete [-dryrun] [NODE ...] < ...
+$ nncp-bundle [options] -rx [-check] [-dryrun] [NODE ...] < ...
 @end verbatim
 
 With @option{-tx} option, this command creates @ref{Bundles, bundle} of
@@ -79,8 +79,8 @@ packets integrity will be checked and they will be deleted from the
 spool if everything is good. So it is advisable to recheck your streams:
 
 @verbatim
-% nncp-bundle -tx ALICE BOB WHATEVER | cdrecord -tao -
-% dd if=/dev/cd0 bs=2048 | nncp-bundle -rx -delete
+$ nncp-bundle -tx ALICE BOB WHATEVER | cdrecord -tao -
+$ dd if=/dev/cd0 bs=2048 | nncp-bundle -rx -delete
 @end verbatim
 
 @option{-dryrun} option prevents any writes to the spool. This is
@@ -91,7 +91,7 @@ their integrity.
 @section nncp-call
 
 @verbatim
-% nncp-call [options]
+$ nncp-call [options]
     [-onlinedeadline INT]
     [-maxonlinetime INT]
     [-rx|-tx]
@@ -121,11 +121,26 @@ packets of remote node, without any transmission.
 You can specify what packets your want to download, by specifying
 @option{-pkts} option with comma-separated list of packets identifiers.
 
+Each @option{NODE} can contain several uniquely identified
+@option{ADDR}esses in @ref{CfgAddrs, configuration} file. If you do
+not specify the exact one, then all will be tried until the first
+success. Optionally you can force @option{FORCEADDR} address usage,
+instead of addresses taken from configuration file. You can specify both
+@verb{|host:port|} and @verb{#|some command#} formats.
+
+Pay attention that this command runs integrity check for each completely
+received packet in the background. This can be time consuming.
+Connection could be lost during that check and remote node won't be
+notified that file is done. But after successful integrity check that
+file is renamed from @file{.part} one and when you rerun
+@command{nncp-call} again, remote node will receive completion
+notification.
+
 @node nncp-caller
 @section nncp-caller
 
 @verbatim
-% nncp-caller [options] [NODE ...]
+$ nncp-caller [options] [NODE ...]
 @end verbatim
 
 Croned daemon that calls remote nodes from time to time, according to
@@ -135,32 +150,17 @@ Optional number of @option{NODE}s tells to ignore other ones.
 Otherwise all nodes with specified @emph{calls} configuration
 field will be called.
 
-@option{-onlinedeadline} overrides @ref{CfgOnlineDeadline,
-@emph{onlinedeadline}} configuration option.
-
-Each @option{NODE} can contain several uniquely identified
-@option{ADDR}esses in @ref{CfgAddrs, configuration} file. If you do
-not specify the exact one, then all will be tried until the first
-success. Optionally you can force @option{FORCEADDR} address usage,
-instead of addresses taken from configuration file.
-
-Pay attention that this command runs integrity check for each completely
-received packet in the background. This can be time consuming.
-Connection could be lost during that check and remote node won't be
-notified that file is done. But after successful integrity check that
-file is renamed from @file{.part} one and when you rerun
-@command{nncp-call} again, remote node will receive completion
-notification.
+Look @ref{nncp-call} for more information.
 
 @node nncp-cfgenc
 @section nncp-cfgenc
 
 @verbatim
-% nncp-cfgmin [options] [-s INT] [-t INT] [-p INT] cfg.yaml > cfg.yaml.eblob
-% nncp-cfgmin [options] -d cfg.yaml.eblob > cfg.yaml
+$ nncp-cfgmin [options] [-s INT] [-t INT] [-p INT] cfg.hjson > cfg.hjson.eblob
+$ nncp-cfgmin [options] -d cfg.hjson.eblob > cfg.hjson
 @end verbatim
 
-This command allows you to encrypt provided @file{cfg.yaml} file with
+This command allows you to encrypt provided @file{cfg.hjson} file with
 the passphrase, producing @ref{EBlob, eblob}, to safely keep your
 configuration file with private keys. This utility was written for users
 who do not want (or can not) to use either @url{https://gnupg.org/,
@@ -184,7 +184,7 @@ if passphrase can not decrypt @file{eblob}.
 @option{-dump} options parses @file{eblob} and prints parameters used
 during its creation. For example:
 @verbatim
-% nncp-cfgenc -dump /usr/local/etc/nncp.yaml.eblob
+$ nncp-cfgenc -dump /usr/local/etc/nncp.hjson.eblob
 Strengthening function: Balloon with BLAKE2b-256
 Memory space cost: 1048576 bytes
 Number of rounds: 16
@@ -196,7 +196,7 @@ Blob size: 2494
 @section nncp-cfgmin
 
 @verbatim
-% nncp-cfgmin [options] > stripped.yaml
+$ nncp-cfgmin [options] > stripped.hjson
 @end verbatim
 
 Print out stripped configuration version: only path to @ref{Spool,
@@ -208,12 +208,13 @@ neighbours, without private keys involving.
 @section nncp-cfgnew
 
 @verbatim
-% nncp-cfgnew [options] > new.yaml
+$ nncp-cfgnew [options] [-nocomments] > new.hjson
 @end verbatim
 
 Generate new node configuration: private keys, example configuration
 file and print it to stdout. You must use this command when you setup
-the new node.
+the new node. @option{-nocomments} will create configuration file
+without descriptive huge comments -- useful for advanced users.
 
 Pay attention that private keys generation consumes an entropy from your
 operating system.
@@ -222,7 +223,7 @@ operating system.
 @section nncp-check
 
 @verbatim
-% nncp-check [options]
+$ nncp-check [options]
 @end verbatim
 
 Perform @ref{Spool, spool} directory integrity check. Read all files
@@ -234,7 +235,7 @@ not used often in practice, if ever.
 @section nncp-daemon
 
 @verbatim
-% nncp-daemon [options] [-maxconn INT] [-bind ADDR] [-inetd]
+$ nncp-daemon [options] [-maxconn INT] [-bind ADDR] [-inetd]
 @end verbatim
 
 Start listening TCP daemon, wait for incoming connections and run
@@ -257,7 +258,7 @@ uucp        stream  tcp6    nowait  nncpuser        /usr/local/bin/nncp-daemon      nncp-daemon -inetd
 @section nncp-exec
 
 @verbatim
-% nncp-exec [options] NODE HANDLE [ARG0 ARG1 ...]
+$ nncp-exec [options] NODE HANDLE [ARG0 ARG1 ...]
 @end verbatim
 
 Send execution command to @option{NODE} for specified @option{HANDLE}.
@@ -269,9 +270,10 @@ For example, if remote side has following configuration file for your
 node:
 
 @verbatim
-exec:
+exec: {
   sendmail: [/usr/sbin/sendmail, "-t"]
   appender: ["/bin/sh", "-c", "cat >> /append"]
+}
 @end verbatim
 
 then executing @verb{|echo My message | nncp-exec -replynice 123 REMOTE
@@ -290,7 +292,7 @@ echo My message |
 @section nncp-file
 
 @verbatim
-% nncp-file [options] [-chunked INT] SRC NODE:[DST]
+$ nncp-file [options] [-chunked INT] SRC NODE:[DST]
 @end verbatim
 
 Send @file{SRC} file to remote @option{NODE}. @file{DST} specifies
@@ -328,7 +330,7 @@ file receiving.
 @section nncp-freq
 
 @verbatim
-% nncp-freq [options] NODE:SRC [DST]
+$ nncp-freq [options] NODE:SRC [DST]
 @end verbatim
 
 Send file request to @option{NODE}, asking it to send its @file{SRC}
@@ -344,7 +346,7 @@ queuing.
 @section nncp-log
 
 @verbatim
-% nncp-log [options]
+$ nncp-log [options]
 @end verbatim
 
 Parse @ref{Log, log} file and print out its records in human-readable form.
@@ -353,9 +355,9 @@ Parse @ref{Log, log} file and print out its records in human-readable form.
 @section nncp-pkt
 
 @verbatim
-% nncp-pkt [options] < pkt
-% nncp-pkt [options] [-decompress] -dump < pkt > payload
-% nncp-pkt -overheads
+$ nncp-pkt [options] < pkt
+$ nncp-pkt [options] [-decompress] -dump < pkt > payload
+$ nncp-pkt -overheads
 @end verbatim
 
 Low level packet parser. Normally it should not be used, but can help in
@@ -385,7 +387,7 @@ Path: stargrave@stargrave.org
 
 And with the @option{-dump} option it will give you the actual payload
 (the whole file, mail message, and so on). @option{-decompress} option
-tries to zlib-decompress the data from plain packet (useful for mail
+tries to zstd-decompress the data from plain packet (useful for mail
 packets).
 
 @option{-overheads} options print encrypted, plain and size header overheads.
@@ -394,8 +396,8 @@ packets).
 @section nncp-reass
 
 @verbatim
-% nncp-reass [options] [-dryrun] [-keep] [-dump] [-stdout] FILE.nncp.meta
-% nncp-reass [options] [-dryrun] [-keep] {-all | -node NODE}
+$ nncp-reass [options] [-dryrun] [-keep] [-dump] [-stdout] FILE.nncp.meta
+$ nncp-reass [options] [-dryrun] [-keep] {-all | -node NODE}
 @end verbatim
 
 Reassemble @ref{Chunked, chunked file} after @ref{nncp-toss, tossing}.
@@ -453,12 +455,12 @@ Checksums:
 @section nncp-rm
 
 @verbatim
-% nncp-rm [options] -tmp
-% nncp-rm [options] -lock
-% nncp-rm [options] -node NODE -part
-% nncp-rm [options] -node NODE -seen
-% nncp-rm [options] -node NODE [-rx] [-tx]
-% nncp-rm [options] -node NODE -pkt PKT
+$ nncp-rm [options] -tmp
+$ nncp-rm [options] -lock
+$ nncp-rm [options] -node NODE -part
+$ nncp-rm [options] -node NODE -seen
+$ nncp-rm [options] -node NODE [-rx] [-tx]
+$ nncp-rm [options] -node NODE -pkt PKT
 @end verbatim
 
 This command is aimed to delete various files from your spool directory:
@@ -483,7 +485,7 @@ ones. If @option{-seen} option is specified, then delete only
 @section nncp-stat
 
 @verbatim
-% nncp-stat [options] [-node NODE]
+$ nncp-stat [options] [-node NODE]
 @end verbatim
 
 Print current @ref{Spool, spool} statistics about unsent and unprocessed
@@ -495,7 +497,7 @@ size) are in inbound (Rx) and outbound (Tx) queues.
 @section nncp-toss
 
 @verbatim
-% nncp-toss [options]
+$ nncp-toss [options]
     [-node NODE]
     [-dryrun]
     [-cycle INT]
@@ -531,7 +533,7 @@ options allow to disable any kind of packet types processing.
 @section nncp-xfer
 
 @verbatim
-% nncp-xfer [options] [-node NODE] [-mkdir] [-keep] [-rx|-tx] DIR
+$ nncp-xfer [options] [-node NODE] [-mkdir] [-keep] [-rx|-tx] DIR
 @end verbatim
 
 Search for directory in @file{DIR} containing inbound packets for us and
index 5c90671d636f63ea219be645b09b580a579e799b..7b02d03e7f9aa2f343a2a5e6f6a49f58e8df5903 100644 (file)
@@ -30,7 +30,7 @@
 @item Шифрование пакетов @tab Нет @tab Нет @tab @strong{Да} @tab Нет
 @item Приватность метаданных @tab Нет @tab Нет @tab @strong{Да} @tab Нет
 @item Проверка целостности пакетов @tab Нет @tab Нет @tab @strong{Да} @tab Нет
-@item Ð\94Ñ\80Ñ\83желÑ\8eбноÑ\81Ñ\82Ñ\8c Ðº Ñ\84лоппинеÑ\82Ñ\83 @tab Ð\9dеÑ\82 @tab Ð\9dеÑ\82 @tab @strong{Да} @tab Нет
+@item Ð\94Ñ\80Ñ\83желÑ\8eбноÑ\81Ñ\82Ñ\8c Ðº Ñ\84лоппинеÑ\82Ñ\83 @tab Ð\9dеÑ\82 @tab Ð§Ð°Ñ\81Ñ\82иÑ\87но @tab @strong{Да} @tab Нет
 
 @end multitable
 
@@ -48,7 +48,7 @@
     того, из коробки не предоставляется никакого шифрования и сильной
     аутентификации.
 
-    NNCP требует редактирование единственного YAML @ref{Configuration,
+    NNCP требует редактирование единственного Hjson @ref{Configuration,
     конфигурационного файла}.
 
 @item Передача новостей
index 03087c1c73fcf83e81d7a7abc826953d1575a90a..11fe4a21882b31e3ba88fd0c93295685fb021a08 100644 (file)
@@ -29,7 +29,7 @@ FidoNet} Technology Networks) and @url{https://en.wikipedia.org/wiki/SMTP, SMTP}
 @item Packets encryption @tab No @tab No @tab @strong{Yes} @tab No
 @item Metadata privacy @tab No @tab No @tab @strong{Yes} @tab No
 @item Packets integrity check @tab No @tab No @tab @strong{Yes} @tab No
-@item Sneakernet friendliness @tab No @tab No @tab @strong{Yes} @tab No
+@item Sneakernet friendliness @tab No @tab Partially @tab @strong{Yes} @tab No
 
 @end multitable
 
@@ -45,7 +45,7 @@ FidoNet} Technology Networks) and @url{https://en.wikipedia.org/wiki/SMTP, SMTP}
     like GoldEd, not an ordinary email client. Moreover, there is no
     out-of-box encryption and strong authentication involved.
 
-    NNCP requires editing of single YAML @ref{Configuration,
+    NNCP requires editing of single Hjson @ref{Configuration,
     configuration file}.
 
 @item News transmission
index 0418f47380d639de8da581c3971fae5daf447965..f25c62e6b268b6aa922c3a6ae99213c743ddf5fe 100644 (file)
@@ -8,13 +8,13 @@ Tarballs include all necessary required libraries:
 
 @multitable @columnfractions .50 .50
 @headitem Library @tab Licence
-@item @code{cypherpunks.ru/balloon} @tab GNU LGPLv3+
 @item @code{github.com/davecgh/go-xdr} @tab ISC
 @item @code{github.com/dustin/go-humanize} @tab MIT
 @item @code{github.com/flynn/noise} @tab BSD 3-Clause
-@item @code{github.com/go-check/check} @tab BSD 2-Clause
-@item @code{github.com/go-yaml/yaml} @tab Apache License 2.0 and MIT
 @item @code{github.com/gorhill/cronexpr} @tab GNU GPLv3
+@item @code{github.com/hjson/hjson-go} @tab MIT
+@item @code{github.com/klauspost/compress} @tab BSD 3-Clause
+@item @code{go.cypherpunks.ru/balloon} @tab GNU LGPLv3
 @item @code{golang.org/x/crypto} @tab BSD 3-Clause
 @item @code{golang.org/x/net} @tab BSD 3-Clause
 @item @code{golang.org/x/sys} @tab BSD 3-Clause
@@ -23,6 +23,10 @@ Tarballs include all necessary required libraries:
 @multitable {XXXXX} {XXXX-XX-XX} {XXXX KiB} {link sign} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
 @headitem Version @tab Date @tab Size @tab Tarball @tab SHA256 checksum
 
+@item @ref{Release 4.1, 4.1} @tab 2019-05-01 @tab 1227 KiB
+@tab @url{download/nncp-4.1.tar.xz, link} @url{download/nncp-4.1.tar.xz.sig, sign}
+@tab @code{29AEC53D EC914906 D7C47194 0955A32E 2BF470E6 9B8E09D3 AF3B62D8 CC8E541E}
+
 @item @ref{Release 4.0, 4.0} @tab 2019-04-28 @tab 1227 KiB
 @tab @url{download/nncp-4.0.tar.xz, link} @url{download/nncp-4.0.tar.xz.sig, sign}
 @tab @code{EAFA6272 22E355FC EB772A90 FC6DEA8E AE1F1695 3F48A4A3 57ADA0B4 FF918452}
diff --git a/doc/git-bundler.sh b/doc/git-bundler.sh
new file mode 100755 (executable)
index 0000000..70df771
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh -ex
+
+tmp=$(mktemp)
+
+cleanup()
+{
+    rm -f $tmp
+}
+trap cleanup HUP PIPE INT QUIT TERM EXIT
+
+read revs
+cd $HOME/git/$1.git
+git bundle create $tmp $revs
+nncp-file -nice $NNCP_NICE $tmp $NNCP_SENDER:$1-$(date '+%Y%M%d%H%m%S').bundle
index e9f067d64a2e07b418f833bc419c4349544b069f..a83ea31be352e50881770dd47b23e6262883cb4d 100644 (file)
@@ -10,8 +10,7 @@ Copyright @copyright{} 2016-2019 @email{stargrave@@stargrave.org, Sergey Matveev
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.3
-or any later version published by the Free Software Foundation;
+under the terms of the GNU Free Documentation License, Version 1.3;
 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 A copy of the license is included in the section entitled "Copying conditions".
 @end quotation
index db3be1dd3354524009533033380cce700c4bedf1..b94b3bc41caba176d41e21a7263444ccaa47041f 100644 (file)
@@ -5,30 +5,31 @@ Possibly NNCP package already exists for your distribution:
 
 @itemize
 @item @url{https://www.freshports.org/net/nncp/, FreeBSD ports}
+@item @url{https://github.com/DragonFlyBSD/DPorts/tree/master/net/nncp, DragonFly BSD ports}
 @item @url{https://github.com/void-linux/void-packages/blob/master/srcpkgs/nncp/template, Void Linux}
 @end itemize
 
 NNCP should run on any POSIX-compatible operating system.
 
 NNCP is written on @url{https://golang.org/, Go} programming language
-and you have to install Go compiler (1.10+ version is highly
-recommended). @emph{Make} (BSD and GNU ones are fine) is recommended for
-convenient building. @url{https://www.gnu.org/software/texinfo/,
-Texinfo} is used for building documentation.
+and you have to install Go compiler 1.10+ version. @command{Make} (BSD
+and GNU versions are fine) is recommended for convenient building.
+@url{https://www.gnu.org/software/texinfo/, Texinfo} is used for
+building documentation (although tarballs already include it).
 
 In general you must get @ref{Tarballs, the tarball}, check its
 @ref{Integrity, integrity and authenticity} and run @command{make}.
-Look for general and @ref{Platform-specific, platform-specific}
-installation instructions.
+Look for general and platform-specific @ref{Build-instructions, build
+instructions}.
 
 @menu
 * Prepared tarballs: Tarballs.
 * Tarballs integrity check: Integrity.
-* Platform-specific instructions: Platform-specific.
+* Build instructions: Build-instructions.
 * Development source code: Sources.
 @end menu
 
 @include download.texi
 @include integrity.texi
-@include platforms.texi
+@include building.texi
 @include sources.texi
index 729752e99a5c392d476c70ffba8709c974347f70..d1f1af96163eb7b1131ee1e594f447862b7996b9 100644 (file)
@@ -143,15 +143,15 @@ supports them too.
 
 After installing @command{rss2email}, create configuration file:
 @verbatim
-% r2e new rss-robot@address.com
+$ r2e new rss-robot@address.com
 @end verbatim
 and add feeds you want to retrieve:
 @verbatim
-% r2e add https://git.cypherpunks.ru/cgit.cgi/nncp.git/atom/?h=master
+$ r2e add https://git.cypherpunks.ru/cgit.cgi/nncp.git/atom/?h=master
 @end verbatim
 and run the process:
 @verbatim
-% r2e run
+$ r2e run
 @end verbatim
 
 @node WARCs
@@ -160,7 +160,7 @@ and run the process:
 Simple HTML web page can be downloaded very easily for sending and
 viewing it offline after:
 @verbatim
-% wget http://www.example.com/page.html
+$ wget http://www.example.com/page.html
 @end verbatim
 
 But most web pages contain links to images, CSS and JavaScript files,
@@ -169,7 +169,7 @@ required for complete rendering.
 documents parsing and understanding page dependencies. You can download
 the whole page with dependencies the following way:
 @verbatim
-% wget \
+$ wget \
     --page-requisites \
     --convert-links \
     --adjust-extension \
@@ -183,15 +183,15 @@ that will create @file{www.example.com} directory with all files
 necessary to view @file{page.html} web page. You can create single file
 compressed tarball with that directory and send it to remote node:
 @verbatim
-% tar cf - www.example.com | xz -9 |
-    nncp-file - remote.node:www.example.com-page.tar.xz
+$ tar cf - www.example.com | zstd |
+    nncp-file - remote.node:www.example.com-page.tar.zst
 @end verbatim
 
 But there are multi-paged articles, there are the whole interesting
 sites you want to get in a single package. You can mirror the whole web
 site by utilizing @command{wget}'s recursive feature:
 @verbatim
-% wget \
+$ wget \
     --recursive \
     --timestamping \
     -l inf \
@@ -206,7 +206,7 @@ There is a standard for creating
 @strong{WARC}. Fortunately again, @command{wget} supports it as an
 output format.
 @verbatim
-% wget \
+$ wget \
     --warc-file www.example_com-$(date '+%Y%M%d%H%m%S') \
     --no-warc-compression \
     --no-warc-keep-log \
@@ -216,15 +216,16 @@ output format.
 That command will create uncompressed @file{www.example_com-XXX.warc}
 web archive. By default, WARCs are compressed using
 @url{https://en.wikipedia.org/wiki/Gzip, gzip}, but, in example above,
-we have disabled it to compress with stronger @command{xz}, before
-sending via @command{nncp-file}.
+we have disabled it to compress with stronger and faster
+@url{https://en.wikipedia.org/wiki/Zstd, zstd}, before sending via
+@command{nncp-file}.
 
 There are plenty of software acting like HTTP proxy for your browser,
 allowing to view that WARC files. However you can extract files from
 that archive using @url{https://pypi.python.org/pypi/Warcat, warcat}
 utility, producing usual directory hierarchy:
 @verbatim
-% python3 -m warcat extract \
+$ python3 -m warcat extract \
     www.example_com-XXX.warc \
     --output-dir www.example.com-XXX \
     --progress
@@ -255,12 +256,12 @@ Also you can prepare
 @url{http://aria2.github.io/manual/en/html/aria2c.html#files, input file}
 with the jobs you want to download:
 @verbatim
-% cat jobs
+$ cat jobs
 http://www.nncpgo.org/download/nncp-0.11.tar.xz
     out=nncp.txz
 http://www.nncpgo.org/download/nncp-0.11.tar.xz.sig
     out=nncp.txz.sig
-% aria2c \
+$ aria2c \
     --on-download-complete aria2-downloaded.sh \
     --input-file jobs
 @end verbatim
@@ -275,7 +276,7 @@ remote node. But one wish to remotely initiate downloading. That can be
 easily solved with @ref{CfgExec, exec} handles.
 
 @verbatim
-exec:
+exec: {
   warcer: ["/bin/sh", "/path/to/warcer.sh"]
   wgeter: ["/bin/sh", "/path/to/wgeter.sh"]
   aria2c: [
@@ -283,6 +284,7 @@ exec:
     "--on-download-complete", "aria2-downloaded.sh",
     "--on-bt-download-complete", "aria2-downloaded.sh"
   ]
+}
 @end verbatim
 
 @file{warcer.sh} contents:
@@ -295,11 +297,11 @@ Now you can queue that node to send you some website's page, file or
 BitTorrents:
 
 @verbatim
-% echo http://www.nncpgo.org/Postfix.html |
+$ echo http://www.nncpgo.org/Postfix.html |
     nncp-exec remote.node warcer postfix-whole-page
-% echo http://www.nncpgo.org/Postfix.html |
+$ echo http://www.nncpgo.org/Postfix.html |
     nncp-exec remote.node wgeter postfix-html-page
-% echo \
+$ echo \
     http://www.nncpgo.org/download/nncp-0.11.tar.xz
     http://www.nncpgo.org/download/nncp-0.11.tar.xz.sig |
     nncp-exec remote.node aria2c
@@ -315,30 +317,30 @@ everything you need.
 
 Use it to create bundles containing all required blobs/trees/commits and tags:
 @verbatim
-% git bundle create repo-initial.bundle master --tags --branches
-% git tag -f last-bundle
-% nncp-file repo-initial.bundle remote.node:repo-$(date % '+%Y%M%d%H%m%S').bundle
+$ git bundle create repo-initial.bundle master --tags --branches
+$ git tag -f last-bundle
+$ nncp-file repo-initial.bundle remote.node:repo-$(date % '+%Y%M%d%H%m%S').bundle
 @end verbatim
 
 Do usual working with the Git: commit, add, branch, checkout, etc. When
 you decide to queue your changes for sending, create diff-ed bundle and
 transfer them:
 @verbatim
-% git bundle create repo-$(date '+%Y%M%d%H%m%S').bundle last-bundle..master
+$ git bundle create repo-$(date '+%Y%M%d%H%m%S').bundle last-bundle..master
 or maybe
-% git bundle create repo-$(date '+%Y%M%d').bundle --since=10.days master
+$ git bundle create repo-$(date '+%Y%M%d').bundle --since=10.days master
 @end verbatim
 
 Received bundle on remote machine acts like usual remote:
 @verbatim
-% git clone -b master repo-XXX.bundle
+$ git clone -b master repo-XXX.bundle
 @end verbatim
 overwrite @file{repo.bundle} file with newer bundles you retrieve and
 fetch all required branches and commits:
 @verbatim
-% git pull # assuming that origin remote points to repo.bundle
-% git fetch repo.bundle master:localRef
-% git ls-remote repo.bundle
+$ git pull # assuming that origin remote points to repo.bundle
+$ git fetch repo.bundle master:localRef
+$ git ls-remote repo.bundle
 @end verbatim
 
 Bundles are also useful when cloning huge repositories (like Linux has).
@@ -349,6 +351,11 @@ HTTP/FTP/NNCP resuming capabilities. After you fetch repository via the
 bundle, you can add an ordinary @file{git://} remote and fetch the
 difference.
 
+Also you can find the following exec-handler useful:
+@verbatiminclude git-bundler.sh
+And it allows you to request for bundles like that:
+@code{echo some-old-commit..master | nncp-exec REMOTE bundler REPONAME}.
+
 @node Multimedia
 @section Integration with multimedia streaming
 
@@ -360,7 +367,7 @@ and @emph{YouTube}.
 
 When you multimedia becomes an ordinary file, you can transfer it easily.
 @verbatim
-% youtube-dl \
+$ youtube-dl \
     --exec 'nncp-file {} remote.node:' \
     'https://www.youtube.com/watch?list=PLd2Cw8x5CytxPAEBwzilrhQUHt_UN10FJ'
 @end verbatim
index c597a0f8c34d14a5d4e63cd9d82c20c53d240c9e..cc1e587fc737428d3f1be0c08a56cf645720464d 100644 (file)
@@ -20,9 +20,8 @@ uid   NNCP releases <releases at nncpgo dot org>
 
 @item
 @verbatim
-% gpg --keyserver hkp://keys.gnupg.net/ --recv-keys 0x2B25868E75A1A953
-% gpg --auto-key-locate dane --locate-keys releases at nncpgo dot org
-% gpg --auto-key-locate wkd --locate-keys releases at nncpgo dot org
+$ gpg --auto-key-locate dane --locate-keys releases at nncpgo dot org
+$ gpg --auto-key-locate wkd --locate-keys releases at nncpgo dot org
 @end verbatim
 
 @item
@@ -32,5 +31,5 @@ uid   NNCP releases <releases at nncpgo dot org>
 
 Then you could verify tarballs signature:
 @verbatim
-% gpg --verify nncp-3.1.tar.xz.sig nncp-3.1.tar.xz
+$ gpg --verify nncp-5.0.0.tar.xz.sig nncp-5.0.0.tar.xz
 @end verbatim
index 25865b770e65f091420be964a273ee72a388159e..828a3cd152d221ff7f86b6e5f9868b0f0d1a578b 100644 (file)
 @node Новости
 @section Новости
 
+@node Релиз 5.0.0
+@subsection Релиз 5.0.0
+@itemize
+
+@item
+@strong{Несовместимое} изменение формата конфигурационного файла:
+YAML заменён на Hjson, из-за его гораздо большей простоты, без
+заметного потеря функционала и удобства.
+
+@item
+@strong{Несовместимое} изменение формата простых пакетов. Работа со
+старыми версиями не поддерживается. @code{zlib} сжатие заменено на
+@code{Zstandard}, так как оно значительно быстрее и эффективнее, не
+смотря на то, что версия библиотеки ещё не проверена временем.
+
+@item
+Возможность соединяться с удалёнными нодами не только по TCP, но и через
+pipe вызов сторонней команды.
+
+@item
+@command{nncp-cfgnew} генерирует конфигурационный файл с множеством
+комментариев. Можно использовать @option{-nocomments} опцию для старого
+поведения.
+
+@item
+Дубликаты имён файлов имеют суффикс @file{.CTR}, вместо @file{CTR},
+чтобы избежать возможных коллизий с @file{.nncp.chunkCTR}.
+
+@item
+Возможность переопределить umask процесса через опцию конфигурационного
+файла.
+
+@item
+По умолчанию файлы и директории создаются с 666/777 правами доступа,
+позволяя управлять ими @command{umask}-ом.
+
+@item
+Обновлены зависимости.
+
+@item
+Полное использование go модулей для управления зависимостями
+(используется @code{go.cypherpunks.ru/nncp/v5} namespace).
+
+@item
+Отмена автоматического использования более новых версий GNU GPL
+(лицензия проекта GNU GPLv3-только).
+
+@end itemize
+
 @node Релиз 4.1
 @subsection Релиз 4.1
 @itemize
-@item
-Восстановлена работоспособность на GNU/Linux системах и Go версии 1.10.
+@item Восстановлена работоспособность на GNU/Linux системах и Go версии 1.10.
 @end itemize
 
 @node Релиз 4.0
 @subsection Релиз 4.0
 @itemize
+
 @item
 @strong{Несовместимое} изменение формата зашифрованных и eblob пакетов:
 используется AEAD режим шифрования с 128 КиБ блоками, так как раньше
 @command{nncp-toss} не проверял MAC зашифрованного пакета прежде чем
 отсылать дешифрованные данные внешней команде. Старые версии не
 поддерживаются.
+
 @item
 Проверка доступного места перед копированием во время работы
 @command{nncp-xfer}, @command{nncp-daemon}, @command{nncp-call(er)}.
+
 @item
 @command{nncp-call} имеет возможность только показывать список пакетов
 на удалённой машине, без их передачи.
+
 @item
 @command{nncp-call} имеет возможность передавать только чётко указанные пакеты.
+
 @item
 Восстановлена работоспособность @option{xxrate} настройки в
 @option{calls} секции конфигурационного файла.
+
 @item
 Зависимые библиотеки обновлены.
+
 @item
 Небольшие исправления ошибок.
+
 @item
 Начало использования @code{go.mod} подсистемы.
+
 @end itemize
 
 @node Релиз 3.4
 @subsection Релиз 3.4
 @itemize
-@item
-@command{nncp-daemon} может быть запущен как @command{inetd}-служба.
+@item @command{nncp-daemon} может быть запущен как @command{inetd}-служба.
 @end itemize
 
 @node Релиз 3.3
 @subsection Релиз 3.3
 @itemize
+
 @item
 @command{nncp-daemon}, @command{nncp-call}, @command{nncp-caller}
 проверяют существование @file{.seen} файла и расценивают его как то, что
 файл уже был скачан. Возможно передача данных была осуществлена
 сторонним способом и удалённая сторона должна быть оповещена об этом.
+
 @item
 Если более высокоприоритетный пакет попадает в спул, то
 @command{nncp-daemon} добавит его в очередь отправки первым, прерывая
 низкоприоритетные передачи.
+
 @item
 К средствам связанным с online-соединениями (@command{nncp-daemon},
 @command{nncp-call}, @command{nncp-caller}) добавлен простой
 ограничитель скорости.
+
 @item
 Возможность задания приоритета символьными обозначениями:
 @verb{|NORMAL|}, @verb{|BULK+10|}, @verb{|PRIORITY-5|}, итд.
+
 @item
 Изменены значения приоритетов по-умолчанию:
 для @command{nncp-exec} с 64 на 96,
 для @command{nncp-freq} с 64 на 160,
 для @command{nncp-file} с 196 на 224.
+
 @end itemize
 
 @node Релиз 3.2
 @node Релиз 3.0
 @subsection Релиз 3.0
 @itemize
+
 @item
 @strong{Несовместимое} изменение формата простых пакетов. Работа со
 старыми версиями не поддерживается.
+
 @item
 Добавлена возможность удалённого исполнения команд, путём
 конфигурирования @option{exec} опции конфигурационного файла и
     @option{exec}. @verb{|sendmail: [...]|} нужно заменить на @verb{|exec:
     sendmail: [...]|}.
     @end itemize
+
 @item
 Возможность переопределить @option{via} опцию конфигурации для целевого
 узла через @option{-via} опцию командной строки для следующих команд:
 @command{nncp-file}, @command{nncp-freq}, @command{nncp-exec}.
+
 @item
 Chunked файлы, меньшего размера чем указанный chunk, отправляются просто
 в виде одного файла.
+
 @item
 Exec команды вызываются с дополнительными переменными окружения
 @env{NNCP_NICE} и @env{NNCP_SELF}.
+
 @item
 Отправляемые файлы в ответ на запрос имеют приоритет указанный в запросе.
 Указать их желаемый приоритет во время вызова @command{nncp-freq} можно
 аргументом @option{-replynice}.
+
 @item
 Команде @command{nncp-toss} можно сказать не обрабатывать определённые
 типы пакетов, за счёт опций @option{-nofile}, @option{-nofreq},
 @option{-noexec}, @option{-notrns}.
+
 @item
 По-умолчанию @command{nncp-file} команда для
 @option{-minsize}/@option{-chunked} опций использует
 @option{FreqMinSize}/@option{FreqChunked} из конфигурационного файла.
 Это можно отключить указав нулевое значение.
+
 @end itemize
 
 @node Релиз 2.0
 @subsection Релиз 2.0
 @itemize
+
 @item
 @strong{Несовместимое} изменение формата зашифрованных и eblob пакетов.
 Работа со старыми версиями не поддерживается.
+
 @item
 Алгоритм шифрования Twofish заменён на ChaCha20. Он намного быстрее.
 Одним криптографическим примитивом меньше.
+
 @item
 HKDF-BLAKE2b-256 KDF алгоритм заменён на BLAKE2Xb XOF. Ещё одним
 криптографическим примитивом меньше (предполагая, что BLAKE2X
 практически идентичен BLAKE2).
+
 @end itemize
 
 @node Релиз 1.0
 @subsection Релиз 1.0
 @itemize
+
 @item
 @strong{Несовместимое} изменение формата зашифрованных пакетов. Работа
 со старыми версиями не поддерживается.
+
 @item
 @command{nncp-bundle} команда может создавать потоки зашифрованных
 пакетов или потреблять их. Это полезно когда речь идёт о stdin/stdout
 методах передачи (например запись на CD-ROM без создания промежуточного
 подготовленного ISO образа или работа с ленточными накопителями).
+
 @item
 @command{nncp-toss} команда может создавать @file{.seen} файлы,
 предотвращая приём дублированных пакетов.
+
 @item
 В команде @command{nncp-call} разрешается иметь только одного
 обработчика контрольной суммы в фоне. Это полезно когда тысячи маленьких
 входящих пакетов могут создать много горутин.
+
 @item
 Возможность переопределить путь до spool директории и файла журнала
 через аргумент командной строки или переменную окружения.
+
 @item
 @command{nncp-rm} команда может удалять все исходящие/входящие,
 @file{.seen}, @file{.part}, @file{.lock} и временные файлы.
+
 @end itemize
 
 @node Релиз 0.12
 @subsection Релиз 0.12
 @itemize
-@item
-Команда sendmail вызывается с @env{NNCP_SENDER} переменной окружения.
+@item Команда sendmail вызывается с @env{NNCP_SENDER} переменной окружения.
 @end itemize
 
 @node Релиз 0.11
 @subsection Релиз 0.11
 @itemize
-@item
-Вывод команды @command{nncp-stat} отсортирован по имени ноды.
+@item Вывод команды @command{nncp-stat} отсортирован по имени ноды.
 @end itemize
 
 @node Релиз 0.10
@@ -217,6 +297,7 @@ HKDF-BLAKE2b-256 KDF алгоритм заменён на BLAKE2Xb XOF. Ещё 
 @node Релиз 0.7
 @subsection Релиз 0.7
 @itemize
+
 @item
 Возможность предоставлять данные для @command{nncp-file} через
 стандартный ввод, используя временный зашифрованный файл для этого.
@@ -243,12 +324,14 @@ HKDF-BLAKE2b-256 KDF алгоритм заменён на BLAKE2Xb XOF. Ещё 
 а @command{nncp-mincfg} в @command{nncp-cfgmin}, для того чтобы они
 имели общий префикс и были сгруппированы для удобства.
 
-@item Появилась команда @command{nncp-cfgenc}, позволяющая
+@item
+Появилась команда @command{nncp-cfgenc}, позволяющая
 шифровать/дешифровать конфигурационный файл, чтобы безопасно его хранить
 без использования OpenPGP или других подобных инструментов.
 
 @item
 Обновлены зависимые криптографические библиотеки.
+
 @end itemize
 
 @node Релиз 0.6
@@ -261,46 +344,68 @@ HKDF-BLAKE2b-256 KDF алгоритм заменён на BLAKE2Xb XOF. Ещё 
 @node Релиз 0.5
 @subsection Релиз 0.5
 @itemize
-@item Тривиальное небольшое исправление в значениях приоритетов
-по-умолчанию в @command{nncp-file} и @command{nncp-freq} командах.
+@item
+Тривиальное небольшое исправление в значениях приоритетов по-умолчанию в
+@command{nncp-file} и @command{nncp-freq} командах.
 @end itemize
 
 @node Релиз 0.4
 @subsection Релиз 0.4
 @itemize
-@item Небольшое исправление в @command{nncp-call}, @command{nncp-caller},
+
+@item
+Небольшое исправление в @command{nncp-call}, @command{nncp-caller},
 @command{nncp-daemon}: иногда они могли падать с segmentation fault
 ошибкой (данные не терялись).
-@item @command{nncp-newnode} переименована в @command{nncp-newcfg} --
+
+@item
+@command{nncp-newnode} переименована в @command{nncp-newcfg} --
 это короче и удобнее для использования.
-@item Появилась команда @command{nncp-mincfg}: вспомогательная утилита
+
+@item
+Появилась команда @command{nncp-mincfg}: вспомогательная утилита
 позволяющая создать минималистичный урезанный конфигурационный файл без
 приватных ключей, что полезно во время использования @command{nncp-xfer}.
+
 @end itemize
 
 @node Релиз 0.3
 @subsection Релиз 0.3
-Исправлена совместимость с Go 1.6.
+@itemize
+@item Исправлена совместимость с Go 1.6.
+@end itemize
 
 @node Релиз 0.2
 @subsection Релиз 0.2
 @itemize
-@item @strong{Несовместимое} изменение формата пакета (магическое число
-тоже изменено): поле размера пакета шифруется и не посылается в открытом
-виде.
-@item @option{-minsize} опция даёт возможность автоматически дополнять
+
+@item
+@strong{Несовместимое} изменение формата пакета (магическое число тоже
+изменено): поле размера пакета шифруется и не посылается в открытом виде.
+
+@item
+@option{-minsize} опция даёт возможность автоматически дополнять
 исходящие пакеты до указанного минимального размера.
-@item @command{nncp-daemon} и
-@command{nncp-call}/@command{nncp-caller} всегда в фоне проверяют появление
-исходящих @emph{tx} пакетов пока подключены. Удалённая сторона сразу же
-оповещается об этом.
-@item @option{-onlinedeadline} опция даёт возможность выставления
-timeout-а на неактивность в online соединении, когда оно должно быть
-отключено. Она может быть использована для сохранения соединения на
-долгое время.
-@item @option{-maxonlinetime} опция даёт возможность указания
-максимального возможного времени жизни соединения.
-@item Появилась @command{nncp-caller} команда: клиент TCP-демона
-работающий по cron-у.
-@item @command{nncp-pkt} команда может разжимать данные.
+
+@item
+@command{nncp-daemon} и @command{nncp-call}/@command{nncp-caller} всегда
+в фоне проверяют появление исходящих @emph{tx} пакетов пока подключены.
+Удалённая сторона сразу же оповещается об этом.
+
+@item
+@option{-onlinedeadline} опция даёт возможность выставления timeout-а на
+неактивность в online соединении, когда оно должно быть отключено. Она
+может быть использована для сохранения соединения на долгое время.
+
+@item
+@option{-maxonlinetime} опция даёт возможность указания максимального
+возможного времени жизни соединения.
+
+@item
+Появилась @command{nncp-caller} команда: клиент TCP-демона работающий по
+cron-у.
+
+@item
+@command{nncp-pkt} команда может разжимать данные.
+
 @end itemize
index 839effc005f6fe99d20d0f8f42b38e963a4dddc8..b57c5ea567e3d07c1724ce98c58b2613c39a17d1 100644 (file)
 
 See also this page @ref{Новости, on russian}.
 
+@node Release 5.0.0
+@section Release 5.0.0
+@itemize
+
+@item
+@strong{Incompatible} configuration file format change: YAML is
+replaced with Hjson, due to its simplicity, without noticeable lack
+of either functionality or convenience.
+
+@item
+@strong{Incompatible} plain packet format changes. Older versions are
+not supported. @code{zlib} compression is replaced with
+@code{Zstandard}, due to its speed and efficiency, despite library
+version is not mature enough.
+
+@item
+Ability to call remote nodes via pipe call of external command, not only
+through TCP.
+
+@item
+@command{nncp-cfgnew} generates configuration file with many
+comments. @option{-nocomments} option can be used for an old
+behaviour.
+
+@item
+Duplicate filenames have @file{.CTR} suffix, instead of @file{CTR}, to
+avoid possible collisions with @file{.nncp.chunkCTR}.
+
+@item
+Ability to override process umask through configuration file option.
+
+@item
+Files and directories are created with 666/777 permissions by default,
+allowing control with @command{umask}.
+
+@item
+Updated dependencies.
+
+@item
+Full usage of go modules for dependencies management
+(@code{go.cypherpunks.ru/nncp/v5} namespace is used).
+
+@item
+Forbid any later GNU GPL version autousage
+(project's licence now is GNU GPLv3-only).
+
+@end itemize
+
 @node Release 4.1
 @section Release 4.1
 @itemize
-@item
-Workability on GNU/Linux systems and Go 1.10 is fixed.
+@item Workability on GNU/Linux systems and Go 1.10 is fixed.
 @end itemize
 
 @node Release 4.0
 @section Release 4.0
 @itemize
+
 @item
 @strong{Incompatible} encrypted and eblob packet format change: AEAD
 encryption mode with 128 KiB blocks is used now, because previously
 @command{nncp-toss} did not verify encrypted packet's MAC before feeding
 decrypted data to external command. Older versions are not supported.
+
 @item
 Available free space checking before copying in @command{nncp-xfer},
 @command{nncp-daemon}, @command{nncp-call(er)}.
+
 @item
 @command{nncp-call} has ability only to list packets on remote node,
 without their transmission.
+
 @item
 @command{nncp-call} has ability to transfer only specified packets.
+
 @item
 Workability of @option{xxrate} preference in @option{calls}
 configuration file section.
+
 @item
 Dependant libraries are updated.
+
 @item
 Minor bugfixes.
+
 @item
 Begin using of @code{go.mod} subsystem.
+
 @end itemize
 
 @node Release 3.4
 @section Release 3.4
 @itemize
-@item
-@command{nncp-daemon} can be run as @command{inetd}-service.
+@item @command{nncp-daemon} can be run as @command{inetd}-service.
 @end itemize
 
 @node Release 3.3
 @section Release 3.3
 @itemize
+
 @item
 @command{nncp-daemon}, @command{nncp-call}, @command{nncp-caller} check
 if @file{.seen} exists and treat it like file was already downloaded.
 Possibly it was transferred out-of-bound and remote side needs to be
 notifier about that.
+
 @item
 If higher priority packet is spooled, then @command{nncp-daemon} will
 queue its sending first, interrupting lower priority transmissions.
+
 @item
 Simple packet rate limiter added to online-related tools
 (@command{nncp-daemon}, @command{nncp-call}, @command{nncp-caller}).
+
 @item
 Ability to specify niceness with symbolic notation:
 @verb{|NORMAL|}, @verb{|BULK+10|}, @verb{|PRIORITY-5|}, etc.
+
 @item
 Changed default niceness levels:
 for @command{nncp-exec} from 64 to 96,
 for @command{nncp-freq} from 64 to 160,
 for @command{nncp-file} from 196 to 224.
+
 @end itemize
 
 @node Release 3.2
@@ -90,9 +151,11 @@ Ability to disable relaying at all using @verb{|-via -|} command line option.
 @node Release 3.0
 @section Release 3.0
 @itemize
+
 @item
 @strong{Incompatible} plain packet format changes. Older versions are
 not supported.
+
 @item
 Ability to queue remote command execution, by configuring @option{exec}
 option in configuration file and using @command{nncp-exec} command:
@@ -106,84 +169,100 @@ option in configuration file and using @command{nncp-exec} command:
     @option{exec}. @verb{|sendmail: [...]|} must be replaced with
     @verb{|exec: sendmail: [...]|}.
     @end itemize
+
 @item
 Ability to override @option{via} configuration option for destination
 node via @option{-via} command line option for following commands:
 @command{nncp-file}, @command{nncp-freq}, @command{nncp-exec}.
+
 @item
 Chunked files, having size less than specified chunk size, will be sent
 as an ordinary single file.
+
 @item
 Exec commands are invoked with additional @env{NNCP_NICE} and
 @env{NNCP_SELF} environment variables.
+
 @item
 Files, that are sent as a reply to freq, have niceness level taken from
 the freq packet. You can set desired niceness during @command{nncp-freq}
 invocation using @option{-replynice} option.
+
 @item
 @command{nncp-toss} command can ignore specified packet types during
 processing: @option{-nofile}, @option{-nofreq}, @option{-noexec},
 @option{-notrns}.
+
 @item
 @command{nncp-file} command uses
 @option{FreqMinSize}/@option{FreqChunked} configuration file options
 for @option{-minsize}/@option{-chunked} by default. You can turn this
 off by specifying zero value.
+
 @end itemize
 
 @node Release 2.0
 @section Release 2.0
 @itemize
+
 @item
 @strong{Incompatible} encrypted/eblob packet format changes. Older
 versions are not supported.
+
 @item
 Twofish encryption algorithm is replaced with ChaCha20. It is much more
 faster. One cryptographic primitive less.
+
 @item
 HKDF-BLAKE2b-256 KDF algorithm is replaced with BLAKE2Xb XOF. Yet
 another cryptographic primitive less (assuming that BLAKE2X is nearly
 identical to BLAKE2).
+
 @end itemize
 
 @node Release 1.0
 @section Release 1.0
 @itemize
+
 @item
 @strong{Incompatible} encrypted packet format changes. Older versions
 are not supported.
+
 @item
 @command{nncp-bundle} command can either create stream of encrypted
 packets, or digest it. It is useful when dealing with stdin/stdout based
 transmission methods (like writing to CD-ROM without intermediate
 prepared ISO image and working with tape drives).
+
 @item
 @command{nncp-toss} is able to create @file{.seen} files preventing
 duplicate packets receiving.
+
 @item
 Single background checksum verifier worker is allowed in
 @command{nncp-call}. This is helpful when thousands of small inbound
 packets could create many goroutines.
+
 @item
 Ability to override path to spool directory and logfile through either
 command line argument, or environment variable.
+
 @item
 @command{nncp-rm} is able to delete outbound/inbound, @file{.seen},
 @file{.part}, @file{.lock} and temporary files.
+
 @end itemize
 
 @node Release 0.12
 @section Release 0.12
 @itemize
-@item
-Sendmail command is called with @env{NNCP_SENDER} environment variable.
+@item Sendmail command is called with @env{NNCP_SENDER} environment variable.
 @end itemize
 
 @node Release 0.11
 @section Release 0.11
 @itemize
-@item
-@command{nncp-stat}'s command output is sorted by node name.
+@item @command{nncp-stat}'s command output is sorted by node name.
 @end itemize
 
 @node Release 0.10
@@ -213,6 +292,7 @@ option for unchunked transfer was not in KiBs, but in bytes.
 @node Release 0.7
 @section Release 0.7
 @itemize
+
 @item
 Ability to feed @command{nncp-file} from stdin, that uses an encrypted
 temporary file for that.
@@ -246,6 +326,7 @@ similar tools usage.
 
 @item
 Cryptographic libraries (dependencies) are updated.
+
 @end itemize
 
 @node Release 0.6
@@ -258,44 +339,67 @@ Cryptographic libraries (dependencies) are updated.
 @node Release 0.5
 @section Release 0.5
 @itemize
-@item Trivial small fix in default niceness level of @command{nncp-file}
+@item
+Trivial small fix in default niceness level of @command{nncp-file}
 and @command{nncp-freq} commands.
 @end itemize
 
 @node Release 0.4
 @section Release 0.4
 @itemize
-@item Small fix in @command{nncp-call}, @command{nncp-caller},
+
+@item
+Small fix in @command{nncp-call}, @command{nncp-caller},
 @command{nncp-daemon}: they can segmentation fail sometimes (no data is
 lost).
-@item @command{nncp-newnode} renamed to @command{nncp-newcfg} -- it is
-shorter and more convenient to use.
-@item @command{nncp-mincfg} command appeared: helper allowing to create
-minimalistic stripped down configuration file without private keys,
-that is useful during @command{nncp-xfer} usage.
+
+@item
+@command{nncp-newnode} renamed to @command{nncp-newcfg} -- it is shorter
+and more convenient to use.
+
+@item
+@command{nncp-mincfg} command appeared: helper allowing to create
+minimalistic stripped down configuration file without private keys, that
+is useful during @command{nncp-xfer} usage.
+
 @end itemize
 
 @node Release 0.3
 @section Release 0.3
-Fixed compatibility with Go 1.6.
+@itemize
+@item Fixed compatibility with Go 1.6.
+@end itemize
 
 @node Release 0.2
 @section Release 0.2
 @itemize
-@item @strong{Incompatible} packet's format change (magic number is
-changed too): size field is encrypted and is not send in plaintext
-anymore.
-@item @option{-minsize} option gives ability to automatically pad
-outgoing packets to specified minimal size.
-@item @command{nncp-daemon} and
-@command{nncp-call}/@command{nncp-caller} always check new @emph{tx}
-packets appearance in the background while connected. Remote side is
-immediately notified.
-@item @option{-onlinedeadline} option gives ability to configure timeout
-of inactivity of online connection, when it could be disconnected. It
-could be used to keep connection alive for a long time.
-@item @option{-maxonlinetime} option gives ability to set maximal
-allowable online connection aliveness time.
-@item @command{nncp-caller} command appeared: cron-ed TCP daemon caller.
-@item @command{nncp-pkt} command can decompress the data.
+
+@item
+@strong{Incompatible} packet's format change (magic number is changed
+too): size field is encrypted and is not send in plaintext anymore.
+
+@item
+@option{-minsize} option gives ability to automatically pad outgoing
+packets to specified minimal size.
+
+@item
+@command{nncp-daemon} and @command{nncp-call}/@command{nncp-caller}
+always check new @emph{tx} packets appearance in the background while
+connected. Remote side is immediately notified.
+
+@item
+@option{-onlinedeadline} option gives ability to configure timeout of
+inactivity of online connection, when it could be disconnected. It could
+be used to keep connection alive for a long time.
+
+@item
+@option{-maxonlinetime} option gives ability to set maximal allowable
+online connection aliveness time.
+
+@item
+@command{nncp-caller} command appeared: cron-ed TCP daemon caller.
+
+@item
+@command{nncp-pkt} command can decompress the data.
+
 @end itemize
index d216f93e96d9d05e614c30f9f39a343b833ab552..f7bbe564c5b9ef7702177055af7e23ae3f2e914c 100644 (file)
@@ -28,7 +28,7 @@ drive.
 @headitem @tab XDR type @tab Value
 @item Magic number @tab
     8-byte, fixed length opaque data @tab
-    @verb{|N N C P P 0x00 0x00 0x02|}
+    @verb{|N N C P P 0x00 0x00 0x03|}
 @item Payload type @tab
     unsigned integer @tab
     0 (file), 1 (freq), 2 (exec), 3 (transition)
@@ -58,7 +58,7 @@ Depending on the packet's type, payload could store:
 @itemize
 @item File contents
 @item Destination path for freq
-@item @url{http://zlib.net/, zlib} compressed exec body
+@item @url{https://facebook.github.io/zstd/, Zstandard} compressed exec body
 @item Whole encrypted packet we need to relay on
 @end itemize
 
diff --git a/doc/platforms.texi b/doc/platforms.texi
deleted file mode 100644 (file)
index a162de2..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-@node Platform-specific
-@section Platform-specific instructions
-
-@node General
-@subsection General installation instructions
-
-Look @ref{Integrity, here} for finding public keys for tarball authentication.
-
-@verbatim
-% wget http://www.nncpgo.org/download/nncp-3.1.tar.xz
-% wget http://www.nncpgo.org/download/nncp-3.1.tar.xz.sig
-% gpg --verify nncp-3.1.tar.xz.sig nncp-3.1.tar.xz
-% xz -d nncp-3.1.tar.xz
-% tar xf nncp-3.1.tar
-% make -C nncp-3.1 all
-@end verbatim
-
-There is @command{install} target respecting @env{DESTDIR}. It will
-install binaries and info-documentation.
-
-@node Ubuntu
-@subsection Ubuntu installation instructions
-
-Look @ref{Integrity, here} for finding public keys for tarball authentication.
-
-@table @asis
-@item Ubuntu 16.04
-
-@verbatim
-# apt install golang
-@end verbatim
-
-follow @ref{General, general} installation instructions
-
-@verbatim
-# make -C nncp-3.1 install PREFIX=/usr
-@end verbatim
-
-@item Ubuntu 14.04
-
-@verbatim
-# apt-get install golang-1.6
-% wget http://www.nncpgo.org/download/nncp-3.1.tar.xz
-% wget http://www.nncpgo.org/download/nncp-3.1.tar.xz.sig
-% gpg --verify nncp-3.1.tar.xz.sig nncp-3.1.tar.xz
-% tar xf nncp-3.1.tar.xz
-% PATH=/usr/lib/go-1.6/bin:$PATH make -C nncp-3.1 all
-# make -C nncp-3.1 install PREFIX=/usr
-@end verbatim
-
-@end table
index 38de61a5a2289514758241496b60e0623006a790..2ded27ca827a3286b2eac472973d23b2115498c4 100644 (file)
@@ -6,15 +6,10 @@ be buggy. It does not contain compiled documentation and dependent
 libraries source code. Because of that, it is recommended for porters
 to use @ref{Tarballs, tarballs} instead.
 
-You can obtain it by cloning @url{http://git-scm.com/, Git}
-@url{https://git.cypherpunks.ru/cgit.cgi/nncp.git/log/, repository}
-and fetching dependent libraries source code as git submodules:
-
 @verbatim
-% git clone git://git.cypherpunks.ru/nncp.git nncp
-% cd nncp
-% git checkout develop
-% git submodule update --init
+$ git clone git://git.cypherpunks.ru/nncp.git
+$ cd nncp
+$ git checkout develop
 @end verbatim
 
 Also there is mirror of dependent libraries for safety if their native
@@ -25,10 +20,12 @@ repositories will be unavailable (they are seldom updated):
 @item @code{github.com/davecgh/go-xdr} @tab @url{git://git.cypherpunks.ru/go-xdr.git}
 @item @code{github.com/dustin/go-humanize} @tab @url{git://git.cypherpunks.ru/go-humanize.git}
 @item @code{github.com/flynn/noise} @tab @url{git://git.cypherpunks.ru/noise.git}
+@item @code{github.com/google/go-cmp} @tab @url{git://git.cypherpunks.ru/go-cmp.git}
 @item @code{github.com/gorhill/cronexpr} @tab @url{git://git.cypherpunks.ru/cronexpr.git}
+@item @code{github.com/hjson/hjson-go} @tab @url{git://git.cypherpunks.ru/hjson-go.git}
+@item @code{github.com/klauspost/compress} @tab @url{git://git.cypherpunks.ru/compress.git}
 @item @code{golang.org/x/crypto} @tab @url{git://git.cypherpunks.ru/crypto.git}
 @item @code{golang.org/x/net} @tab @url{git://git.cypherpunks.ru/net.git}
 @item @code{golang.org/x/sys} @tab @url{git://git.cypherpunks.ru/sys.git}
 @item @code{gopkg.in/check.v1} @tab @url{git://git.cypherpunks.ru/check.git}
-@item @code{gopkg.in/yaml.v2} @tab @url{git://git.cypherpunks.ru/yaml.git}
 @end multitable
index da05881bcab828d0e636e16d18fab1df05a2f8ea..677d2ac524430804106ae31efa563f1dd9af991d 100644 (file)
@@ -26,7 +26,7 @@ Postfix} SMTP сервер подключённый к Интернету. Но
 ноутбук подключён?
 
 Одна из возможностей это войти на сервер и сделать что-то типа
-@command{postqueue -f}, но по-умолчанию у вас есть только несколько дней
+@command{postqueue -f}, но по умолчанию у вас есть только несколько дней
 на это, плюс отправитель будет получать уведомления о том, что его
 сообщение всё ещё не доставлено. Кроме того, вы должны использовать
 безопасный канал связи (SSH, VPN, итд).
@@ -80,8 +80,8 @@ IMAP4, как правило, нет). У вас легковесный, сжа
 Команды:
 
 @verbatim
-% nncp-file file_i_want_to_send bob:
-% nncp-file another_file bob:movie.avi
+$ nncp-file file_i_want_to_send bob:
+$ nncp-file another_file bob:movie.avi
 @end verbatim
 
 добавят в очередь отправки два файла для узла @emph{bob}.
@@ -106,9 +106,9 @@ NNCP поддерживает @ref{Niceness, приоритезацию траф
 опцию:
 
 @verbatim
-% nncp-file -nice FLASH myfile node:dst
-% nncp-xfer -nice PRIORITY /mnt/shared
-% nncp-call -nice NORMAL bob
+$ nncp-file -nice FLASH myfile node:dst
+$ nncp-xfer -nice PRIORITY /mnt/shared
+$ nncp-call -nice NORMAL bob
 [...]
 @end verbatim
 
@@ -119,8 +119,8 @@ NNCP поддерживает @ref{Niceness, приоритезацию траф
 Вы также можете использовать CD-ROM и ленточные накопители:
 
 @verbatim
-% nncp-bundle -tx bob | cdrecord -tao -
-% nncp-bundle -tx bob | dd of=/dev/sa0 bs=10240
+$ nncp-bundle -tx bob | cdrecord -tao -
+$ nncp-bundle -tx bob | dd of=/dev/sa0 bs=10240
 @end verbatim
 
 @node UsecaseNoLinkRU
@@ -136,7 +136,7 @@ NNCP поддерживает @ref{Niceness, приоритезацию траф
 запустите @ref{nncp-xfer}:
 
 @verbatim
-% nncp-xfer -node bob /media/usbstick
+$ nncp-xfer -node bob /media/usbstick
 @end verbatim
 
 чтобы скопировать все исходящие пакеты относящиеся к @emph{bob}.
@@ -149,14 +149,14 @@ NNCP поддерживает @ref{Niceness, приоритезацию траф
 @option{-node} опцию, чтобы скопировать все доступные исходящие пакеты.
 
 @verbatim
-% nncp-xfer /media/usbstick
+$ nncp-xfer /media/usbstick
 @end verbatim
 
 Размонтируйте и передайте накопитель Бобу и Алисе. Когда они вставят
 накопитель в свои компьютеры, то выполнят точно такую же команду:
 
 @verbatim
-% nncp-xfer /media/usbstick
+$ nncp-xfer /media/usbstick
 @end verbatim
 
 чтобы найти все пакеты относящиеся к их узлу и локально скопируют для
@@ -176,8 +176,8 @@ NNCP поддерживает @ref{Niceness, приоритезацию траф
 зашифрованных пакетов}, которые вы можете принять.
 
 @verbatim
-% nncp-bundle -tx alice bob eve ... | команда для отправки широковещательной рассылки
-% команда для приёма широковещательной рассылки | nncp-bundle -rx
+$ nncp-bundle -tx alice bob eve ... | команда для отправки широковещательной рассылки
+$ команда для приёма широковещательной рассылки | nncp-bundle -rx
 @end verbatim
 
 Встроенная возможность определять дубляжи пакетов позволит вам
@@ -244,13 +244,13 @@ NNCP поддерживает @ref{Niceness, приоритезацию траф
 транспорт с свойством совершенной прямой секретности.
 
 @verbatim
-% nncp-daemon -bind [::]:5400
+$ nncp-daemon -bind [::]:5400
 @end verbatim
 запустит TCP демон, который будет слушать входящие соединения на всех
 интерфейсах.
 
 @verbatim
-% nncp-call bob
+$ nncp-call bob
 @end verbatim
 попытается подключиться к известному TCP-адресу узла @emph{bob} (взятого
 из конфигурационного файла), послать все связанные с ним исходящие
@@ -276,14 +276,18 @@ CD-ROM, жёстких дисков, SD, лент и USB накопителей
 NNCP из коробки поддерживает ретрансляцию пакетов.
 
 @verbatim
-neigh:
-  bob:
+neigh: {
+  bob: {
     [...]
-    addrs:
-      lan: [fe80::5400%igb0]:5400
+    addrs: {
+      lan: "[fe80::5400%igb0]:5400"
+    }
+  }
   bob-airgap:
     [...]
-    via: [bob]
+    via: ["bob"]
+  }
+}
 @end verbatim
 
 Такой @ref{Configuration, конфигурационный файл} говорит что у нас есть
@@ -375,28 +379,35 @@ Bluetooth и WiFi могут быть и довольно быстрыми, по
 звонков} для @ref{nncp-caller} команды, используемой при online связи.
 
 @verbatim
-neigh:
+neigh: {
   [...]
-  some-node:
+  some-node: {
     [...]
-    addrs:
+    addrs: {
       lan: "[fe80::be5f:f4ff:fedd:2752%igb0]:5400"
       wan: "some-node.com:5400"
-    calls:
-      -
+    }
+    calls: [
+      {
         cron: "*/1 * * * *"
         addr: lan
         nice: MAX
         onlinedeadline: 3600
-      -
+      },
+      {
         cron: "*/10 * * * *"
         addr: wan
         nice: PRIORITY
         xx: rx
-      -
+      },
+      {
         cron: "*/1 0-7 * * *"
         addr: wan
         nice: BULK
         onlinedeadline: 3600
         maxonlinetime: 3600
+      },
+    ]
+  }
+}
 @end verbatim
index 1c0a750bfe15e5254bed8e6c30bfaa72ec6410c7..113089dfa23383feb0c4a79813bea7c1988d2cc5 100644 (file)
@@ -78,8 +78,8 @@ daemon}.
 The command:
 
 @verbatim
-% nncp-file file_i_want_to_send bob:
-% nncp-file another_file bob:movie.avi
+$ nncp-file file_i_want_to_send bob:
+$ nncp-file another_file bob:movie.avi
 @end verbatim
 
 will queue two files for sending to @emph{bob} node. Fire and forget!
@@ -101,9 +101,9 @@ niceness level, that will guarantee that it will be processed earlier or
 later than the other ones. Nearly all commands has corresponding option:
 
 @verbatim
-% nncp-file -nice FLASH myfile node:dst
-% nncp-xfer -nice PRIORITY /mnt/shared
-% nncp-call -nice NORMAL bob
+$ nncp-file -nice FLASH myfile node:dst
+$ nncp-xfer -nice PRIORITY /mnt/shared
+$ nncp-call -nice NORMAL bob
 [...]
 @end verbatim
 
@@ -114,8 +114,8 @@ storages.
 You can also use CD-ROM and tape drives:
 
 @verbatim
-% nncp-bundle -tx bob | cdrecord -tao -
-% nncp-bundle -tx bob | dd of=/dev/sa0 bs=10240
+$ nncp-bundle -tx bob | cdrecord -tao -
+$ nncp-bundle -tx bob | dd of=/dev/sa0 bs=10240
 @end verbatim
 
 @node UsecaseNoLink
@@ -129,7 +129,7 @@ Assume that you send two files to @emph{bob} node. Insert USB storage
 device (SD is preferable!), mount it and run @ref{nncp-xfer}:
 
 @verbatim
-% nncp-xfer -node bob /media/usbstick
+$ nncp-xfer -node bob /media/usbstick
 @end verbatim
 
 to copy all outbound packets related to @emph{bob}. Use @option{-mkdir}
@@ -141,14 +141,14 @@ If you use single storage device to transfer data both to @emph{bob} and
 outgoing packets.
 
 @verbatim
-% nncp-xfer /media/usbstick
+$ nncp-xfer /media/usbstick
 @end verbatim
 
 Unmount it and transfer storage to Bob and Alice. When they will insert
 it in their computers, they will use exactly the same command:
 
 @verbatim
-% nncp-xfer /media/usbstick
+$ nncp-xfer /media/usbstick
 @end verbatim
 
 to find all packets related to their node and copy them locally for
@@ -166,8 +166,8 @@ You can use @ref{Bundles, bundles} and stream them above. They are just
 a sequence of @ref{Encrypted, encrypted packets} you can catch on.
 
 @verbatim
-% nncp-bundle -tx alice bob eve ... | command to send broadcast
-% command to receive broadcast | nncp-bundle -rx
+$ nncp-bundle -tx alice bob eve ... | command to send broadcast
+$ command to receive broadcast | nncp-bundle -rx
 @end verbatim
 
 With built-in packet duplicates detection ability, you can retransmit
@@ -230,13 +230,13 @@ in the very first packet) secure transport with forward secrecy
 property.
 
 @verbatim
-% nncp-daemon -bind [::]:5400
+$ nncp-daemon -bind [::]:5400
 @end verbatim
 will start TCP daemon listening on all interfaces for incoming
 connections.
 
 @verbatim
-% nncp-call bob
+$ nncp-call bob
 @end verbatim
 will try to connect to @emph{bob}'s node known TCP addresses (taken from
 configuration file) and send all related outbound packets and retrieve
@@ -260,14 +260,18 @@ devices, possibly by rewriting the data from USB/hard drives to CD-RWs.
 NNCP supports packets relying (transitioning) out-of-box.
 
 @verbatim
-neigh:
-  bob:
+neigh: {
+  bob: {
     [...]
-    addrs:
-      lan: [fe80::5400%igb0]:5400
+    addrs: {
+      lan: "[fe80::5400%igb0]:5400"
+    }
+  }
   bob-airgap:
     [...]
-    via: [bob]
+    via: ["bob"]
+  }
+}
 @end verbatim
 
 That @ref{Configuration, configuration file} tells that we have got two
@@ -352,28 +356,35 @@ configurations} for @ref{nncp-caller} command used in online
 communications.
 
 @verbatim
-neigh:
+neigh: {
   [...]
-  some-node:
+  some-node: {
     [...]
-    addrs:
+    addrs: {
       lan: "[fe80::be5f:f4ff:fedd:2752%igb0]:5400"
       wan: "some-node.com:5400"
-    calls:
-      -
+    }
+    calls: [
+      {
         cron: "*/1 * * * *"
         addr: lan
         nice: MAX
         onlinedeadline: 3600
-      -
+      },
+      {
         cron: "*/10 * * * *"
         addr: wan
         nice: PRIORITY
         xx: rx
-      -
+      },
+      {
         cron: "*/1 0-7 * * *"
         addr: wan
         nice: BULK
         onlinedeadline: 3600
         maxonlinetime: 3600
+      },
+    ]
+  }
+}
 @end verbatim
index 944859251df088ea64fffa2415770e8e26bc1cda..c5582efb9135652b13b9bd0b6acfe48a409af333 100755 (executable)
@@ -19,6 +19,6 @@ wget \
     --no-warc-compression \
     --no-warc-keep-log \
     $cmdline || :
-xz -9 "$name".warc
-nncp-file -nice $NNCP_NICE "$name".warc.xz $NNCP_SENDER:
+zstd --rm "$name".warc
+nncp-file -nice $NNCP_NICE "$name".warc.zst $NNCP_SENDER:
 rm -r $tmp
index 5f80d81190264be7c68269309fb3fc580eef8b94..dea60fbf15ac29361488146e195081b127032bfa 100755 (executable)
@@ -5,6 +5,6 @@ read cmdline
 
 tmp=$(mktemp)
 wget --output-document=$tmp $cmdline
-xz -9 $tmp
-nncp-file -nice $NNCP_NICE $tmp.xz $NNCP_SENDER:$name.xz
-rm $tmp.xz
+zstd --rm $tmp
+nncp-file -nice $NNCP_NICE $tmp.zst $NNCP_SENDER:$name.zst
+rm $tmp.zst
index 7051f078da630d541ff39be1c02f0dfefc81122d..cd79f6b7455508b456d0905249e7b9e0a76029eb 100755 (executable)
@@ -5,39 +5,48 @@ tmp=$(mktemp -d)
 release=$1
 [ -n "$release" ]
 
-vendor=src/cypherpunks.ru/nncp/vendor
-
 git clone . $tmp/nncp-$release
-repos="
-    cypherpunks.ru/balloon
-    github.com/davecgh/go-xdr
-    github.com/dustin/go-humanize
-    github.com/flynn/noise
-    github.com/gorhill/cronexpr
-    golang.org/x/crypto
-    golang.org/x/net
-    golang.org/x/sys
-    gopkg.in/check.v1
-    gopkg.in/yaml.v2
+cd $tmp/nncp-$release
+git checkout v$release
+rm -fr .git
+
+mod_name=go.cypherpunks.ru/nncp/v5
+mv src src.orig
+mkdir -p src/$mod_name
+mv src.orig/* src/$mod_name
+rmdir src.orig
+
+mods="
+github.com/davecgh/go-xdr
+github.com/dustin/go-humanize
+github.com/flynn/noise
+github.com/gorhill/cronexpr
+github.com/hjson/hjson-go
+github.com/klauspost/compress
+go.cypherpunks.ru/balloon
+golang.org/x/crypto
+golang.org/x/net
+golang.org/x/sys
 "
-for repo in $repos; do
-    git clone $vendor/$repo $tmp/nncp-$release/$vendor/$repo
+for mod in $mods; do
+    mod_path=$(sed -n "s# // indirect## ; s#^  \($mod\) \(.*\)\$#\1@\2#p" src/$mod_name/go.mod)
+    [ -n "$mod_path" ]
+    mkdir -p src/$mod
+    ( cd $GOPATH/pkg/mod/$mod_path ; tar cf - --exclude ".git*" * ) | tar xfC - src/$mod
+    chmod -R +w src/$mod
 done
-cd $tmp/nncp-$release
-git checkout $release
-git submodule update --init
 
 cat > $tmp/includes <<EOF
 golang.org/x/crypto/AUTHORS
 golang.org/x/crypto/blake2b
 golang.org/x/crypto/blake2s
+golang.org/x/crypto/chacha20
 golang.org/x/crypto/chacha20poly1305
 golang.org/x/crypto/CONTRIBUTORS
 golang.org/x/crypto/curve25519
 golang.org/x/crypto/ed25519
 golang.org/x/crypto/go.mod
 golang.org/x/crypto/go.sum
-golang.org/x/crypto/internal/chacha20
 golang.org/x/crypto/internal/subtle
 golang.org/x/crypto/LICENSE
 golang.org/x/crypto/nacl
@@ -63,14 +72,32 @@ golang.org/x/sys/PATENTS
 golang.org/x/sys/README.md
 golang.org/x/sys/unix
 EOF
-tar cfCI - $vendor $tmp/includes | tar xfC - $tmp
-rm -fr $vendor/golang.org
-mv $tmp/golang.org $vendor
-rm $tmp/includes
+tar cfCI - src $tmp/includes | tar xfC - $tmp
+rm -fr src/golang.org $tmp/includes
+mv $tmp/golang.org src
+
+cat > $tmp/includes <<EOF
+compress/compressible.go
+compress/fse
+compress/huff0
+compress/LICENSE
+compress/README.md
+compress/zstd
+EOF
+cat > $tmp/excludes <<EOF
+*testdata*
+*_test.go
+snappy.go
+EOF
+tar cfCIX - src/github.com/klauspost $tmp/includes $tmp/excludes | tar xfC - $tmp
+rm -fr src/github.com/klauspost/compress $tmp/includes $tmp/excludes
+mv $tmp/compress src/github.com/klauspost
 
 find src -name .travis.yml -delete
-rm -fr $vendor/github.com/davecgh/go-xdr/xdr
-rm $vendor/github.com/gorhill/cronexpr/APLv2
+rm -fr src/github.com/davecgh/go-xdr/xdr
+rm -r src/github.com/flynn/noise/vector*
+rm src/github.com/hjson/hjson-go/build_release.sh
+rm src/github.com/gorhill/cronexpr/APLv2
 rm -fr ports
 rm makedist.sh
 
@@ -80,13 +107,79 @@ cat > doc/download.texi <<EOF
 You can obtain releases source code prepared tarballs on
 @url{http://www.nncpgo.org/}.
 EOF
+perl -i -ne 'print unless /include pedro/' doc/index.texi doc/about.ru.texi
 make -C doc
-./supplementary_files.sh
-rm -r doc/.well-known doc/nncp.html/.well-known supplementary_files.sh
 
-find . -name .git | xargs rm -fr
-find . -name .gitignore -delete
-rm .gitmodules
+########################################################################
+# Supplementary files autogeneration
+########################################################################
+texi=`mktemp`
+
+cat > $texi <<EOF
+\input texinfo
+@documentencoding UTF-8
+@settitle NEWS
+
+@node News
+@unnumbered News
+
+`sed -n '5,$p' < doc/news.texi`
+
+@bye
+EOF
+makeinfo --plaintext -o NEWS $texi
+
+cat > $texi <<EOF
+\input texinfo
+@documentencoding UTF-8
+@settitle NEWS.RU
+
+@node Новости
+@unnumbered Новости
+
+`sed -n '3,$p' < doc/news.ru.texi | sed 's/^@subsection/@section/'`
+
+@bye
+EOF
+makeinfo --plaintext -o NEWS.RU $texi
+
+rm -f $texi
+
+texi=$(TMPDIR=doc mktemp)
+cat > $texi <<EOF
+\input texinfo
+@documentencoding UTF-8
+@settitle INSTALL
+
+@include install.texi
+
+@bye
+EOF
+makeinfo --plaintext -o INSTALL $texi
+rm -f $texi
+
+texi=`mktemp`
+
+cat > $texi <<EOF
+\input texinfo
+@documentencoding UTF-8
+@settitle THANKS
+
+`cat doc/thanks.texi`
+
+@bye
+EOF
+makeinfo --plaintext -o THANKS $texi
+rm -f $texi
+
+########################################################################
+
+mv doc/.well-known/openpgpkey/hu/i4cdqgcarfjdjnba6y4jnf498asg8c6p.asc PUBKEY.asc
+rm -r doc/.gitignore doc/.well-known doc/nncp.html/.well-known
+
+find . -type d -exec chmod 755 {} \;
+find . -type f -exec chmod 644 {} \;
+find . -type f -name "*.sh" -exec chmod 755 {} \;
 
 cd ..
 tar cvf nncp-"$release".tar --uid=0 --gid=0 --numeric-owner nncp-"$release"
index a10018d23bb4468fc0b70cd823adfbed02c80a5d..b26f5666e6e127e206be18fd7295cee38bdebc18 100644 (file)
@@ -1,7 +1,7 @@
 # $FreeBSD: head/net/nncp/Makefile 484628 2018-11-10 18:12:57Z bapt $
 
 PORTNAME=      nncp
-DISTVERSION=   4.0
+DISTVERSION=   5.0.0
 PORTREVISION=  1
 CATEGORIES=    net
 MASTER_SITES=  http://www.nncpgo.org/download/
@@ -9,13 +9,12 @@ MASTER_SITES= http://www.nncpgo.org/download/
 MAINTAINER=    stargrave@stargrave.org
 COMMENT=       Utilities for secure store-and-forward files, mail, command exchanging
 
-LICENSE=       GPLv3+
+LICENSE=       GPLv3
 LICENSE_FILE=  ${WRKSRC}/COPYING
 
 BUILD_DEPENDS= go:lang/go
 
 USES=          tar:xz
-MAKEFILE=      BSDmakefile
 USE_RC_SUBR=   nncp-caller nncp-daemon nncp-toss
 INSTALL_TARGET=        install-strip
 
index 89c79345eaafaed2969b274d13a7f5c0f2d7224c..0ab5492d02d7bd1e9f59a4505a511c3c8bace07c 100644 (file)
@@ -11,7 +11,7 @@
 #
 # nncp_caller_enable (bool):   Set to NO by default.
 #                              Set it to YES to enable nncp-caller.
-# nncp_caller_config (path):   Set to %%PREFIX%%/etc/nncp.yaml by default.
+# nncp_caller_config (path):   Set to %%PREFIX%%/etc/nncp.hjson by default.
 
 . /etc/rc.subr
 
@@ -21,7 +21,7 @@ rcvar=nncp_caller_enable
 load_rc_config $name
 
 : ${nncp_caller_enable:="NO"}
-: ${nncp_caller_config="%%PREFIX%%/etc/nncp.yaml"}
+: ${nncp_caller_config="%%PREFIX%%/etc/nncp.hjson"}
 
 command=%%PREFIX%%/bin/nncp-caller
 command_args="-quiet -cfg $nncp_caller_config &"
index 3c7ccd87ea850eea3798100799ddf659bb23eab3..fdc10649661025d573a83e84431dce2573a3a8a4 100644 (file)
@@ -11,7 +11,7 @@
 #
 # nncp_daemon_enable (bool):   Set to NO by default.
 #                              Set it to YES to enable nncp-daemon.
-# nncp_daemon_config (path):   Set to %%PREFIX%%/etc/nncp.yaml by default.
+# nncp_daemon_config (path):   Set to %%PREFIX%%/etc/nncp.hjson by default.
 # nncp_daemon_bind (string):   Address:port to bind to
 #                              Default is "[::]:5400".
 
@@ -23,7 +23,7 @@ rcvar=nncp_daemon_enable
 load_rc_config $name
 
 : ${nncp_daemon_enable:="NO"}
-: ${nncp_daemon_config="%%PREFIX%%/etc/nncp.yaml"}
+: ${nncp_daemon_config="%%PREFIX%%/etc/nncp.hjson"}
 : ${nncp_daemon_bind="[::]:5400"}
 
 command=%%PREFIX%%/bin/nncp-daemon
index 1fa1142262711acb684a78234b68c8ada34d65a2..6fbe5469462f136c39ed4ef377bbbae3cf5018b6 100644 (file)
@@ -11,7 +11,7 @@
 #
 # nncp_toss_enable (bool):     Set to NO by default.
 #                              Set it to YES to enable nncp-toss.
-# nncp_toss_config (path):     Set to %%PREFIX%%/etc/nncp.yaml by default.
+# nncp_toss_config (path):     Set to %%PREFIX%%/etc/nncp.hjson by default.
 # nncp_toss_cycle   (int):     Repeat tossing after that number of seconds.
 #                              Default is "60".
 
@@ -23,7 +23,7 @@ rcvar=nncp_toss_enable
 load_rc_config $name
 
 : ${nncp_toss_enable:="NO"}
-: ${nncp_toss_config="%%PREFIX%%/etc/nncp.yaml"}
+: ${nncp_toss_config="%%PREFIX%%/etc/nncp.hjson"}
 : ${nncp_toss_cycle="60"}
 
 command=%%PREFIX%%/bin/nncp-toss
index 0c9f4f1e49d46134be819ef37aed2a3fd17e4e86..76a8b973190d4ce015ae00557c69bfc9c9a571e1 100644 (file)
@@ -2,8 +2,8 @@
 
 [ "$2" = "POST-DEINSTALL" ] || exit 0
 
-if [ -e %%PREFIX%%/etc/nncp.yaml ]; then
-       echo "%%PREFIX%%/etc/nncp.yaml with your private keys is not removed!"
+if [ -e %%PREFIX%%/etc/nncp.hjson ]; then
+       echo "%%PREFIX%%/etc/nncp.hjson with your private keys is not removed!"
 fi
 
 exec rmdir /var/spool/nncp
index a68f1a34e610eff2c2cc9f6b12ef987fa2430df4..6aa49a4eac87bd153e4ca2d1381c21f8e6a13a74 100644 (file)
@@ -13,5 +13,5 @@
 - Generate NNCP configuration file using the command:
 
     # umask 077
-    # nncp-cfgnew > %%PREFIX%%/etc/nncp.yaml
+    # nncp-cfgnew > %%PREFIX%%/etc/nncp.hjson
 ======================================================================
similarity index 91%
rename from src/cypherpunks.ru/nncp/call.go
rename to src/call.go
index 56c51bfcd181ad5f13e2e66ae7209943e42bb0b8..fd57bd1f283eaca0985adfc0e1bb8c4b9ff4ef01 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -49,7 +48,13 @@ func (ctx *Ctx) CallNode(
        for _, addr := range addrs {
                sds := SDS{"node": node.Id, "addr": addr}
                ctx.LogD("call", sds, "dialing")
-               conn, err := net.Dial("tcp", addr)
+               var conn ConnDeadlined
+               var err error
+               if addr[0] == '|' {
+                       conn, err = NewPipeConn(addr[1:])
+               } else {
+                       conn, err = net.Dial("tcp", addr)
+               }
                if err != nil {
                        ctx.LogD("call", SdsAdd(sds, SDS{"err": err}), "dialing")
                        continue
similarity index 68%
rename from src/cypherpunks.ru/nncp/cfg.go
rename to src/cfg.go
index bcd547ec91c5e13cbc6052d69c6164e35e9c3f6f..a4450e0ae9ff7877d4961322b8abc0bd90d41942 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,15 +19,17 @@ package nncp
 
 import (
        "bytes"
+       "encoding/json"
        "errors"
        "log"
        "os"
        "path"
+       "strconv"
 
        "github.com/gorhill/cronexpr"
+       "github.com/hjson/hjson-go"
        "golang.org/x/crypto/ed25519"
        "golang.org/x/crypto/ssh/terminal"
-       "gopkg.in/yaml.v2"
 )
 
 const (
@@ -38,74 +39,76 @@ const (
 )
 
 var (
-       DefaultCfgPath      string = "/usr/local/etc/nncp.yaml"
+       DefaultCfgPath      string = "/usr/local/etc/nncp.hjson"
        DefaultSendmailPath string = "/usr/sbin/sendmail"
        DefaultSpoolPath    string = "/var/spool/nncp"
        DefaultLogPath      string = "/var/spool/nncp/log"
 )
 
-type NodeYAML struct {
-       Id          string
-       ExchPub     string
-       SignPub     string
-       NoisePub    *string             `yaml:"noisepub,omitempty"`
-       Exec        map[string][]string `yaml:"exec,omitempty"`
-       Incoming    *string             `yaml:"incoming,omitempty"`
-       Freq        *string             `yaml:"freq,omitempty"`
-       FreqChunked *uint64             `yaml:"freqchunked,omitempty"`
-       FreqMinSize *uint64             `yaml:"freqminsize,omitempty"`
-       Via         []string            `yaml:"via,omitempty"`
-       Calls       []CallYAML          `yaml:"calls,omitempty"`
-
-       Addrs map[string]string `yaml:"addrs,omitempty"`
-
-       RxRate         *int  `yaml:"rxrate,omitempty"`
-       TxRate         *int  `yaml:"txrate,omitempty"`
-       OnlineDeadline *uint `yaml:"onlinedeadline,omitempty"`
-       MaxOnlineTime  *uint `yaml:"maxonlinetime,omitempty"`
+type NodeJSON struct {
+       Id          string              `json:"id"`
+       ExchPub     string              `json:"exchpub"`
+       SignPub     string              `json:"signpub"`
+       NoisePub    *string             `json:"noisepub,omitempty"`
+       Exec        map[string][]string `json:"exec,omitempty"`
+       Incoming    *string             `json:"incoming,omitempty"`
+       Freq        *string             `json:"freq,omitempty"`
+       FreqChunked *uint64             `json:"freqchunked,omitempty"`
+       FreqMinSize *uint64             `json:"freqminsize,omitempty"`
+       Via         []string            `json:"via,omitempty"`
+       Calls       []CallJSON          `json:"calls,omitempty"`
+
+       Addrs map[string]string `json:"addrs,omitempty"`
+
+       RxRate         *int  `json:"rxrate,omitempty"`
+       TxRate         *int  `json:"txrate,omitempty"`
+       OnlineDeadline *uint `json:"onlinedeadline,omitempty"`
+       MaxOnlineTime  *uint `json:"maxonlinetime,omitempty"`
 }
 
-type CallYAML struct {
+type CallJSON struct {
        Cron           string
-       Nice           *string `yaml:"nice,omitempty"`
-       Xx             string  `yaml:"xx,omitempty"`
-       RxRate         *int    `yaml:"rxrate,omitempty"`
-       TxRate         *int    `yaml:"txrate,omitempty"`
-       Addr           *string `yaml:"addr,omitempty"`
-       OnlineDeadline *uint   `yaml:"onlinedeadline,omitempty"`
-       MaxOnlineTime  *uint   `yaml:"maxonlinetime,omitempty"`
+       Nice           *string `json:"nice,omitempty"`
+       Xx             *string `json:"xx,omitempty"`
+       RxRate         *int    `json:"rxrate,omitempty"`
+       TxRate         *int    `json:"txrate,omitempty"`
+       Addr           *string `json:"addr,omitempty"`
+       OnlineDeadline *uint   `json:"onlinedeadline,omitempty"`
+       MaxOnlineTime  *uint   `json:"maxonlinetime,omitempty"`
 }
 
-type NodeOurYAML struct {
-       Id       string
-       ExchPub  string
-       ExchPrv  string
-       SignPub  string
-       SignPrv  string
-       NoisePrv string
-       NoisePub string
+type NodeOurJSON struct {
+       Id       string `json:"id"`
+       ExchPub  string `json:"exchpub"`
+       ExchPrv  string `json:"exchprv"`
+       SignPub  string `json:"signpub"`
+       SignPrv  string `json:"signprv"`
+       NoisePrv string `json:"noiseprv"`
+       NoisePub string `json:"noisepub"`
 }
 
-type FromToYAML struct {
+type FromToJSON struct {
        From string
        To   string
 }
 
-type NotifyYAML struct {
-       File *FromToYAML `yaml:"file,omitempty"`
-       Freq *FromToYAML `yaml:"freq,omitempty"`
+type NotifyJSON struct {
+       File *FromToJSON `json:"file,omitempty"`
+       Freq *FromToJSON `json:"freq,omitempty"`
 }
 
-type CfgYAML struct {
-       Self  *NodeOurYAML `yaml:"self,omitempty"`
-       Neigh map[string]NodeYAML
+type CfgJSON struct {
+       Spool string `json:"spool"`
+       Log   string `json:"log"`
+       Umask string `json:"umask",omitempty`
 
-       Spool  string
-       Log    string
-       Notify *NotifyYAML `yaml:"notify,omitempty"`
+       Notify *NotifyJSON `json:"notify,omitempty"`
+
+       Self  *NodeOurJSON        `json:"self"`
+       Neigh map[string]NodeJSON `json:"neigh"`
 }
 
-func NewNode(name string, yml NodeYAML) (*Node, error) {
+func NewNode(name string, yml NodeJSON) (*Node, error) {
        nodeId, err := NodeIdFromString(yml.Id)
        if err != nil {
                return nil, err
@@ -204,14 +207,15 @@ func NewNode(name string, yml NodeYAML) (*Node, error) {
                }
 
                var xx TRxTx
-               switch callYml.Xx {
-               case "rx":
-                       xx = TRx
-               case "tx":
-                       xx = TTx
-               case "":
-               default:
-                       return nil, errors.New("xx field must be either \"rx\" or \"tx\"")
+               if callYml.Xx != nil {
+                       switch *callYml.Xx {
+                       case "rx":
+                               xx = TRx
+                       case "tx":
+                               xx = TTx
+                       default:
+                               return nil, errors.New("xx field must be either \"rx\" or \"tx\"")
+                       }
                }
 
                rxRate := defRxRate
@@ -282,7 +286,7 @@ func NewNode(name string, yml NodeYAML) (*Node, error) {
        return &node, nil
 }
 
-func NewNodeOur(yml *NodeOurYAML) (*NodeOur, error) {
+func NewNodeOur(yml *NodeOurJSON) (*NodeOur, error) {
        id, err := NodeIdFromString(yml.Id)
        if err != nil {
                return nil, err
@@ -352,23 +356,6 @@ func NewNodeOur(yml *NodeOurYAML) (*NodeOur, error) {
        return &node, nil
 }
 
-func (nodeOur *NodeOur) ToYAML() string {
-       yml := NodeOurYAML{
-               Id:       nodeOur.Id.String(),
-               ExchPub:  ToBase32(nodeOur.ExchPub[:]),
-               ExchPrv:  ToBase32(nodeOur.ExchPrv[:]),
-               SignPub:  ToBase32(nodeOur.SignPub[:]),
-               SignPrv:  ToBase32(nodeOur.SignPrv[:]),
-               NoisePub: ToBase32(nodeOur.NoisePub[:]),
-               NoisePrv: ToBase32(nodeOur.NoisePrv[:]),
-       }
-       raw, err := yaml.Marshal(&yml)
-       if err != nil {
-               panic(err)
-       }
-       return string(raw)
-}
-
 func CfgParse(data []byte) (*Ctx, error) {
        var err error
        if bytes.Compare(data[:8], MagicNNCPBv3[:]) == 0 {
@@ -383,46 +370,64 @@ func CfgParse(data []byte) (*Ctx, error) {
                        return nil, err
                }
        }
-       var cfgYAML CfgYAML
-       if err = yaml.Unmarshal(data, &cfgYAML); err != nil {
+       var cfgGeneral map[string]interface{}
+       if err = hjson.Unmarshal(data, &cfgGeneral); err != nil {
                return nil, err
        }
-       if _, exists := cfgYAML.Neigh["self"]; !exists {
+       marshaled, err := json.Marshal(cfgGeneral)
+       if err != nil {
+               return nil, err
+       }
+       var cfgJSON CfgJSON
+       if err = json.Unmarshal(marshaled, &cfgJSON); err != nil {
+               return nil, err
+       }
+       if _, exists := cfgJSON.Neigh["self"]; !exists {
                return nil, errors.New("self neighbour missing")
        }
        var self *NodeOur
-       if cfgYAML.Self != nil {
-               self, err = NewNodeOur(cfgYAML.Self)
+       if cfgJSON.Self != nil {
+               self, err = NewNodeOur(cfgJSON.Self)
                if err != nil {
                        return nil, err
                }
        }
-       spoolPath := path.Clean(cfgYAML.Spool)
+       spoolPath := path.Clean(cfgJSON.Spool)
        if !path.IsAbs(spoolPath) {
                return nil, errors.New("Spool path must be absolute")
        }
-       logPath := path.Clean(cfgYAML.Log)
+       logPath := path.Clean(cfgJSON.Log)
        if !path.IsAbs(logPath) {
                return nil, errors.New("Log path must be absolute")
        }
+       var umaskForce *int
+       if cfgJSON.Umask != "" {
+               r, err := strconv.ParseUint(cfgJSON.Umask, 8, 16)
+               if err != nil {
+                       return nil, err
+               }
+               rInt := int(r)
+               umaskForce = &rInt
+       }
        ctx := Ctx{
-               Spool:   spoolPath,
-               LogPath: logPath,
-               Self:    self,
-               Neigh:   make(map[NodeId]*Node, len(cfgYAML.Neigh)),
-               Alias:   make(map[string]*NodeId),
-       }
-       if cfgYAML.Notify != nil {
-               if cfgYAML.Notify.File != nil {
-                       ctx.NotifyFile = cfgYAML.Notify.File
+               Spool:      spoolPath,
+               LogPath:    logPath,
+               UmaskForce: umaskForce,
+               Self:       self,
+               Neigh:      make(map[NodeId]*Node, len(cfgJSON.Neigh)),
+               Alias:      make(map[string]*NodeId),
+       }
+       if cfgJSON.Notify != nil {
+               if cfgJSON.Notify.File != nil {
+                       ctx.NotifyFile = cfgJSON.Notify.File
                }
-               if cfgYAML.Notify.Freq != nil {
-                       ctx.NotifyFreq = cfgYAML.Notify.Freq
+               if cfgJSON.Notify.Freq != nil {
+                       ctx.NotifyFreq = cfgJSON.Notify.Freq
                }
        }
        vias := make(map[NodeId][]string)
-       for name, neighYAML := range cfgYAML.Neigh {
-               neigh, err := NewNode(name, neighYAML)
+       for name, neighJSON := range cfgJSON.Neigh {
+               neigh, err := NewNode(name, neighJSON)
                if err != nil {
                        return nil, err
                }
@@ -431,7 +436,7 @@ func CfgParse(data []byte) (*Ctx, error) {
                        return nil, errors.New("Node names conflict")
                }
                ctx.Alias[name] = neigh.Id
-               vias[*neigh.Id] = neighYAML.Via
+               vias[*neigh.Id] = neighJSON.Via
        }
        ctx.SelfId = ctx.Alias["self"]
        for neighId, viasRaw := range vias {
similarity index 94%
rename from src/cypherpunks.ru/nncp/check.go
rename to src/check.go
index c83c80b1b804ac0b27e47b4a5c70cc4e621da6c1..fdd6436f9049806ebe46d054a609f6b0839ccf33 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
similarity index 90%
rename from src/cypherpunks.ru/nncp/chunked.go
rename to src/chunked.go
index 02b488b3a92d448788c13983871c7039df8af491..2e5fb9e36682844923c1dba39ef4a57524de9e02 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
similarity index 98%
rename from src/cypherpunks.ru/nncp/cmd/nncp-bundle/main.go
rename to src/cmd/nncp-bundle/main.go
index 553a6d11a15afa325a0d69ba09c9933b57e968c1..4f5bca1b9d72890c25f33bc6069626c48e4a9c7c 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -33,8 +32,8 @@ import (
        "strconv"
        "strings"
 
-       "cypherpunks.ru/nncp"
        "github.com/davecgh/go-xdr/xdr2"
+       "go.cypherpunks.ru/nncp/v5"
        "golang.org/x/crypto/blake2b"
 )
 
@@ -103,6 +102,8 @@ func main() {
                nodeIds[*node.Id] = struct{}{}
        }
 
+       ctx.Umask()
+
        sds := nncp.SDS{}
        if *doTx {
                sds["xx"] = string(nncp.TTx)
@@ -371,7 +372,7 @@ func main() {
                                                log.Fatalln("Error during syncing:", err)
                                        }
                                        tmp.Close()
-                                       if err = os.MkdirAll(selfPath, os.FileMode(0700)); err != nil {
+                                       if err = os.MkdirAll(selfPath, os.FileMode(0777)); err != nil {
                                                log.Fatalln("Error during mkdir:", err)
                                        }
                                        if err = os.Rename(tmp.Name(), dstPath); err != nil {
similarity index 97%
rename from src/cypherpunks.ru/nncp/cmd/nncp-call/main.go
rename to src/cmd/nncp-call/main.go
index 7919b6a55386c836c5fd4644b15bb29cead89e04..dde658ff3a7b938b9037e2d6403b9c2814a6cbab 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +25,7 @@ import (
        "os"
        "strings"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -140,6 +139,7 @@ func main() {
                }
        }
 
+       ctx.Umask()
        if !ctx.CallNode(
                node,
                addrs,
similarity index 96%
rename from src/cypherpunks.ru/nncp/cmd/nncp-caller/main.go
rename to src/cmd/nncp-caller/main.go
index 19307153a7e57c3f02eebf6f584f338a0ff31e4d..e97ea8555f4e6d91dda10d5500f529cde4c59fdc 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,7 +27,7 @@ import (
        "sync"
        "time"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -67,6 +66,7 @@ func main() {
        if ctx.Self == nil {
                log.Fatalln("Config lacks private keys")
        }
+       ctx.Umask()
 
        var nodes []*nncp.Node
        if flag.NArg() > 0 {
similarity index 89%
rename from src/cypherpunks.ru/nncp/cmd/nncp-cfgenc/main.go
rename to src/cmd/nncp-cfgenc/main.go
index be009f4e81e51ed6da38db857fe642a7e61937ac..7adc6fab94f9f1c350e54e7192e0d9fc0a048a04 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,8 +27,8 @@ import (
        "log"
        "os"
 
-       "cypherpunks.ru/nncp"
        "github.com/davecgh/go-xdr/xdr2"
+       "go.cypherpunks.ru/nncp/v5"
        "golang.org/x/crypto/blake2b"
        "golang.org/x/crypto/ssh/terminal"
 )
@@ -37,9 +36,9 @@ import (
 func usage() {
        fmt.Fprintf(os.Stderr, nncp.UsageHeader())
        fmt.Fprintf(os.Stderr, "nncp-cfgenc -- encrypt/decrypt configuration file\n\n")
-       fmt.Fprintf(os.Stderr, "Usage: %s [options] cfg.yaml > cfg.yaml.eblob\n", os.Args[0])
-       fmt.Fprintf(os.Stderr, "       %s [options] -d cfg.yaml.eblob > cfg.yaml\n", os.Args[0])
-       fmt.Fprintf(os.Stderr, "       %s [options] -dump cfg.yaml.eblob\n", os.Args[0])
+       fmt.Fprintf(os.Stderr, "Usage: %s [options] cfg.hjson > cfg.hjson.eblob\n", os.Args[0])
+       fmt.Fprintf(os.Stderr, "       %s [options] -d cfg.hjson.eblob > cfg.hjson\n", os.Args[0])
+       fmt.Fprintf(os.Stderr, "       %s [options] -dump cfg.hjson.eblob\n", os.Args[0])
        fmt.Fprintln(os.Stderr, "Options:")
        flag.PrintDefaults()
 }
similarity index 87%
rename from src/cypherpunks.ru/nncp/cmd/nncp-cfgmin/main.go
rename to src/cmd/nncp-cfgmin/main.go
index 7ddbb0462339d5580359f432d39349153f3af36f..7214079040daacfb0ad7f85c190130caa60ddedb 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,8 +24,8 @@ import (
        "log"
        "os"
 
-       "cypherpunks.ru/nncp"
-       "gopkg.in/yaml.v2"
+       "github.com/hjson/hjson-go"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -58,10 +57,10 @@ func main() {
                log.Fatalln("Error during initialization:", err)
        }
 
-       cfg := nncp.CfgYAML{
+       cfg := nncp.CfgJSON{
                Spool: ctx.Spool,
                Log:   ctx.LogPath,
-               Neigh: make(map[string]nncp.NodeYAML),
+               Neigh: make(map[string]nncp.NodeJSON),
        }
        for _, node := range ctx.Neigh {
                var noisePub *string
@@ -69,14 +68,14 @@ func main() {
                        np := nncp.ToBase32(node.NoisePub[:])
                        noisePub = &np
                }
-               cfg.Neigh[node.Name] = nncp.NodeYAML{
+               cfg.Neigh[node.Name] = nncp.NodeJSON{
                        Id:       node.Id.String(),
                        ExchPub:  nncp.ToBase32(node.ExchPub[:]),
                        SignPub:  nncp.ToBase32(node.SignPub[:]),
                        NoisePub: noisePub,
                }
        }
-       raw, err := yaml.Marshal(&cfg)
+       raw, err := hjson.Marshal(&cfg)
        if err != nil {
                panic(err)
        }
diff --git a/src/cmd/nncp-cfgnew/main.go b/src/cmd/nncp-cfgnew/main.go
new file mode 100644 (file)
index 0000000..c7bb14e
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+NNCP -- Node to Node copy, utilities for store-and-forward data exchange
+Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+// Generate new NNCP node keys and configuration file
+package main
+
+import (
+       "flag"
+       "fmt"
+       "os"
+
+       "go.cypherpunks.ru/nncp/v5"
+)
+
+func usage() {
+       fmt.Fprintf(os.Stderr, nncp.UsageHeader())
+       fmt.Fprintln(os.Stderr, "nncp-cfgnew -- generate new configuration and keys\nOptions:")
+       flag.PrintDefaults()
+}
+
+func main() {
+       var (
+               noComments = flag.Bool("nocomments", false, "Do not include descriptive comments")
+               version    = flag.Bool("version", false, "Print version information")
+               warranty   = flag.Bool("warranty", false, "Print warranty information")
+       )
+       flag.Usage = usage
+       flag.Parse()
+       if *warranty {
+               fmt.Println(nncp.Warranty)
+               return
+       }
+       if *version {
+               fmt.Println(nncp.VersionGet())
+               return
+       }
+       nodeOur, err := nncp.NewNodeGenerate()
+       if err != nil {
+               panic(err)
+       }
+       var cfgRaw string
+       if *noComments {
+               cfgRaw = fmt.Sprintf(`{
+  spool: %s
+  log: %s
+
+  self: {
+    # DO NOT show anyone your private keys!!!
+    id: %s
+    exchpub: %s
+    exchprv: %s
+    signpub: %s
+    signprv: %s
+    noiseprv: %s
+    noisepub: %s
+  }
+
+  neigh: {
+    self: {
+      id: %s
+      exchpub: %s
+      signpub: %s
+      noisepub: %s
+      exec: {sendmail: ["%s"]}
+    }
+  }
+}`,
+                       nncp.DefaultSpoolPath,
+                       nncp.DefaultLogPath,
+                       nodeOur.Id.String(),
+                       nncp.ToBase32(nodeOur.ExchPub[:]),
+                       nncp.ToBase32(nodeOur.ExchPrv[:]),
+                       nncp.ToBase32(nodeOur.SignPub[:]),
+                       nncp.ToBase32(nodeOur.SignPrv[:]),
+                       nncp.ToBase32(nodeOur.NoisePub[:]),
+                       nncp.ToBase32(nodeOur.NoisePrv[:]),
+                       nodeOur.Id.String(),
+                       nncp.ToBase32(nodeOur.ExchPub[:]),
+                       nncp.ToBase32(nodeOur.SignPub[:]),
+                       nncp.ToBase32(nodeOur.NoisePub[:]),
+                       nncp.DefaultSendmailPath,
+               )
+       } else {
+               cfgRaw = fmt.Sprintf(`{
+  # Path to encrypted packets spool directory
+  spool: %s
+  # Path to log file
+  log: %s
+  # Enforce specified umask usage
+  # umask: "022"
+
+  # Enable notification email sending
+  # notify: {
+  #   file: {
+  #     from: nncp@localhost
+  #     to: user+file@example.com
+  #   }
+  #   freq: {
+  #     from: nncp@localhost
+  #     to: user+freq@example.com
+  #   }
+  # }
+
+  self: {
+    # DO NOT show anyone your private keys!!!
+    id: %s
+    exchpub: %s
+    exchprv: %s
+    signpub: %s
+    signprv: %s
+    noiseprv: %s
+    noisepub: %s
+  }
+
+  neigh: {
+    self: {
+      # You should give public keys below to your neighbours
+      id: %s
+      exchpub: %s
+      signpub: %s
+      noisepub: %s
+
+      exec: {
+        # Default self's sendmail command is used for email notifications sending
+        sendmail: ["%s"]
+      }
+    }
+
+    # Example neighbour, most of fields are optional
+    # alice: {
+    #   id: XJZBK...65IJQ
+    #   exchpub: MJACJ...FAI6A
+    #   signpub: T4AFC...N2FRQ
+    #   noisepub: UBM5K...VI42A
+    #
+    #   # He is allowed to send email
+    #   exec: {sendmail: ["/usr/sbin/sendmail"]}
+    #
+    #   # Allow incoming files saving in that directory
+    #   incoming: "/home/alice/incoming"
+    #
+    #   # Transitional nodes path
+    #   via: ["bob", "eve"]
+    #
+    #   # Inactivity timeout when session with remote peer should be terminated
+    #   onlinedeadline: 1800
+    #
+    #   # Maximal online session lifetime
+    #   maxonlinetime: 3600
+    #
+    #   # Allow freqing from that directory
+    #   freq: "/home/bob/pub"
+    #   # Send freqed files with chunks
+    #   freqchunked: 1024
+    #   # Send freqed files with minumal chunk size
+    #   freqminsize: 2048
+    #
+    #   # Set maximal packets per second receive and transmit rates
+    #   rxrate: 10
+    #   txrate: 20
+    #
+    #   # Address aliases
+    #   addrs: {
+    #     lan: "[fe80::1234%%igb0]:5400"
+    #     internet: alice.com:3389
+    #   }
+    #
+    #   # Calls configuration
+    #   calls: [
+    #     {
+    #       cron: "*/2 * * * *"
+    #       onlinedeadline: 1800
+    #       maxonlinetime: 1750
+    #       nice: PRIORITY+10
+    #       rxrate: 10
+    #       txrate: 20
+    #       xx: rx
+    #       addr: lan
+    #     },
+    #   ]
+    # }
+  }
+}`,
+                       nncp.DefaultSpoolPath,
+                       nncp.DefaultLogPath,
+                       nodeOur.Id.String(),
+                       nncp.ToBase32(nodeOur.ExchPub[:]),
+                       nncp.ToBase32(nodeOur.ExchPrv[:]),
+                       nncp.ToBase32(nodeOur.SignPub[:]),
+                       nncp.ToBase32(nodeOur.SignPrv[:]),
+                       nncp.ToBase32(nodeOur.NoisePub[:]),
+                       nncp.ToBase32(nodeOur.NoisePrv[:]),
+                       nodeOur.Id.String(),
+                       nncp.ToBase32(nodeOur.ExchPub[:]),
+                       nncp.ToBase32(nodeOur.SignPub[:]),
+                       nncp.ToBase32(nodeOur.NoisePub[:]),
+                       nncp.DefaultSendmailPath,
+               )
+       }
+       if _, err = nncp.CfgParse([]byte(cfgRaw)); err != nil {
+               panic(err)
+       }
+       fmt.Println(cfgRaw)
+}
similarity index 94%
rename from src/cypherpunks.ru/nncp/cmd/nncp-check/main.go
rename to src/cmd/nncp-check/main.go
index a99bd2f0c20ee62c10d2029147fbe045919431c1..186357ee3d458698d8993aa4fb664e34df6741db 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +24,7 @@ import (
        "log"
        "os"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -61,6 +60,7 @@ func main() {
        if err != nil {
                log.Fatalln("Error during initialization:", err)
        }
+       ctx.Umask()
 
        var nodeOnly *nncp.Node
        if *nodeRaw != "" {
similarity index 88%
rename from src/cypherpunks.ru/nncp/cmd/nncp-daemon/main.go
rename to src/cmd/nncp-daemon/main.go
index 3f2897206eb745600025f80e3f98205bc1746def..897dc06f1d181f8c72614ad9279c08884158ee2b 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,7 +27,7 @@ import (
        "strconv"
        "time"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
        "golang.org/x/net/netutil"
 )
 
@@ -44,20 +43,24 @@ type InetdConn struct {
        w *os.File
 }
 
-func (ic *InetdConn) Read(p []byte) (n int, err error) {
-       return ic.r.Read(p)
+func (InetdConn) Read(p []byte) (n int, err error) {
+       return c.r.Read(p)
 }
 
-func (ic *InetdConn) Write(p []byte) (n int, err error) {
-       return ic.w.Write(p)
+func (InetdConn) Write(p []byte) (n int, err error) {
+       return c.w.Write(p)
 }
 
-func (ic *InetdConn) SetReadDeadline(t time.Time) error {
-       return ic.r.SetReadDeadline(t)
+func (InetdConn) SetReadDeadline(t time.Time) error {
+       return c.r.SetReadDeadline(t)
 }
 
-func (ic *InetdConn) SetWriteDeadline(t time.Time) error {
-       return ic.w.SetWriteDeadline(t)
+func (c InetdConn) SetWriteDeadline(t time.Time) error {
+       return c.w.SetWriteDeadline(t)
+}
+
+func (c InetdConn) Close() error {
+       return c.w.Close()
 }
 
 func performSP(ctx *nncp.Ctx, conn nncp.ConnDeadlined, nice uint8) {
@@ -121,6 +124,7 @@ func main() {
        if ctx.Self == nil {
                log.Fatalln("Config lacks private keys")
        }
+       ctx.Umask()
 
        if *inetd {
                os.Stderr.Close()
similarity index 91%
rename from src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go
rename to src/cmd/nncp-exec/main.go
index bdcf5a3cb4893a7dac7c82333502b146439ae11b..54394e8863e99c786d5e76d2ae35023713f4d447 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -23,11 +22,10 @@ import (
        "bufio"
        "flag"
        "fmt"
-       "io/ioutil"
        "log"
        "os"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -88,11 +86,7 @@ func main() {
        }
 
        nncp.ViaOverride(*viaOverride, ctx, node)
-
-       body, err := ioutil.ReadAll(bufio.NewReader(os.Stdin))
-       if err != nil {
-               log.Fatalln("Can not read body from stdin:", err)
-       }
+       ctx.Umask()
 
        if err = ctx.TxExec(
                node,
@@ -100,7 +94,7 @@ func main() {
                replyNice,
                flag.Args()[1],
                flag.Args()[2:],
-               body,
+               bufio.NewReader(os.Stdin),
                int64(*minSize)*1024,
        ); err != nil {
                log.Fatalln(err)
similarity index 96%
rename from src/cypherpunks.ru/nncp/cmd/nncp-file/main.go
rename to src/cmd/nncp-file/main.go
index b7f31ab870c0c972dadba8ef0c8ceaed510465a1..f3572ca04fc95f2b6a38aca6171324a92b9cfd71 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +25,7 @@ import (
        "os"
        "strings"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -94,6 +93,7 @@ func main() {
        }
 
        nncp.ViaOverride(*viaOverride, ctx, node)
+       ctx.Umask()
 
        var minSize int64
        if *argMinSize < 0 {
similarity index 96%
rename from src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go
rename to src/cmd/nncp-freq/main.go
index 32b62bfb9b2e7c94472a68505f44ecbb0b9018a1..4332ff1ca1906ad02db2b7d47521ffe4d3cbf1d4 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,7 +27,7 @@ import (
        "strconv"
        "strings"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -94,6 +93,7 @@ func main() {
        }
 
        nncp.ViaOverride(*viaOverride, ctx, node)
+       ctx.Umask()
 
        var dst string
        if flag.NArg() == 2 {
similarity index 93%
rename from src/cypherpunks.ru/nncp/cmd/nncp-log/main.go
rename to src/cmd/nncp-log/main.go
index aea1d8b63e346aa96ea251faa73d2ce23bf797f3..97ca259e80fb907715f5a807e32f1d4d6fe77fe4 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +25,7 @@ import (
        "log"
        "os"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
similarity index 93%
rename from src/cypherpunks.ru/nncp/cmd/nncp-pkt/main.go
rename to src/cmd/nncp-pkt/main.go
index 1ccea9e7def2aa244f6f10612c54832d1b321ed4..1808e3a61d001d11bf49d3120fe317e70bb48c86 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,15 +21,15 @@ package main
 import (
        "bufio"
        "bytes"
-       "compress/zlib"
        "flag"
        "fmt"
        "io"
        "log"
        "os"
 
-       "cypherpunks.ru/nncp"
        "github.com/davecgh/go-xdr/xdr2"
+       "github.com/klauspost/compress/zstd"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -45,7 +44,7 @@ func main() {
        var (
                overheads  = flag.Bool("overheads", false, "Print packet overheads")
                dump       = flag.Bool("dump", false, "Write decrypted/parsed payload to stdout")
-               decompress = flag.Bool("decompress", false, "Try to zlib decompress dumped data")
+               decompress = flag.Bool("decompress", false, "Try to zstd decompress dumped data")
                cfgPath    = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
                version    = flag.Bool("version", false, "Print version information")
                warranty   = flag.Bool("warranty", false, "Print warranty information")
@@ -78,13 +77,13 @@ func main() {
        }
        var pkt nncp.Pkt
        _, err = xdr.Unmarshal(bytes.NewReader(beginning), &pkt)
-       if err == nil && pkt.Magic == nncp.MagicNNCPPv2 {
+       if err == nil && pkt.Magic == nncp.MagicNNCPPv3 {
                if *dump {
                        bufW := bufio.NewWriter(os.Stdout)
                        var r io.Reader
                        r = bufio.NewReader(os.Stdin)
                        if *decompress {
-                               decompressor, err := zlib.NewReader(r)
+                               decompressor, err := zstd.NewReader(r)
                                if err != nil {
                                        log.Fatalln(err)
                                }
similarity index 97%
rename from src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go
rename to src/cmd/nncp-reass/main.go
index fe068b5326871e7349cc606778e803e6d944b239..77a5f139a879c986387aa877fc55638a98368fb4 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,16 +26,15 @@ import (
        "fmt"
        "hash"
        "io"
-       "io/ioutil"
        "log"
        "os"
        "path/filepath"
        "strconv"
        "strings"
 
-       "cypherpunks.ru/nncp"
        "github.com/davecgh/go-xdr/xdr2"
        "github.com/dustin/go-humanize"
+       "go.cypherpunks.ru/nncp/v5"
        "golang.org/x/crypto/blake2b"
 )
 
@@ -173,7 +171,7 @@ func process(ctx *nncp.Ctx, path string, keep, dryRun, stdout, dumpMeta bool) bo
                dst = os.Stdout
                sds = nncp.SDS{"path": path}
        } else {
-               tmp, err = ioutil.TempFile(mainDir, "nncp-reass")
+               tmp, err = nncp.TempFile(mainDir, "reass")
                if err != nil {
                        log.Fatalln(err)
                }
@@ -234,7 +232,7 @@ func process(ctx *nncp.Ctx, path string, keep, dryRun, stdout, dumpMeta bool) bo
                        }
                        log.Fatalln(err)
                }
-               dstPath = dstPathOrig + strconv.Itoa(dstPathCtr)
+               dstPath = dstPathOrig + "." + strconv.Itoa(dstPathCtr)
                dstPathCtr++
        }
        if err = os.Rename(tmp.Name(), dstPath); err != nil {
@@ -319,6 +317,8 @@ func main() {
                os.Exit(1)
        }
 
+       ctx.Umask()
+
        if flag.NArg() > 0 {
                if process(ctx, flag.Arg(0), *keep, *dryRun, *stdout, *dumpMeta) {
                        return
similarity index 97%
rename from src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go
rename to src/cmd/nncp-rm/main.go
index 029837906111e74e202b89fbc8459bf741a4b10d..765ed4942660655fe8c252cafcd0bbe3548446e8 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,7 +26,7 @@ import (
        "path/filepath"
        "strings"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -75,6 +74,7 @@ func main() {
        if err != nil {
                log.Fatalln("Error during initialization:", err)
        }
+       ctx.Umask()
 
        if *doTmp {
                err = filepath.Walk(filepath.Join(ctx.Spool, "tmp"), func(path string, info os.FileInfo, err error) error {
similarity index 96%
rename from src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go
rename to src/cmd/nncp-stat/main.go
index a4fbfcbbf1e73949cca65b0a1a5dddffadcf7309..c03745a5241e9361ae83626386af2e9dbb067f35 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,8 +25,8 @@ import (
        "os"
        "sort"
 
-       "cypherpunks.ru/nncp"
        "github.com/dustin/go-humanize"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -78,6 +77,7 @@ func main() {
        }
        sort.Strings(nodeNames)
 
+       ctx.Umask()
        var node *nncp.Node
        for _, nodeName := range nodeNames {
                node = nodeNameToNode[nodeName]
similarity index 96%
rename from src/cypherpunks.ru/nncp/cmd/nncp-toss/main.go
rename to src/cmd/nncp-toss/main.go
index a87923c0c322ca6f0a937aa4f118744c6224f700..3f31ff9fb41d27adcff5d930e224e42a83b909e6 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +25,7 @@ import (
        "os"
        "time"
 
-       "cypherpunks.ru/nncp"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -86,6 +85,8 @@ func main() {
                }
        }
 
+       ctx.Umask()
+
 Cycle:
        isBad := false
        for nodeId, node := range ctx.Neigh {
similarity index 96%
rename from src/cypherpunks.ru/nncp/cmd/nncp-xfer/main.go
rename to src/cmd/nncp-xfer/main.go
index e4a8653e73df3df9f6c45ab8c0da5d10f480bbb3..fde11174e9c19297aa573a8af86cd4c64d8848c3 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -24,14 +23,13 @@ import (
        "flag"
        "fmt"
        "io"
-       "io/ioutil"
        "log"
        "os"
        "path/filepath"
        "strconv"
 
-       "cypherpunks.ru/nncp"
        "github.com/davecgh/go-xdr/xdr2"
+       "go.cypherpunks.ru/nncp/v5"
 )
 
 func usage() {
@@ -92,6 +90,7 @@ func main() {
                }
        }
 
+       ctx.Umask()
        selfPath := filepath.Join(flag.Arg(0), ctx.SelfId.String())
        isBad := false
        var dir *os.File
@@ -245,7 +244,7 @@ Tx:
                                        ctx.UnlockDir(dirLock)
                                        continue
                                }
-                               if err = os.Mkdir(nodePath, os.FileMode(0700)); err != nil {
+                               if err = os.Mkdir(nodePath, os.FileMode(0777)); err != nil {
                                        ctx.UnlockDir(dirLock)
                                        ctx.LogE("nncp-xfer", nncp.SdsAdd(sds, nncp.SDS{"err": err}), "mkdir")
                                        isBad = true
@@ -263,7 +262,7 @@ Tx:
                _, err = os.Stat(dstPath)
                if err != nil {
                        if os.IsNotExist(err) {
-                               if err = os.Mkdir(dstPath, os.FileMode(0700)); err != nil {
+                               if err = os.Mkdir(dstPath, os.FileMode(0777)); err != nil {
                                        ctx.UnlockDir(dirLock)
                                        ctx.LogE("nncp-xfer", nncp.SdsAdd(sds, nncp.SDS{"err": err}), "mkdir")
                                        isBad = true
@@ -295,7 +294,7 @@ Tx:
                                job.Fd.Close()
                                continue
                        }
-                       tmp, err := ioutil.TempFile(dstPath, "nncp-xfer")
+                       tmp, err := nncp.TempFile(dstPath, "xfer")
                        if err != nil {
                                ctx.LogE("nncp-xfer", nncp.SdsAdd(sds, nncp.SDS{"err": err}), "mktemp")
                                job.Fd.Close()
similarity index 89%
rename from src/cypherpunks.ru/nncp/ctx.go
rename to src/ctx.go
index 3f4def9d10754b48b4b7b129cbe152775bbb6a4a..3793bbba6b6808b3c3b9d0630a788682b54e615b 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,6 +25,7 @@ import (
        "path/filepath"
 
        "golang.org/x/sys/unix"
+       "syscall"
 )
 
 type Ctx struct {
@@ -36,10 +36,11 @@ type Ctx struct {
 
        Spool      string
        LogPath    string
+       UmaskForce *int
        Quiet      bool
        Debug      bool
-       NotifyFile *FromToYAML
-       NotifyFreq *FromToYAML
+       NotifyFile *FromToJSON
+       NotifyFreq *FromToJSON
 }
 
 func (ctx *Ctx) FindNode(id string) (*Node, error) {
@@ -60,7 +61,7 @@ func (ctx *Ctx) FindNode(id string) (*Node, error) {
 
 func (ctx *Ctx) ensureRxDir(nodeId *NodeId) error {
        dirPath := filepath.Join(ctx.Spool, nodeId.String(), string(TRx))
-       if err := os.MkdirAll(dirPath, os.FileMode(0700)); err != nil {
+       if err := os.MkdirAll(dirPath, os.FileMode(0777)); err != nil {
                ctx.LogE("dir-ensure", SDS{"dir": dirPath, "err": err}, "")
                return err
        }
@@ -114,3 +115,9 @@ func (ctx *Ctx) IsEnoughSpace(want int64) bool {
        }
        return int64(s.Bavail)*int64(s.Bsize) > want
 }
+
+func (ctx *Ctx) Umask() {
+       if ctx.UmaskForce != nil {
+               syscall.Umask(*ctx.UmaskForce)
+       }
+}
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-cfgnew/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-cfgnew/main.go
deleted file mode 100644 (file)
index 274cdad..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-// Generate new NNCP node keys and configuration file
-package main
-
-import (
-       "flag"
-       "fmt"
-       "os"
-
-       "cypherpunks.ru/nncp"
-       "gopkg.in/yaml.v2"
-)
-
-func usage() {
-       fmt.Fprintf(os.Stderr, nncp.UsageHeader())
-       fmt.Fprintln(os.Stderr, "nncp-cfgnew -- generate new configuration and keys\nOptions:")
-       flag.PrintDefaults()
-}
-
-func main() {
-       var (
-               version  = flag.Bool("version", false, "Print version information")
-               warranty = flag.Bool("warranty", false, "Print warranty information")
-       )
-       flag.Usage = usage
-       flag.Parse()
-       if *warranty {
-               fmt.Println(nncp.Warranty)
-               return
-       }
-       if *version {
-               fmt.Println(nncp.VersionGet())
-               return
-       }
-       nodeOur, err := nncp.NewNodeGenerate()
-       if err != nil {
-               panic(err)
-       }
-       noisePub := nncp.ToBase32(nodeOur.NoisePub[:])
-       cfg := nncp.CfgYAML{
-               Self: &nncp.NodeOurYAML{
-                       Id:       nodeOur.Id.String(),
-                       ExchPub:  nncp.ToBase32(nodeOur.ExchPub[:]),
-                       ExchPrv:  nncp.ToBase32(nodeOur.ExchPrv[:]),
-                       SignPub:  nncp.ToBase32(nodeOur.SignPub[:]),
-                       SignPrv:  nncp.ToBase32(nodeOur.SignPrv[:]),
-                       NoisePub: nncp.ToBase32(nodeOur.NoisePub[:]),
-                       NoisePrv: nncp.ToBase32(nodeOur.NoisePrv[:]),
-               },
-               Neigh: map[string]nncp.NodeYAML{
-                       "self": nncp.NodeYAML{
-                               Id:       nodeOur.Id.String(),
-                               ExchPub:  nncp.ToBase32(nodeOur.ExchPub[:]),
-                               SignPub:  nncp.ToBase32(nodeOur.SignPub[:]),
-                               NoisePub: &noisePub,
-                               Exec: map[string][]string{
-                                       "sendmail": []string{nncp.DefaultSendmailPath},
-                               },
-                       },
-               },
-               Spool: nncp.DefaultSpoolPath,
-               Log:   nncp.DefaultLogPath,
-       }
-       raw, err := yaml.Marshal(&cfg)
-       if err != nil {
-               panic(err)
-       }
-       fmt.Print(string(raw))
-}
diff --git a/src/cypherpunks.ru/nncp/go.mod b/src/cypherpunks.ru/nncp/go.mod
deleted file mode 100644 (file)
index 59cfe97..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-module cypherpunks.ru/nncp
-
-require (
-       cypherpunks.ru/balloon v0.0.0-20190427214838-0e07700b0279
-       github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892
-       github.com/dustin/go-humanize v1.0.0
-       github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6
-       github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75
-       golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734
-       golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6
-       golang.org/x/sys v0.0.0-20190426135247-a129542de9ae
-       gopkg.in/yaml.v2 v2.2.2
-)
-
-replace cypherpunks.ru/balloon => git.cypherpunks.ru/balloon.git v0.0.0-20190427214838-0e07700b0279
diff --git a/src/cypherpunks.ru/nncp/go.sum b/src/cypherpunks.ru/nncp/go.sum
deleted file mode 100644 (file)
index cada0a9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-git.cypherpunks.ru/balloon.git v0.0.0-20190427214838-0e07700b0279 h1:UtJj64EdBav9c3gXvDzuVhfKv0dSOUu/8rA709WRyBg=
-git.cypherpunks.ru/balloon.git v0.0.0-20190427214838-0e07700b0279/go.mod h1:MMNkZjNnjCkWMS+luQsSoSp6CCzhQiowH2uvfy5KgG8=
-github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892 h1:qg9VbHo1TlL0KDM0vYvBG9EY0X0Yku5WYIPoFWt8f6o=
-github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE=
-github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
-github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
-github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 h1:u/UEqS66A5ckRmS4yNpjmVH56sVtS/RfclBAYocb4as=
-github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
-github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75 h1:f0n1xnMSmBLzVfsMMvriDyA75NB/oBgILX2GcHXIQzY=
-github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo=
-golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6 h1:FP8hkuE6yUEaJnK7O2eTuejKWwW+Rhfj80dQ2JcKxCU=
-golang.org/x/net v0.0.0-20190424112056-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20190426135247-a129542de9ae h1:mQLHiymj/JXKnnjc62tb7nD5pZLs940/sXJu+Xp3DBA=
-golang.org/x/sys v0.0.0-20190426135247-a129542de9ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
-gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/src/cypherpunks.ru/nncp/vendor/cypherpunks.ru/balloon b/src/cypherpunks.ru/nncp/vendor/cypherpunks.ru/balloon
deleted file mode 160000 (submodule)
index 0e07700..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 0e07700b027907d44e0060fc3f75c4590478452b
diff --git a/src/cypherpunks.ru/nncp/vendor/github.com/davecgh/go-xdr b/src/cypherpunks.ru/nncp/vendor/github.com/davecgh/go-xdr
deleted file mode 160000 (submodule)
index e6a2ba0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit e6a2ba005892b6a5b27cb5352f64c2e96942dd28
diff --git a/src/cypherpunks.ru/nncp/vendor/github.com/dustin/go-humanize b/src/cypherpunks.ru/nncp/vendor/github.com/dustin/go-humanize
deleted file mode 160000 (submodule)
index 9f541cc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 9f541cc9db5d55bce703bd99987c9d5cb8eea45e
diff --git a/src/cypherpunks.ru/nncp/vendor/github.com/flynn/noise b/src/cypherpunks.ru/nncp/vendor/github.com/flynn/noise
deleted file mode 160000 (submodule)
index 2492fe1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 2492fe189ae688d7edbeae0fd575de2f1c5fec8e
diff --git a/src/cypherpunks.ru/nncp/vendor/github.com/gorhill/cronexpr b/src/cypherpunks.ru/nncp/vendor/github.com/gorhill/cronexpr
deleted file mode 160000 (submodule)
index 88b0669..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 88b0669f7d75f171bd612b874e52b95c190218df
diff --git a/src/cypherpunks.ru/nncp/vendor/golang.org/x/crypto b/src/cypherpunks.ru/nncp/vendor/golang.org/x/crypto
deleted file mode 160000 (submodule)
index a29dc8f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit a29dc8fdc73485234dbef99ebedb95d2eced08de
diff --git a/src/cypherpunks.ru/nncp/vendor/golang.org/x/net b/src/cypherpunks.ru/nncp/vendor/golang.org/x/net
deleted file mode 160000 (submodule)
index 4829fb1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 4829fb13d2c62012c17688fa7f629f371014946d
diff --git a/src/cypherpunks.ru/nncp/vendor/golang.org/x/sys b/src/cypherpunks.ru/nncp/vendor/golang.org/x/sys
deleted file mode 160000 (submodule)
index a129542..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit a129542de9ae0895210abff9c95d67a1f33cb93d
diff --git a/src/cypherpunks.ru/nncp/vendor/gopkg.in/check.v1 b/src/cypherpunks.ru/nncp/vendor/gopkg.in/check.v1
deleted file mode 160000 (submodule)
index 788fd78..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 788fd78401277ebd861206a03c884797c6ec5541
diff --git a/src/cypherpunks.ru/nncp/vendor/gopkg.in/yaml.v2 b/src/cypherpunks.ru/nncp/vendor/gopkg.in/yaml.v2
deleted file mode 160000 (submodule)
index 7b8349a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 7b8349ac747c6a24702b762d2c4fd9266cf4f1d6
similarity index 95%
rename from src/cypherpunks.ru/nncp/eblob.go
rename to src/eblob.go
index 816388dfbb98878655153dbe6060c934461c743c..64327901bd1f4455bf2deac59d65322bcbce2e66 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -23,8 +22,8 @@ import (
        "crypto/rand"
        "hash"
 
-       "cypherpunks.ru/balloon"
        "github.com/davecgh/go-xdr/xdr2"
+       "go.cypherpunks.ru/balloon"
        "golang.org/x/crypto/blake2b"
        "golang.org/x/crypto/chacha20poly1305"
 )
diff --git a/src/go.mod b/src/go.mod
new file mode 100644 (file)
index 0000000..77ef98a
--- /dev/null
@@ -0,0 +1,17 @@
+module go.cypherpunks.ru/nncp/v5
+
+require (
+       github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892
+       github.com/dustin/go-humanize v1.0.0
+       github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6
+       github.com/google/go-cmp v0.3.1 // indirect
+       github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75
+       github.com/hjson/hjson-go v3.0.1+incompatible
+       github.com/klauspost/compress v1.9.2
+       github.com/kr/pretty v0.1.0 // indirect
+       go.cypherpunks.ru/balloon v1.1.0
+       golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708
+       golang.org/x/net v0.0.0-20191112182307-2180aed22343
+       golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056
+       gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
+)
diff --git a/src/go.sum b/src/go.sum
new file mode 100644 (file)
index 0000000..a0803fc
--- /dev/null
@@ -0,0 +1,35 @@
+github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892 h1:qg9VbHo1TlL0KDM0vYvBG9EY0X0Yku5WYIPoFWt8f6o=
+github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE=
+github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
+github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
+github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 h1:u/UEqS66A5ckRmS4yNpjmVH56sVtS/RfclBAYocb4as=
+github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ=
+github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75 h1:f0n1xnMSmBLzVfsMMvriDyA75NB/oBgILX2GcHXIQzY=
+github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA=
+github.com/hjson/hjson-go v3.0.1+incompatible h1:JwOXblcMiBbiWue7iPkoFK9oXSnW8n+qXh/0Fio6TCo=
+github.com/hjson/hjson-go v3.0.1+incompatible/go.mod h1:qsetwF8NlsTsOTwZTApNlTCerV+b2GjYRRcIk4JMFio=
+github.com/klauspost/compress v1.9.2 h1:LfVyl+ZlLlLDeQ/d2AqfGIIH4qEDu0Ed2S5GyhCWIWY=
+github.com/klauspost/compress v1.9.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+go.cypherpunks.ru/balloon v1.1.0 h1:tKwBeS1xrZYS/vn87Hm/4EvgNeHKyU1uC099aPRa2JQ=
+go.cypherpunks.ru/balloon v1.1.0/go.mod h1:k4s4ozrIrhpBjj78Z7LX8ZHxMQ+XE7DZUWl8gP2ojCo=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708 h1:pXVtWnwHkrWD9ru3sDxY/qFK/bfc0egRovX91EjWjf4=
+golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20191112182307-2180aed22343 h1:00ohfJ4K98s3m6BGUoBd8nyfp4Yl0GoIKvw5abItTjI=
+golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056 h1:dHtDnRWQtSx0Hjq9kvKFpBh9uPPKfQN70NZZmvssGwk=
+golang.org/x/sys v0.0.0-20191113165036-4c7a9d0fe056/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
similarity index 98%
rename from src/cypherpunks.ru/nncp/humanizer.go
rename to src/humanizer.go
index 68031d833a982174e463f3c33517f5013893c92b..5c6989526841fdf4b861216cec4621e3b1edae20 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
similarity index 95%
rename from src/cypherpunks.ru/nncp/jobs.go
rename to src/jobs.go
index ee7052d6d8d490228f12e512b031ca2af36ca495..080ec4aabea25885fdceb83ac6d2b40634f221cd 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
similarity index 91%
rename from src/cypherpunks.ru/nncp/lockdir.go
rename to src/lockdir.go
index 556e22d41491034322d388b7e95df166c9a99f94..32f9f6465efd9e3fe04f35452a3014f91392b9bb 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -31,7 +30,7 @@ func (ctx *Ctx) LockDir(nodeId *NodeId, xx TRxTx) (*os.File, error) {
        dirLock, err := os.OpenFile(
                lockPath,
                os.O_CREATE|os.O_WRONLY,
-               os.FileMode(0600),
+               os.FileMode(0666),
        )
        if err != nil {
                ctx.LogE("lockdir", SDS{"path": lockPath, "err": err}, "")
similarity index 95%
rename from src/cypherpunks.ru/nncp/log.go
rename to src/log.go
index 5ba13e96f96d108c70e57f020a765ccd40457a8b..b83db340170668ead8821ac96f67ea2903e8ebee 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -63,7 +62,7 @@ func (ctx *Ctx) Log(msg string) {
        fdLock, err := os.OpenFile(
                ctx.LogPath+".lock",
                os.O_CREATE|os.O_WRONLY,
-               os.FileMode(0600),
+               os.FileMode(0666),
        )
        if err != nil {
                fmt.Fprintln(os.Stderr, "Can not open lock for log:", err)
@@ -79,7 +78,7 @@ func (ctx *Ctx) Log(msg string) {
        fd, err := os.OpenFile(
                ctx.LogPath,
                os.O_CREATE|os.O_WRONLY|os.O_APPEND,
-               os.FileMode(0600),
+               os.FileMode(0666),
        )
        if err != nil {
                fmt.Fprintln(os.Stderr, "Can not open log:", err)
similarity index 100%
rename from src/cypherpunks.ru/nncp/nice.go
rename to src/nice.go
similarity index 84%
rename from src/cypherpunks.ru/nncp/nncp.go
rename to src/nncp.go
index 32f2eb6c3ed072edd498cd2a3450fbd4072f9c8b..9ff5b6d73fbb2fc26259af42532379a116bf415d 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,8 +25,7 @@ import (
 const (
        Warranty = `This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -39,7 +37,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.`
 )
 
 var (
-       Version string
+       Version string = "UNKNOWN"
 )
 
 func VersionGet() string {
@@ -49,7 +47,7 @@ func VersionGet() string {
 func UsageHeader() string {
        return VersionGet() + `
 Copyright (C) 2016-2019 Sergey Matveev
-License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+License GPLv3: GNU GPL version 3 <http://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.
 
similarity index 96%
rename from src/cypherpunks.ru/nncp/node.go
rename to src/node.go
index e903567bcdbff6befad0842cf61252938ff13b9d..ac78301f802464dae9c763de4de93495c259f748 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/pipe.go b/src/pipe.go
new file mode 100644 (file)
index 0000000..a5d8610
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+NNCP -- Node to Node copy, utilities for store-and-forward data exchange
+Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+package nncp
+
+import (
+       "os"
+       "os/exec"
+       "time"
+)
+
+type PipeConn struct {
+       cmd *exec.Cmd
+       r   *os.File
+       w   *os.File
+}
+
+func NewPipeConn(command string) (ConnDeadlined, error) {
+       cmd := exec.Command("/bin/sh", "-c", command)
+       stdinR, stdinW, err := os.Pipe()
+       if err != nil {
+               return nil, err
+       }
+       cmd.Stdin = stdinR
+       stdoutR, stdoutW, err := os.Pipe()
+       if err != nil {
+               return nil, err
+       }
+       cmd.Stdout = stdoutW
+       err = cmd.Start()
+       if err != nil {
+               return nil, err
+       }
+       return &PipeConn{cmd, stdoutR, stdinW}, nil
+}
+
+func (c PipeConn) Read(p []byte) (n int, err error) {
+       return c.r.Read(p)
+}
+
+func (c PipeConn) Write(p []byte) (n int, err error) {
+       return c.w.Write(p)
+}
+
+func (c PipeConn) SetReadDeadline(t time.Time) error {
+       return c.r.SetReadDeadline(t)
+}
+
+func (c PipeConn) SetWriteDeadline(t time.Time) error {
+       return c.w.SetWriteDeadline(t)
+}
+
+func (c PipeConn) Close() (err error) {
+       err = c.w.Close()
+       go c.cmd.Wait()
+       time.AfterFunc(time.Duration(10*time.Second), func() { c.cmd.Process.Kill() })
+       return
+}
similarity index 97%
rename from src/cypherpunks.ru/nncp/pkt.go
rename to src/pkt.go
index b2ab591c539a3497fb4a2d03f88f0c4e23eda93b..2fab844422486793be179dd571ef5f77386a3e1c 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -52,7 +51,7 @@ const (
 )
 
 var (
-       MagicNNCPPv2 [8]byte = [8]byte{'N', 'N', 'C', 'P', 'P', 0, 0, 2}
+       MagicNNCPPv3 [8]byte = [8]byte{'N', 'N', 'C', 'P', 'P', 0, 0, 3}
        MagicNNCPEv4 [8]byte = [8]byte{'N', 'N', 'C', 'P', 'E', 0, 0, 4}
        BadMagic     error   = errors.New("Unknown magic number")
        BadPktType   error   = errors.New("Unknown packet type")
@@ -124,7 +123,7 @@ func NewPkt(typ PktType, nice uint8, path []byte) (*Pkt, error) {
                return nil, errors.New("Too long path")
        }
        pkt := Pkt{
-               Magic:   MagicNNCPPv2,
+               Magic:   MagicNNCPPv3,
                Type:    typ,
                Nice:    nice,
                PathLen: uint8(len(path)),
similarity index 96%
rename from src/cypherpunks.ru/nncp/pkt_test.go
rename to src/pkt_test.go
index 43602d733ac199555ce11bc5d8ec26ff4ed48daa..678cbf474a420fba1d7c9aa1becee2822ad17389 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
similarity index 99%
rename from src/cypherpunks.ru/nncp/sp.go
rename to src/sp.go
index f28251459510edd97f8df3b77c6f5b8164297ac8..6dd724a59807b744b404763d03f8991f4cdc556f 100644 (file)
+++ b/src/sp.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -105,7 +104,7 @@ type FreqWithNice struct {
 }
 
 type ConnDeadlined interface {
-       io.ReadWriter
+       io.ReadWriteCloser
        SetReadDeadline(t time.Time) error
        SetWriteDeadline(t time.Time) error
 }
@@ -849,7 +848,7 @@ func (state *SPState) ProcessSP(payload []byte) ([][]byte, error) {
                        fd, err := os.OpenFile(
                                filePath+PartSuffix,
                                os.O_RDWR|os.O_CREATE,
-                               os.FileMode(0600),
+                               os.FileMode(0666),
                        )
                        if err != nil {
                                state.Ctx.LogE("sp-file", SdsAdd(sdsp, SDS{"err": err}), "")
similarity index 77%
rename from src/cypherpunks.ru/nncp/tmp.go
rename to src/tmp.go
index 3d73333a2ed764c9dd1ba38f03767cbc4d6428d5..95e45ee4a6162a3eb01ea084ecce9c6606f804e6 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,20 +21,28 @@ import (
        "bufio"
        "hash"
        "io"
-       "io/ioutil"
        "os"
        "path/filepath"
+       "strconv"
+       "time"
 
        "golang.org/x/crypto/blake2b"
 )
 
+func TempFile(dir, prefix string) (*os.File, error) {
+       // Assume that probability of suffix collision is negligible
+       suffix := strconv.FormatInt(time.Now().UnixNano()+int64(os.Getpid()), 16)
+       name := filepath.Join(dir, "nncp"+prefix+suffix)
+       return os.OpenFile(name, os.O_RDWR|os.O_CREATE|os.O_EXCL, os.FileMode(0666))
+}
+
 func (ctx *Ctx) NewTmpFile() (*os.File, error) {
        jobsPath := filepath.Join(ctx.Spool, "tmp")
        var err error
-       if err = os.MkdirAll(jobsPath, os.FileMode(0700)); err != nil {
+       if err = os.MkdirAll(jobsPath, os.FileMode(0777)); err != nil {
                return nil, err
        }
-       fd, err := ioutil.TempFile(jobsPath, "")
+       fd, err := TempFile(jobsPath, "")
        if err == nil {
                ctx.LogD("tmp", SDS{"src": fd.Name()}, "created")
        }
@@ -74,7 +81,7 @@ func (tmp *TmpFileWHash) Cancel() {
 
 func (tmp *TmpFileWHash) Commit(dir string) error {
        var err error
-       if err = os.MkdirAll(dir, os.FileMode(0700)); err != nil {
+       if err = os.MkdirAll(dir, os.FileMode(0777)); err != nil {
                return err
        }
        if err = tmp.W.Flush(); err != nil {
similarity index 95%
rename from src/cypherpunks.ru/nncp/toss.go
rename to src/toss.go
index 1f717faddedc1c01f4528f8f6ab1e2188a710ec5..0ce446ac807b39df6e6a067a2745b0631101ede2 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,7 +20,6 @@ package nncp
 import (
        "bufio"
        "bytes"
-       "compress/zlib"
        "fmt"
        "io"
        "io/ioutil"
@@ -36,6 +34,7 @@ import (
 
        "github.com/davecgh/go-xdr/xdr2"
        "github.com/dustin/go-humanize"
+       "github.com/klauspost/compress/zstd"
        "golang.org/x/crypto/blake2b"
        "golang.org/x/crypto/poly1305"
 )
@@ -44,7 +43,7 @@ const (
        SeenSuffix = ".seen"
 )
 
-func newNotification(fromTo *FromToYAML, subject string) io.Reader {
+func newNotification(fromTo *FromToJSON, subject string) io.Reader {
        return strings.NewReader(fmt.Sprintf(
                "From: %s\nTo: %s\nSubject: %s\n",
                fromTo.From,
@@ -59,6 +58,11 @@ func (ctx *Ctx) Toss(
        dryRun, doSeen, noFile, noFreq, noExec, noTrns bool,
 ) bool {
        isBad := false
+       decompressor, err := zstd.NewReader(nil)
+       if err != nil {
+               panic(err)
+       }
+       defer decompressor.Close()
        for job := range ctx.Jobs(nodeId, TRx) {
                pktName := filepath.Base(job.Fd.Name())
                sds := SDS{"node": job.PktEnc.Sender, "pkt": pktName}
@@ -118,10 +122,6 @@ func (ctx *Ctx) Toss(
                                "type": "exec",
                                "dst":  strings.Join(append([]string{handle}, args...), " "),
                        })
-                       decompressor, err := zlib.NewReader(pipeR)
-                       if err != nil {
-                               log.Fatalln(err)
-                       }
                        sender := ctx.Neigh[*job.PktEnc.Sender]
                        cmdline, exists := sender.Exec[handle]
                        if !exists || len(cmdline) == 0 {
@@ -129,6 +129,9 @@ func (ctx *Ctx) Toss(
                                isBad = true
                                goto Closing
                        }
+                       if err = decompressor.Reset(pipeR); err != nil {
+                               log.Fatalln(err)
+                       }
                        if !dryRun {
                                cmd := exec.Command(
                                        cmdline[0],
@@ -177,13 +180,13 @@ func (ctx *Ctx) Toss(
                                goto Closing
                        }
                        dir := filepath.Join(*incoming, path.Dir(dst))
-                       if err = os.MkdirAll(dir, os.FileMode(0700)); err != nil {
+                       if err = os.MkdirAll(dir, os.FileMode(0777)); err != nil {
                                ctx.LogE("rx", SdsAdd(sds, SDS{"err": err}), "mkdir")
                                isBad = true
                                goto Closing
                        }
                        if !dryRun {
-                               tmp, err := ioutil.TempFile(dir, "nncp-file")
+                               tmp, err := TempFile(dir, "file")
                                if err != nil {
                                        ctx.LogE("rx", SdsAdd(sds, SDS{"err": err}), "mktemp")
                                        isBad = true
@@ -222,7 +225,7 @@ func (ctx *Ctx) Toss(
                                                isBad = true
                                                goto Closing
                                        }
-                                       dstPath = dstPathOrig + strconv.Itoa(dstPathCtr)
+                                       dstPath = dstPathOrig + "." + strconv.Itoa(dstPathCtr)
                                        dstPathCtr++
                                }
                                if err = os.Rename(tmp.Name(), dstPath); err != nil {
similarity index 98%
rename from src/cypherpunks.ru/nncp/toss_test.go
rename to src/toss_test.go
index fb1a29fc829d088db88208445fde2a7419ff4ef8..4ccf4ead4ca656ff8738b6773b5cf385b56339ae 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,6 +26,7 @@ import (
        "os"
        "path/filepath"
        "strconv"
+       "strings"
        "testing"
        "testing/quick"
 
@@ -97,7 +97,7 @@ func TestTossExec(t *testing.T) {
                                replyNice,
                                handle,
                                []string{"arg0", "arg1"},
-                               []byte("BODY\n"),
+                               strings.NewReader("BODY\n"),
                                1<<15,
                        ); err != nil {
                                t.Error(err)
@@ -286,7 +286,7 @@ func TestTossFileSameName(t *testing.T) {
                expected := make(map[string]struct{})
                expected["samefile"] = struct{}{}
                for i := 0; i < files-1; i++ {
-                       expected["samefile"+strconv.Itoa(i)] = struct{}{}
+                       expected["samefile."+strconv.Itoa(i)] = struct{}{}
                }
                for _, filename := range dirFiles(incomingPath) {
                        if _, exists := expected[filename]; !exists {
@@ -442,7 +442,7 @@ func TestTossTrns(t *testing.T) {
                os.MkdirAll(txPath, os.FileMode(0700))
                for _, data := range datum {
                        pktTrans := Pkt{
-                               Magic:   MagicNNCPPv2,
+                               Magic:   MagicNNCPPv3,
                                Type:    PktTypeTrns,
                                PathLen: blake2b.Size256,
                                Path:    new([MaxPathSize]byte),
similarity index 97%
rename from src/cypherpunks.ru/nncp/tx.go
rename to src/tx.go
index fcf1c83126123649526e54c39bbff7e22f93dcdd..a509207422ccee4479b514b77c70736acc86e018 100644 (file)
+++ b/src/tx.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,7 +20,6 @@ package nncp
 import (
        "bufio"
        "bytes"
-       "compress/zlib"
        "crypto/rand"
        "errors"
        "hash"
@@ -33,6 +31,7 @@ import (
        "strings"
 
        "github.com/davecgh/go-xdr/xdr2"
+       "github.com/klauspost/compress/zstd"
        "golang.org/x/crypto/blake2b"
        "golang.org/x/crypto/chacha20poly1305"
 )
@@ -382,7 +381,7 @@ func (ctx *Ctx) TxExec(
        nice, replyNice uint8,
        handle string,
        args []string,
-       body []byte,
+       in io.Reader,
        minSize int64,
 ) error {
        path := make([][]byte, 0, 1+len(args))
@@ -395,14 +394,18 @@ func (ctx *Ctx) TxExec(
                return err
        }
        var compressed bytes.Buffer
-       compressor, err := zlib.NewWriterLevel(&compressed, zlib.BestCompression)
+       compressor, err := zstd.NewWriter(
+               &compressed,
+               zstd.WithEncoderLevel(zstd.SpeedDefault),
+       )
        if err != nil {
                return err
        }
-       if _, err = io.Copy(compressor, bytes.NewReader(body)); err != nil {
+       _, err = io.Copy(compressor, in)
+       compressor.Close()
+       if err != nil {
                return err
        }
-       compressor.Close()
        size := int64(compressed.Len())
        _, err = ctx.Tx(node, pkt, nice, size, minSize, &compressed)
        sds := SDS{
similarity index 97%
rename from src/cypherpunks.ru/nncp/tx_test.go
rename to src/tx_test.go
index 4bfccfcc5fd25f44bde984e5e666167e2c18b399..bde218f99043413a8be2134b533567fe1172e6a5 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
similarity index 92%
rename from src/cypherpunks.ru/nncp/via.go
rename to src/via.go
index 0868b76062df06be010036efd33c7441bdb8af4c..d8bdbbba0e73191e906e87511a1bde78128d3bc6 100644 (file)
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, version 3 of the License.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/supplementary_files.sh b/supplementary_files.sh
deleted file mode 100755 (executable)
index 5fce6c1..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh
-
-texi=`mktemp`
-
-cat > $texi <<EOF
-\input texinfo
-@documentencoding UTF-8
-@settitle NEWS
-
-@node News
-@unnumbered News
-
-`sed -n '5,$p' < doc/news.texi`
-
-@bye
-EOF
-makeinfo --plaintext -o NEWS $texi
-
-cat > $texi <<EOF
-\input texinfo
-@documentencoding UTF-8
-@settitle NEWS.RU
-
-@node Новости
-@unnumbered Новости
-
-`sed -n '3,$p' < doc/news.ru.texi | sed 's/^@subsection/@section/'`
-
-@bye
-EOF
-makeinfo --plaintext -o NEWS.RU $texi
-
-rm -f $texi
-
-texi=$(TMPDIR=doc mktemp)
-cat > $texi <<EOF
-\input texinfo
-@documentencoding UTF-8
-@settitle INSTALL
-
-@include install.texi
-
-@bye
-EOF
-makeinfo --plaintext -o INSTALL $texi
-rm -f $texi
-
-texi=`mktemp`
-
-cat > $texi <<EOF
-\input texinfo
-@documentencoding UTF-8
-@settitle THANKS
-
-`cat doc/thanks.texi`
-
-@bye
-EOF
-makeinfo --plaintext -o THANKS $texi
-rm -f $texi