BSDmakefile | 14 --------------
GNUmakefile | 14 --------------
Makefile | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++
README | 2 +-
README.RU | 2 +-
VERSION | 2 +-
common.mk | 74 -----------------------------------------------------
doc/Makefile | 1 +
doc/about.ru.texi | 4 ++--
doc/about.texi | 4 ++--
doc/building.texi | 26 ++++++++++++++++++++++++++
doc/bundles.texi | 12 ++++++------
doc/call.texi | 36 ++++++++++++++++++++----------------
doc/cfg.texi | 165 ++++++++++++++++++++++++++++++++++-------------------
doc/cmds.texi | 106 +++++++++++++++++++++++++++--------------------------
doc/comparison.ru.texi | 4 ++--
doc/comparison.texi | 4 ++--
doc/download.texi | 10 +++++++---
doc/git-bundler.sh | 14 ++++++++++++++
doc/index.texi | 3 +--
doc/install.texi | 17 +++++++++--------
doc/integration.texi | 63 +++++++++++++++++++++++++++++------------------------
doc/integrity.texi | 7 +++----
doc/news.ru.texi | 169 +++++++++++++++++++++++++++++++++++++++++++----------
doc/news.texi | 168 +++++++++++++++++++++++++++++++++++++++++++----------
doc/pkt.texi | 4 ++--
doc/platforms.texi | 51 ---------------------------------------------------
doc/sources.texi | 15 ++++++---------
doc/usecases.ru.texi | 65 +++++++++++++++++++++++++++++++----------------------
doc/usecases.texi | 63 +++++++++++++++++++++++++++++++----------------------
doc/warcer.sh | 4 ++--
doc/wgeter.sh | 6 +++---
makedist.sh | 153 ++++++++++++++++++++++++++++++++++++++++++-----------
ports/nncp/Makefile | 5 ++---
ports/nncp/files/nncp-caller.in | 4 ++--
ports/nncp/files/nncp-daemon.in | 4 ++--
ports/nncp/files/nncp-toss.in | 4 ++--
ports/nncp/files/pkg-deinstall.in | 4 ++--
ports/nncp/files/pkg-message.in | 2 +-
src/cmd/nncp-cfgnew/main.go | 218 +++++++++++++++++++++++++++++++++++++++++++++++++++++
src/cypherpunks.ru/nncp/base32.go => src/base32.go | 0
src/cypherpunks.ru/nncp/call.go => src/call.go | 11 ++++++++---
src/cypherpunks.ru/nncp/cfg.go => src/cfg.go | 193 +++++++++++++++++++++++++++--------------------------
src/cypherpunks.ru/nncp/check.go => src/check.go | 3 +--
src/cypherpunks.ru/nncp/chunked.go => src/chunked.go | 3 +--
src/cypherpunks.ru/nncp/cmd/nncp-bundle/main.go => src/cmd/nncp-bundle/main.go | 9 +++++----
src/cypherpunks.ru/nncp/cmd/nncp-call/main.go => src/cmd/nncp-call/main.go | 6 +++---
src/cypherpunks.ru/nncp/cmd/nncp-caller/main.go => src/cmd/nncp-caller/main.go | 6 +++---
src/cypherpunks.ru/nncp/cmd/nncp-cfgenc/main.go => src/cmd/nncp-cfgenc/main.go | 11 +++++------
src/cypherpunks.ru/nncp/cmd/nncp-cfgmin/main.go => src/cmd/nncp-cfgmin/main.go | 15 +++++++--------
src/cypherpunks.ru/nncp/cmd/nncp-cfgnew/main.go | 86 -----------------------------------------------------
src/cypherpunks.ru/nncp/cmd/nncp-check/main.go => src/cmd/nncp-check/main.go | 6 +++---
src/cypherpunks.ru/nncp/cmd/nncp-daemon/main.go => src/cmd/nncp-daemon/main.go | 26 +++++++++++++++-----------
src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go => src/cmd/nncp-exec/main.go | 14 ++++----------
src/cypherpunks.ru/nncp/cmd/nncp-file/main.go => src/cmd/nncp-file/main.go | 6 +++---
src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go => src/cmd/nncp-freq/main.go | 6 +++---
src/cypherpunks.ru/nncp/cmd/nncp-log/main.go => src/cmd/nncp-log/main.go | 5 ++---
src/cypherpunks.ru/nncp/cmd/nncp-pkt/main.go => src/cmd/nncp-pkt/main.go | 13 ++++++-------
src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go => src/cmd/nncp-reass/main.go | 12 ++++++------
src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go => src/cmd/nncp-rm/main.go | 6 +++---
src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go => src/cmd/nncp-stat/main.go | 6 +++---
src/cypherpunks.ru/nncp/cmd/nncp-toss/main.go => src/cmd/nncp-toss/main.go | 7 ++++---
src/cypherpunks.ru/nncp/cmd/nncp-xfer/main.go => src/cmd/nncp-xfer/main.go | 13 ++++++-------
src/cypherpunks.ru/nncp/ctx.go => src/ctx.go | 17 ++++++++++++-----
src/cypherpunks.ru/nncp/eblob.go => src/eblob.go | 5 ++---
src/cypherpunks.ru/nncp/go.mod | 15 ---------------
src/cypherpunks.ru/nncp/go.sum | 25 -------------------------
src/cypherpunks.ru/nncp/humanizer.go => src/humanizer.go | 3 +--
src/cypherpunks.ru/nncp/jobs.go => src/jobs.go | 3 +--
src/cypherpunks.ru/nncp/lockdir.go => src/lockdir.go | 5 ++---
src/cypherpunks.ru/nncp/log.go => src/log.go | 7 +++----
src/cypherpunks.ru/nncp/nice.go => src/nice.go | 0
src/cypherpunks.ru/nncp/nice_test.go => src/nice_test.go | 0
src/cypherpunks.ru/nncp/nncp.go => src/nncp.go | 10 ++++------
src/cypherpunks.ru/nncp/node.go => src/node.go | 3 +--
src/cypherpunks.ru/nncp/pkt.go => src/pkt.go | 7 +++----
src/cypherpunks.ru/nncp/pkt_test.go => src/pkt_test.go | 3 +--
src/cypherpunks.ru/nncp/sortbynice.go => src/sortbynice.go | 0
src/cypherpunks.ru/nncp/sp.go => src/sp.go | 7 +++----
src/cypherpunks.ru/nncp/tmp.go => src/tmp.go | 19 +++++++++++++------
src/cypherpunks.ru/nncp/toss.go => src/toss.go | 25 ++++++++++++++-----------
src/cypherpunks.ru/nncp/toss_test.go => src/toss_test.go | 10 +++++-----
src/cypherpunks.ru/nncp/tx.go => src/tx.go | 17 ++++++++++-------
src/cypherpunks.ru/nncp/tx_test.go => src/tx_test.go | 3 +--
src/cypherpunks.ru/nncp/via.go => src/via.go | 3 +--
src/go.mod | 17 +++++++++++++++++
src/go.sum | 35 +++++++++++++++++++++++++++++++++++
src/pipe.go | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++
supplementary_files.sh | 60 -----------------------------------------------------
diff --git a/BSDmakefile b/BSDmakefile
deleted file mode 100644
index e87d5c29572dbd6d15410d4f0b3436528b3df2133992fb2b7726f77afac13d28..0000000000000000000000000000000000000000
--- a/BSDmakefile
+++ /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
index 7bb48ffb78ea2392e440b6f7077ca04027d0196d36ebaa0217661e94dd74ed3d..0000000000000000000000000000000000000000
--- a/GNUmakefile
+++ /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
index 0000000000000000000000000000000000000000..a5acd2ad46392083b95127bb51922866ce5679693e78468318d527b963a7a018
--- /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 9d5db5e404a5adf39db249a4afab5dec123345fe224f0edcb2d413be4b7bc543..8952a9994d59687a98de1646953d1beeaad2c7e3414c1469fab012aeb1e2ae2f 100644
--- 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/
diff --git a/README.RU b/README.RU
index 0d982049740383e982e4dab436616bb31ee0e6fe78694dff2cf936f5d3845c51..eec03dfffe775817f054a853bde4600f65b86eb634520995f78033831b92db70 100644
--- a/README.RU
+++ b/README.RU
@@ -21,7 +21,7 @@
NNCP это свободное программное обеспечением: условия распространения
находятся в файле COPYING. Оно должно работать на всех POSIX-совместимых
системах. Лёгкая интеграция с существующими SMTP серверами. Единственный
-конфигурационный YAML файл.
+конфигурационный Hjson файл.
Домашняя страница: http://www.nncpgo.org/
diff --git a/VERSION b/VERSION
index 1895f81d1738a241e12e69233c2d67e0f2283cc2a6c9b2db4f148658fcdf4d58..66f2a752442fc764e44f203c55ad3ded2f621d3d55dbdc1f1ae3b57f325add6e 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.1
+5.0.0
diff --git a/common.mk b/common.mk
deleted file mode 100644
index 011505435587fe4b3412b8ea4a6ec21cd7b014a971714e0459813710066b19e9..0000000000000000000000000000000000000000
--- 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
diff --git a/doc/Makefile b/doc/Makefile
index 57628622c578f267d0249590da87d8764647f9339a410dcb8f427711db0de248..aa1183c1ac73a99177a6159118d5e6a75cc63e8d72ebfce83e9e4f976f56d4cf 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -13,6 +13,7 @@
nncp.html: *.texi sp.utxt pedro.txt
rm -f nncp.html/*.html
$(MAKEINFO) --html \
+ --set-customization-variable EXTRA_HEAD='' \
--set-customization-variable CSS_LINES='$(CSS)' \
--set-customization-variable SHOW_TITLE=0 \
--set-customization-variable USE_ACCESSKEY=0 \
diff --git a/doc/about.ru.texi b/doc/about.ru.texi
index a0f8b7089ab5c9fab059716d12828afcee766b1486c1ccfcedf696392b633ddf..2b430669dd7b7626fea62151d98a1ee8d26bf73f4f5fd7c6ae119939935291ae 100644
--- a/doc/about.ru.texi
+++ b/doc/about.ru.texi
@@ -38,11 +38,11 @@
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{Сравнение, сравнение}!
diff --git a/doc/about.texi b/doc/about.texi
index c410b9ff95eaefe06507a250230e1bbccf934c396c38d956331c2a36ecb29157..e3f2cd191294392f654142415e3d2bbfbb564877f7092b7395857ee0ff91f54c 100644
--- a/doc/about.texi
+++ b/doc/about.texi
@@ -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
index 0000000000000000000000000000000000000000..75b3b27d4c07209bd857942cc2e9b6cce590dbce82f6044b2bd6c7b8b332bc4d
--- /dev/null
+++ b/doc/building.texi
@@ -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
diff --git a/doc/bundles.texi b/doc/bundles.texi
index 66978a18af3be598db3673c01a01e188a3c710b98a3d8d0d2a4a1138c32b0470..be9dacdb96f866e6658ed295ef58a7c16b28d81cc326f389e17421d29bfddee8 100644
--- a/doc/bundles.texi
+++ b/doc/bundles.texi
@@ -18,11 +18,11 @@
@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
diff --git a/doc/call.texi b/doc/call.texi
index ba09599a64fb124d597ef458ab4810d1dd66e5a90f9be71bbabb249e1df2ac76..f4ecb593519d70e60e48c66a1e37afd5a94dd7e31e71f6943f5d62b57cf720cf 100644
--- a/doc/call.texi
+++ b/doc/call.texi
@@ -6,22 +6,26 @@
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,
diff --git a/doc/cfg.texi b/doc/cfg.texi
index 0e18d41844e6375e6c22caaddf7cb7312d68d5d347c4f89db289ef4f7f6e0cd6..b6ffffa013b87037b626febbc3d0dd55f5acd4f409507b780ffea6ded502ced2 100644
--- a/doc/cfg.texi
+++ b/doc/cfg.texi
@@ -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 @@ @verb{|echo hello world | nncp-exec OURNODE sendmail ARG0 ARG1 ARG2|}
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 @@
@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
diff --git a/doc/cmds.texi b/doc/cmds.texi
index c6711915ea9d40cac58ee6fc3a90b409ae6cff1e178f7bcc277eb33fffc23a92..6af1b37374ad3827037c7c80d922ae8eeabf7382e0f05ae6ec6cdfefb3a57e02 100644
--- a/doc/cmds.texi
+++ b/doc/cmds.texi
@@ -44,9 +44,9 @@ @node nncp-bundle
@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 @@ @node nncp-call
@section nncp-call
@verbatim
-% nncp-call [options]
+$ nncp-call [options]
[-onlinedeadline INT]
[-maxonlinetime INT]
[-rx|-tx]
@@ -120,12 +120,27 @@ 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 @@
@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 @@ @node nncp-cfgmin
@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 @@ @node nncp-cfgnew
@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 @@ @node nncp-check
@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 @@ @node nncp-daemon
@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 @@ @node nncp-exec
@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 @@ @node nncp-file
@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 @@ @node nncp-freq
@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 @@ @node nncp-log
@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 @@ @node nncp-pkt
@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 @@ @end verbatim
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 @@ @node nncp-reass
@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 @@ @node nncp-rm
@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 @@ @node nncp-stat
@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 @@ @node nncp-toss
@section nncp-toss
@verbatim
-% nncp-toss [options]
+$ nncp-toss [options]
[-node NODE]
[-dryrun]
[-cycle INT]
@@ -531,7 +533,7 @@ @node nncp-xfer
@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
diff --git a/doc/comparison.ru.texi b/doc/comparison.ru.texi
index 6bf5c7be411776a185d94cf6e88570ff7868fd886e9b66ec303e2d30c0103ecd..7dfb83d0f38204360fefc11c20cb5d10bc9dae836e68f938132ce17c53a7143a 100644
--- a/doc/comparison.ru.texi
+++ b/doc/comparison.ru.texi
@@ -30,7 +30,7 @@ @item Аутентификация участников @tab PAP @tab PAP/CHAP @tab публичный ключ @tab Нет
@item Шифрование пакетов @tab Нет @tab Нет @tab @strong{Да} @tab Нет
@item Приватность метаданных @tab Нет @tab Нет @tab @strong{Да} @tab Нет
@item Проверка целостности пакетов @tab Нет @tab Нет @tab @strong{Да} @tab Нет
-@item Дружелюбность к флоппинету @tab Нет @tab Нет @tab @strong{Да} @tab Нет
+@item Дружелюбность к флоппинету @tab Нет @tab Частично @tab @strong{Да} @tab Нет
@end multitable
@@ -48,7 +48,7 @@ почты будет какой-нибудь GoldEd, а не обычный почтовый клиент. Более
того, из коробки не предоставляется никакого шифрования и сильной
аутентификации.
- NNCP требует редактирование единственного YAML @ref{Configuration,
+ NNCP требует редактирование единственного Hjson @ref{Configuration,
конфигурационного файла}.
@item Передача новостей
diff --git a/doc/comparison.texi b/doc/comparison.texi
index d802ee527a6be457d20b2d6b1c91aa8b1558241c79850669a3b19f8326e5861d..e2ffcf574cb708a89f08cd80cbb50d5bed1c16dea36e2df9aa36cbeb364c96aa 100644
--- a/doc/comparison.texi
+++ b/doc/comparison.texi
@@ -29,7 +29,7 @@ @item Peers authentication @tab PAP @tab PAP/CHAP @tab public-key @tab No
@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 @@ software comparing to Unix one. Even mail editor will be something
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
diff --git a/doc/download.texi b/doc/download.texi
index 1b06df5ddc1b4aeff180996bf88c52608c647a09422e9aa74d4ecdac12c00bfa..b6ca193d0d7813e439bc46381798724edaab368a9f17f4d3825526d55245cbd7 100644
--- a/doc/download.texi
+++ b/doc/download.texi
@@ -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
@@ -22,6 +22,10 @@ @end multitable
@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}
diff --git a/doc/git-bundler.sh b/doc/git-bundler.sh
new file mode 100755
index 0000000000000000000000000000000000000000..30104e3d6f57d8b2aa2ad93afe6e75ea2d44d954ae9b88ef836b5578238d6c87
--- /dev/null
+++ b/doc/git-bundler.sh
@@ -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
diff --git a/doc/index.texi b/doc/index.texi
index a5ba6e1a7a85eb8d4b2fbea63c2ef60555749af7c893f1b6f4b31a25d01573a6..32ce8a71a230eaf4fce048c86449335e2fb34019c859c8c016b09c41f23c5905 100644
--- a/doc/index.texi
+++ b/doc/index.texi
@@ -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
diff --git a/doc/install.texi b/doc/install.texi
index aeb765a50281c658922bded535b2edafc5bf284ac5240c82a33b6c7f1d7de1dd..7cdea36dd046419eb437c135260df69928f5cef0237cc09038c9da24bbf72b33 100644
--- a/doc/install.texi
+++ b/doc/install.texi
@@ -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
diff --git a/doc/integration.texi b/doc/integration.texi
index 75813015d1e578fe8859a7e768767ae175807cd53c8909e6661f06d5e818ac61..4bdc9ced7c8a73529881c9a39889bbcbae3e75b112b88369bf076e45fade6eca 100644
--- a/doc/integration.texi
+++ b/doc/integration.texi
@@ -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 @@
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 @@ @url{https://www.gnu.org/software/wget/, GNU Wget} supports that
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 @@ @url{https://en.wikipedia.org/wiki/Web_ARChive, Web ARChives}:
@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 @@ @end verbatim
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 @@ "/usr/local/bin/aria2c",
"--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
diff --git a/doc/integrity.texi b/doc/integrity.texi
index 371677601807eaf0ae233077e21479857b27a6469c1a0f77d5df76835993ef4d..98bf43ae65686b605a0120e6642aa54642962b606d212ec1ce350a60d0dc81ff 100644
--- a/doc/integrity.texi
+++ b/doc/integrity.texi
@@ -20,9 +20,8 @@ @itemize
@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 @@ @end itemize
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
diff --git a/doc/news.ru.texi b/doc/news.ru.texi
index 9ff685aa41a04812b5b11c304f68dcef44d9a50d16dc4d28be786be6255bddc5..ef35bcd1e844fe0590e26ee406f08719ababf857cdc2c2d2503e006890e27e4b 100644
--- a/doc/news.ru.texi
+++ b/doc/news.ru.texi
@@ -1,72 +1,134 @@
@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
@@ -92,9 +154,11 @@
@node Релиз 3.0
@subsection Релиз 3.0
@itemize
+
@item
@strong{Несовместимое} изменение формата простых пакетов. Работа со
старыми версиями не поддерживается.
+
@item
Добавлена возможность удалённого исполнения команд, путём
конфигурирования @option{exec} опции конфигурационного файла и
@@ -109,84 +173,100 @@ @option{sendmail} опция конфигурационного файла заменена на более гибкую
@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 @@
@node Релиз 0.7
@subsection Релиз 0.7
@itemize
+
@item
Возможность предоставлять данные для @command{nncp-file} через
стандартный ввод, используя временный зашифрованный файл для этого.
@@ -243,12 +324,14 @@ Команда @command{nncp-newcfg} переименована в @command{nncp-cfgnew},
а @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 @@
@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
diff --git a/doc/news.texi b/doc/news.texi
index f873e3241a7dcdfbb4c6db9e05dd53d29e7392a2f4e2112b78559838925d0a9d..32ed92bab71d2de0781f6c9008b1261dbd617dec73cc98964cd33a7335232601 100644
--- a/doc/news.texi
+++ b/doc/news.texi
@@ -3,69 +3,130 @@ @unnumbered News
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 @@
@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{sendmail} configuration file option is replaced with
@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 @@
@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 @@
@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
diff --git a/doc/pkt.texi b/doc/pkt.texi
index a25082ef8c80556be8a0df29b2cb192b73fe3fa662582d42a374891b3dc55a67..f6ec564972296fad504b9d94065eabec70fe45caf27968035e0383b110a403ce 100644
--- a/doc/pkt.texi
+++ b/doc/pkt.texi
@@ -28,7 +28,7 @@ @multitable @columnfractions 0.2 0.3 0.5
@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 @@
@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
index 3ca9283520a32f18d5fb255fcd40cfab1925c1fdda47b2c3f916c40eef79fba6..0000000000000000000000000000000000000000
--- a/doc/platforms.texi
+++ /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
diff --git a/doc/sources.texi b/doc/sources.texi
index 8ca726370adbfcfe630c099b0058d76f4c7823b1dd973211d339c4fe15a4c648..bb7c7ad014fac4967e92574f217d0401885bea5ab86a11cd27431c6ed7220f20 100644
--- a/doc/sources.texi
+++ b/doc/sources.texi
@@ -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 @@ @headitem Software/library @tab Mirror
@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
diff --git a/doc/usecases.ru.texi b/doc/usecases.ru.texi
index 8bdf213c97c13f7cf76a754c983e595a880b2982b0a33242dd9baa196c9b268e..7656e163dcf48e478dffdc1d7e925f03e1e27b684e00c5cd7d3a654fbcfdf3ca 100644
--- a/doc/usecases.ru.texi
+++ b/doc/usecases.ru.texi
@@ -26,7 +26,7 @@ время от времени. Как опустошить очередь из ожидающих сообщений когда
ноутбук подключён?
Одна из возможностей это войти на сервер и сделать что-то типа
-@command{postqueue -f}, но по-умолчанию у вас есть только несколько дней
+@command{postqueue -f}, но по умолчанию у вас есть только несколько дней
на это, плюс отправитель будет получать уведомления о том, что его
сообщение всё ещё не доставлено. Кроме того, вы должны использовать
безопасный канал связи (SSH, VPN, итд).
@@ -80,8 +80,8 @@
Команды:
@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 @@ раньше или позднее остальных. Почти все команды имеют соответствующую
опцию:
@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 @@
Вы также можете использовать 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 @@ устройство (SD гораздо предпочтительнее!) хранения, подмонтируйте и
запустите @ref{nncp-xfer}:
@verbatim
-% nncp-xfer -node bob /media/usbstick
+$ nncp-xfer -node bob /media/usbstick
@end verbatim
чтобы скопировать все исходящие пакеты относящиеся к @emph{bob}.
@@ -149,14 +149,14 @@ @emph{bob} и к @emph{alice}, то тогда просто не указывайте
@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 @@ отсылать их. Они -- всего-лишь последовательность @ref{Encrypted,
зашифрованных пакетов}, которые вы можете принять.
@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 @@ отослать полезную нагрузку сразу же в самом первом пакете) безопасный
транспорт с свойством совершенной прямой секретности.
@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 @@
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 @@ Вы легко можете настроить ваши предпочтения в @ref{Call, настройках
звонков} для @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
diff --git a/doc/usecases.texi b/doc/usecases.texi
index 39c444cc04b23e821393dc60eb51080bce564a8c40f1166268d5ae4c9dea35d8..487ae5534b17d5806f23d336d8da790e5b8e5853926de80e46c8462e37074f3d 100644
--- a/doc/usecases.texi
+++ b/doc/usecases.texi
@@ -78,8 +78,8 @@
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 @@
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 @@ @emph{alice}, then just omit @option{-node} option to copy all available
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 @@
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
diff --git a/doc/warcer.sh b/doc/warcer.sh
index 7dd64ee43a768411dd837bd1c606d7cd14d87cc63f6f49ff65d12313d53d8cc6..57bda44d6fee849483e6b17417c94db2520fef332b39a213a9f53b08494f8cd3 100755
--- a/doc/warcer.sh
+++ b/doc/warcer.sh
@@ -19,6 +19,6 @@ --warc-file "$name" \
--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
diff --git a/doc/wgeter.sh b/doc/wgeter.sh
index f6c0132023d857588d3cfd24ab58815a55630b7e466442bcab5f9d359b3296b0..693c4c59396573dd55d62adcbcae81eb7e5cd4ea693e1349ef26f673842218b3 100755
--- a/doc/wgeter.sh
+++ b/doc/wgeter.sh
@@ -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
diff --git a/makedist.sh b/makedist.sh
index f548b3bb659ed8c2cc8e16821b2e338720e56c2352542bdd6175be33a9f139b0..eb4f571c68e2e882b1731bf07a7fcc8793777c120adea506c7fb70feea124499 100755
--- a/makedist.sh
+++ b/makedist.sh
@@ -5,39 +5,48 @@ tmp=$(mktemp -d)
release=$1
[ -n "$release" ]
-vendor=src/cypherpunks.ru/nncp/vendor
+git clone . $tmp/nncp-$release
+cd $tmp/nncp-$release
+git checkout v$release
+rm -fr .git
-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
+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 < $tmp/includes < $tmp/excludes < $texi < $texi < $texi < $texi < %%PREFIX%%/etc/nncp.yaml
+ # nncp-cfgnew > %%PREFIX%%/etc/nncp.hjson
======================================================================
diff --git a/src/cmd/nncp-cfgnew/main.go b/src/cmd/nncp-cfgnew/main.go
new file mode 100644
index 0000000000000000000000000000000000000000..a53163416ac236f04094dae494d454a70c90ac490c94b7c5cc5109f28de1b333
--- /dev/null
+++ b/src/cmd/nncp-cfgnew/main.go
@@ -0,0 +1,218 @@
+/*
+NNCP -- Node to Node copy, utilities for store-and-forward data exchange
+Copyright (C) 2016-2019 Sergey Matveev
+
+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 .
+*/
+
+// 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)
+}
diff --git a/src/cypherpunks.ru/nncp/base32.go b/src/base32.go
rename from src/cypherpunks.ru/nncp/base32.go
rename to src/base32.go
diff --git a/src/cypherpunks.ru/nncp/call.go b/src/call.go
rename from src/cypherpunks.ru/nncp/call.go
rename to src/call.go
index 2c2ff1f97be635e3ee8c2472e8afe6f029f020a3498f8155007e4cb7acb943f8..694eb90fe73fe655c45fe40f09d5536444482315621e00ab7cd29878d08bfb63 100644
--- a/src/cypherpunks.ru/nncp/call.go
+++ b/src/call.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ ) (isGood bool) {
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
diff --git a/src/cypherpunks.ru/nncp/cfg.go b/src/cfg.go
rename from src/cypherpunks.ru/nncp/cfg.go
rename to src/cfg.go
index c2005d8f13cc0e1f695f16c95c9c6021e7fb54366975c55e7dcc335921ea98fe..1cc050c612692403038dfa4b5d0e359881cc75e007cfb79b5e6ad08c078bcaf1 100644
--- a/src/cypherpunks.ru/nncp/cfg.go
+++ b/src/cfg.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ CfgLogEnv = "NNCPLOG"
)
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"`
+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 `yaml:"addrs,omitempty"`
+ Addrs map[string]string `json:"addrs,omitempty"`
- RxRate *int `yaml:"rxrate,omitempty"`
- TxRate *int `yaml:"txrate,omitempty"`
- OnlineDeadline *uint `yaml:"onlinedeadline,omitempty"`
- MaxOnlineTime *uint `yaml:"maxonlinetime,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 @@ }
}
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 @@ }
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 @@ copy(node.NoisePrv[:], noisePrv)
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 @@ if err != nil {
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),
+ Spool: spoolPath,
+ LogPath: logPath,
+ UmaskForce: umaskForce,
+ Self: self,
+ Neigh: make(map[NodeId]*Node, len(cfgJSON.Neigh)),
+ Alias: make(map[string]*NodeId),
}
- if cfgYAML.Notify != nil {
- if cfgYAML.Notify.File != nil {
- ctx.NotifyFile = cfgYAML.Notify.File
+ 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 @@ if _, already := ctx.Alias[name]; already {
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 {
diff --git a/src/cypherpunks.ru/nncp/check.go b/src/check.go
rename from src/cypherpunks.ru/nncp/check.go
rename to src/check.go
index 6eae1d08364aaf7f6f70a4dadc13aa3ff9ead37d50f6eb5f925792e4f033464b..9c871a94c43f84a673c76f731fad8edbf3672b8a5212a03d4139adff2308d9a5 100644
--- a/src/cypherpunks.ru/nncp/check.go
+++ b/src/check.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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/cypherpunks.ru/nncp/chunked.go b/src/chunked.go
rename from src/cypherpunks.ru/nncp/chunked.go
rename to src/chunked.go
index 3f293ec6157c6ec92f6ee0f3e7cc8b47a80e2044db2869c47ae7ec92d6f76aa0..275c2786bf4acfba782c2ee6c19dfbf8e8e683e372b2fe7b3459fa5c9f507ba9 100644
--- a/src/cypherpunks.ru/nncp/chunked.go
+++ b/src/chunked.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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/cypherpunks.ru/nncp/cmd/nncp-bundle/main.go b/src/cmd/nncp-bundle/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-bundle/main.go
rename to src/cmd/nncp-bundle/main.go
index dcc86c2bade2d0651f95f2f169cff92001468ae5e3044cb4e88422c92075bce9..e311277785af3066b6dda32c7eda736f1ec38f3c849ce45b866c9fd7503dc35e 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-bundle/main.go
+++ b/src/cmd/nncp-bundle/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "path/filepath"
"strconv"
"strings"
- "cypherpunks.ru/nncp"
"github.com/davecgh/go-xdr/xdr2"
+ "go.cypherpunks.ru/nncp/v5"
"golang.org/x/crypto/blake2b"
)
@@ -102,6 +101,8 @@ log.Fatalln("Invalid specified:", err)
}
nodeIds[*node.Id] = struct{}{}
}
+
+ ctx.Umask()
sds := nncp.SDS{}
if *doTx {
@@ -371,7 +372,7 @@ if err = tmp.Sync(); err != nil {
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 {
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-call/main.go b/src/cmd/nncp-call/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-call/main.go
rename to src/cmd/nncp-call/main.go
index af15fae979463e0b6b5bd80a75f9ed70b72f3cf1d87c3f1344b45cc8bb5d1867..0b0396225f84057a1d6c55f6825bd37da8297e28a0b582e33844d5036361efb0 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-call/main.go
+++ b/src/cmd/nncp-call/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "log"
"os"
"strings"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
@@ -140,6 +139,7 @@ onlyPkts[*pktIdArr] = true
}
}
+ ctx.Umask()
if !ctx.CallNode(
node,
addrs,
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-caller/main.go b/src/cmd/nncp-caller/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-caller/main.go
rename to src/cmd/nncp-caller/main.go
index 7b5fee13453e13a0e81d9a720f75461530e3795b3d31bff28a4a2732960adc68..4aa579dd6c6a022c67ccf4f1d7261f72bd6a0f6688712f4174f12ce5b20837ee 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-caller/main.go
+++ b/src/cmd/nncp-caller/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "strconv"
"sync"
"time"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
@@ -67,6 +66,7 @@ }
if ctx.Self == nil {
log.Fatalln("Config lacks private keys")
}
+ ctx.Umask()
var nodes []*nncp.Node
if flag.NArg() > 0 {
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-cfgenc/main.go b/src/cmd/nncp-cfgenc/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-cfgenc/main.go
rename to src/cmd/nncp-cfgenc/main.go
index b2813035dce350b9748957487870c644f8aeb8ee1ee75fce92e0c474664189e5..6e3c0c063eee6a55d2339fa865ec7add1279858796ba3682d78550742d4c5639 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-cfgenc/main.go
+++ b/src/cmd/nncp-cfgenc/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "io/ioutil"
"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 @@
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()
}
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-cfgmin/main.go b/src/cmd/nncp-cfgmin/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-cfgmin/main.go
rename to src/cmd/nncp-cfgmin/main.go
index ea3fbd6e45716519c27bd9f47f8a940e8214a3825558296eed0e9b2d5dc0af98..83c4a100bf7a13329e7c04d73d7112cb8f54dd084f15b6c18f4e36e502b15673 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-cfgmin/main.go
+++ b/src/cmd/nncp-cfgmin/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "fmt"
"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 @@ if err != nil {
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 @@ if node.NoisePub != nil {
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/cypherpunks.ru/nncp/cmd/nncp-cfgnew/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-cfgnew/main.go
deleted file mode 100644
index 24156f793d5f93967de471b984c9c6351635d175f292912929a93a93fd61ab77..0000000000000000000000000000000000000000
--- a/src/cypherpunks.ru/nncp/cmd/nncp-cfgnew/main.go
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2019 Sergey Matveev
-
-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 .
-*/
-
-// 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/cmd/nncp-check/main.go b/src/cmd/nncp-check/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-check/main.go
rename to src/cmd/nncp-check/main.go
index e03f4c339cf16ff7ce96db4266062557fc9dc39a9e0d4eae3acf55c1cf6df308..82d36f51ae2b16ba36299cba4274b492591e3ce925afb24cc3dfb65b95c8cd52 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-check/main.go
+++ b/src/cmd/nncp-check/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "fmt"
"log"
"os"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
@@ -61,6 +60,7 @@ ctx, err := nncp.CtxFromCmdline(*cfgPath, *spoolPath, *logPath, *quiet, *debug)
if err != nil {
log.Fatalln("Error during initialization:", err)
}
+ ctx.Umask()
var nodeOnly *nncp.Node
if *nodeRaw != "" {
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-daemon/main.go b/src/cmd/nncp-daemon/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-daemon/main.go
rename to src/cmd/nncp-daemon/main.go
index fe8068705730bf1d7d5f541dad29834cdd12d4e4ed2a18661a5c55c88123a138..8a30d2c7265708653ef8fed1525d4e2e18f4a596d5d68d3226a56a2008e3f6f2 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-daemon/main.go
+++ b/src/cmd/nncp-daemon/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "os"
"strconv"
"time"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
"golang.org/x/net/netutil"
)
@@ -44,20 +43,24 @@ r *os.File
w *os.File
}
-func (ic *InetdConn) Read(p []byte) (n int, err error) {
- return ic.r.Read(p)
+func (c InetdConn) Read(p []byte) (n int, err error) {
+ return c.r.Read(p)
+}
+
+func (c InetdConn) Write(p []byte) (n int, err error) {
+ return c.w.Write(p)
}
-func (ic *InetdConn) Write(p []byte) (n int, err error) {
- return ic.w.Write(p)
+func (c InetdConn) SetReadDeadline(t time.Time) error {
+ return c.r.SetReadDeadline(t)
}
-func (ic *InetdConn) SetReadDeadline(t time.Time) error {
- return ic.r.SetReadDeadline(t)
+func (c InetdConn) SetWriteDeadline(t time.Time) error {
+ return c.w.SetWriteDeadline(t)
}
-func (ic *InetdConn) SetWriteDeadline(t time.Time) error {
- return ic.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 @@ }
if ctx.Self == nil {
log.Fatalln("Config lacks private keys")
}
+ ctx.Umask()
if *inetd {
os.Stderr.Close()
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go b/src/cmd/nncp-exec/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go
rename to src/cmd/nncp-exec/main.go
index 633c190ca7b25f2df4e417895728fe71ba2041f15f287d056d132bc763d03b22..f478ed907e81be17e1d7d3eb81e6c979dc2dc7cdb5eccc920f90eb07139c1d4f 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go
+++ b/src/cmd/nncp-exec/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ log.Fatalln("Invalid NODE specified:", err)
}
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 @@ nice,
replyNice,
flag.Args()[1],
flag.Args()[2:],
- body,
+ bufio.NewReader(os.Stdin),
int64(*minSize)*1024,
); err != nil {
log.Fatalln(err)
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-file/main.go b/src/cmd/nncp-file/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-file/main.go
rename to src/cmd/nncp-file/main.go
index d3ecc69d88bb3494cfb37e5f1c4397e047108341329a16a822e0d3287e06bccb..1d82d8cfc6456e6f28d7167d65c029494a40e224c5ade12b37d54b828ddb9df7 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-file/main.go
+++ b/src/cmd/nncp-file/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "log"
"os"
"strings"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
@@ -94,6 +93,7 @@ log.Fatalln("Invalid NODE specified:", err)
}
nncp.ViaOverride(*viaOverride, ctx, node)
+ ctx.Umask()
var minSize int64
if *argMinSize < 0 {
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go b/src/cmd/nncp-freq/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go
rename to src/cmd/nncp-freq/main.go
index ca311ab4f2ead1d2146bc0dade8fc22b7abdabf4778b0b830f95fe78876160f7..a28e0a1dfe332b54b8cd059a2f82b3bd0ab7a237dd7f5338b414923ce70caac0 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go
+++ b/src/cmd/nncp-freq/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "path/filepath"
"strconv"
"strings"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
@@ -94,6 +93,7 @@ log.Fatalln("Invalid NODE specified:", err)
}
nncp.ViaOverride(*viaOverride, ctx, node)
+ ctx.Umask()
var dst string
if flag.NArg() == 2 {
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-log/main.go b/src/cmd/nncp-log/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-log/main.go
rename to src/cmd/nncp-log/main.go
index 3f73bf778cf3e236dae424a1ac61d1aa442f90a2eae5df111d197721360cdcd3..2e9fa81fb0ee9ae3d947b2a1877fb4138ca8f4ca2ae90797674027150edcb777 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-log/main.go
+++ b/src/cmd/nncp-log/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "fmt"
"log"
"os"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-pkt/main.go b/src/cmd/nncp-pkt/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-pkt/main.go
rename to src/cmd/nncp-pkt/main.go
index abb04be7c8f374e9e1430cd9f5ea8876d93a25198e1ab5bd946ef4a5dfce2e15..5f3977ee00cbc014500bd89ab451f3267a5c2f8f0ed2e436e84bfb99c8845938 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-pkt/main.go
+++ b/src/cmd/nncp-pkt/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@
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 @@ log.Fatalln("Not enough data to read")
}
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)
}
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go b/src/cmd/nncp-reass/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go
rename to src/cmd/nncp-reass/main.go
index 636da54533599055d7262ccc7d8afc816e87904035b3bb1544e1460c3b90274c..1e59113c2b47306e75c52909fab751dc17c7dbadac2805f96623167790e3e246 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-reass/main.go
+++ b/src/cmd/nncp-reass/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "flag"
"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 @@ if stdout {
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 @@ break
}
log.Fatalln(err)
}
- dstPath = dstPathOrig + strconv.Itoa(dstPathCtr)
+ dstPath = dstPathOrig + "." + strconv.Itoa(dstPathCtr)
dstPathCtr++
}
if err = os.Rename(tmp.Name(), dstPath); err != nil {
@@ -318,6 +316,8 @@ if *allNodes && nodeOnly != nil {
usage()
os.Exit(1)
}
+
+ ctx.Umask()
if flag.NArg() > 0 {
if process(ctx, flag.Arg(0), *keep, *dryRun, *stdout, *dumpMeta) {
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go b/src/cmd/nncp-rm/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go
rename to src/cmd/nncp-rm/main.go
index 708f9ca5478e7d922ec1f1bc19ea2b91a6f167bac2d26c58380bf8dbc5a54e85..e234aedd3758fa62577729a14adbe5882f9017cb771fea369a2fbb5ff7703a8a 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go
+++ b/src/cmd/nncp-rm/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "os"
"path/filepath"
"strings"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
@@ -75,6 +74,7 @@ ctx, err := nncp.CtxFromCmdline(*cfgPath, *spoolPath, "", *quiet, *debug)
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 {
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go b/src/cmd/nncp-stat/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go
rename to src/cmd/nncp-stat/main.go
index 41fd3a100631378d0ece93b2cb8840d6b7f4fe0adbcb142456d451b619038dd9..d0c2ec5dbf1c0e01c43761eb142e9a78f4e56b1b8674392076de29d62c99b7b1 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-stat/main.go
+++ b/src/cmd/nncp-stat/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "log"
"os"
"sort"
- "cypherpunks.ru/nncp"
"github.com/dustin/go-humanize"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
@@ -78,6 +77,7 @@ nodeNameToNode[node.Name] = node
}
sort.Strings(nodeNames)
+ ctx.Umask()
var node *nncp.Node
for _, nodeName := range nodeNames {
node = nodeNameToNode[nodeName]
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-toss/main.go b/src/cmd/nncp-toss/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-toss/main.go
rename to src/cmd/nncp-toss/main.go
index 33fca24c1e2ffebcfdc023af85120037882df9e60101d245e6c8471975a09252..975f371aad2928a9aaabd52e1979f13304769774747aa5ae107181c26bb6940a 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-toss/main.go
+++ b/src/cmd/nncp-toss/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "log"
"os"
"time"
- "cypherpunks.ru/nncp"
+ "go.cypherpunks.ru/nncp/v5"
)
func usage() {
@@ -85,6 +84,8 @@ if err != nil {
log.Fatalln("Invalid -node specified:", err)
}
}
+
+ ctx.Umask()
Cycle:
isBad := false
diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-xfer/main.go b/src/cmd/nncp-xfer/main.go
rename from src/cypherpunks.ru/nncp/cmd/nncp-xfer/main.go
rename to src/cmd/nncp-xfer/main.go
index 3ee59490dd70875cdd5625d105a01a57fe2ee9bab12157f25f0c04b2bcfa63bc..499364921cdeb4b73722d20d7f615ed721fb6803bd29fe627a5ceaf4a34affea 100644
--- a/src/cypherpunks.ru/nncp/cmd/nncp-xfer/main.go
+++ b/src/cmd/nncp-xfer/main.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "bufio"
"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 @@ log.Fatalln("Invalid -node specified:", err)
}
}
+ ctx.Umask()
selfPath := filepath.Join(flag.Arg(0), ctx.SelfId.String())
isBad := false
var dir *os.File
@@ -245,7 +244,7 @@ if !*mkdir {
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 @@ sds["dir"] = dstPath
_, 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 @@ ctx.LogD("nncp-xfer", sds, "already exists")
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()
diff --git a/src/cypherpunks.ru/nncp/ctx.go b/src/ctx.go
rename from src/cypherpunks.ru/nncp/ctx.go
rename to src/ctx.go
index 66f3b4686b59cacc2c498acb648b1ee61f3b4c9a7240d7d3b4eda9080499cf92..b0501f7ccd1e512ac0df297f87e412ca4d3c1d53b75f494cdc98f7f413361e36 100644
--- a/src/cypherpunks.ru/nncp/ctx.go
+++ b/src/ctx.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "os"
"path/filepath"
"golang.org/x/sys/unix"
+ "syscall"
)
type Ctx struct {
@@ -36,10 +36,11 @@ Alias map[string]*NodeId
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) 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 @@ log.Fatalln(err)
}
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/eblob.go b/src/eblob.go
rename from src/cypherpunks.ru/nncp/eblob.go
rename to src/eblob.go
index 6b63645804df4a8e1fa4f8dadfa5442f3ce6d179a5ebab16a6341bd92c2e4bf4..e9fdc9e1f1b8444229ba1bac9964b0f74ec27ef260db895149bf3c5eb2f13658 100644
--- a/src/cypherpunks.ru/nncp/eblob.go
+++ b/src/eblob.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "bytes"
"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/cypherpunks.ru/nncp/go.mod b/src/cypherpunks.ru/nncp/go.mod
deleted file mode 100644
index c39492e9c56f686e78dced827a11c860fb82381fb1b53e22a6cfcf5098d32cbb..0000000000000000000000000000000000000000
--- a/src/cypherpunks.ru/nncp/go.mod
+++ /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
index 3cf147169a2e914e6bb192b9698d013a54af600d5d565930627874061402e188..0000000000000000000000000000000000000000
--- a/src/cypherpunks.ru/nncp/go.sum
+++ /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/humanizer.go b/src/humanizer.go
rename from src/cypherpunks.ru/nncp/humanizer.go
rename to src/humanizer.go
index e78569fdf25ffda78552df33b81dc2aea9b770a3ff9cd0c4cde9ececf27408f2..ac94e70c683043b0c7d53fc96460e0d49a3dfb854674494581948fde7e1cdb51 100644
--- a/src/cypherpunks.ru/nncp/humanizer.go
+++ b/src/humanizer.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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/cypherpunks.ru/nncp/jobs.go b/src/jobs.go
rename from src/cypherpunks.ru/nncp/jobs.go
rename to src/jobs.go
index 4d3ddd39b0525841e3bac6901f8cbfdd61c2ed0af2eaf78613fc37e176f56a2c..b0b5c76c927e9f15101edc4e157ead7a7f615b9f6310f09f3cddb7371787aa64 100644
--- a/src/cypherpunks.ru/nncp/jobs.go
+++ b/src/jobs.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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/cypherpunks.ru/nncp/lockdir.go b/src/lockdir.go
rename from src/cypherpunks.ru/nncp/lockdir.go
rename to src/lockdir.go
index 7158dfcceba3627b341aecdbcc36daebfcf35c6e648379459683e539143a8bf9..4a73bc9ab8e3bc4122c7d2ee3f890f2e85d827291f3569127eb8762499f90401 100644
--- a/src/cypherpunks.ru/nncp/lockdir.go
+++ b/src/lockdir.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ lockPath := filepath.Join(ctx.Spool, nodeId.String(), string(xx)) + ".lock"
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}, "")
diff --git a/src/cypherpunks.ru/nncp/log.go b/src/log.go
rename from src/cypherpunks.ru/nncp/log.go
rename to src/log.go
index 42a2228a7288bff2a432d1a595878d936e46bca4941f8ffcc18e0b99e6e96bd9..f8ea1bf2ccd4a2b0cb75ea1806b00c1fed955be2be7d4e04288e921e068f5a54 100644
--- a/src/cypherpunks.ru/nncp/log.go
+++ b/src/log.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ defer unix.Flock(fdLockFd, unix.LOCK_UN)
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)
diff --git a/src/cypherpunks.ru/nncp/nice.go b/src/nice.go
rename from src/cypherpunks.ru/nncp/nice.go
rename to src/nice.go
diff --git a/src/cypherpunks.ru/nncp/nice_test.go b/src/nice_test.go
rename from src/cypherpunks.ru/nncp/nice_test.go
rename to src/nice_test.go
diff --git a/src/cypherpunks.ru/nncp/nncp.go b/src/nncp.go
rename from src/cypherpunks.ru/nncp/nncp.go
rename to src/nncp.go
index 1e6edfa286b3ea0de506c99f5034e2c8c30335d648d481486ed8770267c3abf1..572ebd3039970c1e875acf4efaf7cd3ab6984612a51ee2882bc28473dbda36fe 100644
--- a/src/cypherpunks.ru/nncp/nncp.go
+++ b/src/nncp.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@
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 .`
)
var (
- Version string
+ Version string = "UNKNOWN"
)
func VersionGet() string {
@@ -49,7 +47,7 @@
func UsageHeader() string {
return VersionGet() + `
Copyright (C) 2016-2019 Sergey Matveev
-License GPLv3+: GNU GPL version 3 or later
+License GPLv3: GNU GPL version 3
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
diff --git a/src/cypherpunks.ru/nncp/node.go b/src/node.go
rename from src/cypherpunks.ru/nncp/node.go
rename to src/node.go
index 5b5417253dd2dc7667bb2abce8aa8f7bb8f484725679915b72b86f97eb43a857..9817303c9000601473bc10058933b06fd3591e9514bb84501f1f23db82260c89 100644
--- a/src/cypherpunks.ru/nncp/node.go
+++ b/src/node.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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/cypherpunks.ru/nncp/pkt.go b/src/pkt.go
rename from src/cypherpunks.ru/nncp/pkt.go
rename to src/pkt.go
index 4085a5856a8553d0de50834500cee6181c40bd01b26b09a923006e49d30e3868..f268c5a608708850766034711ec60dfb15a1a8b4f6c61158c458e9ee72da1828 100644
--- a/src/cypherpunks.ru/nncp/pkt.go
+++ b/src/pkt.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ NNCPBundlePrefix = "NNCP"
)
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 @@ if len(path) > MaxPathSize {
return nil, errors.New("Too long path")
}
pkt := Pkt{
- Magic: MagicNNCPPv2,
+ Magic: MagicNNCPPv3,
Type: typ,
Nice: nice,
PathLen: uint8(len(path)),
diff --git a/src/cypherpunks.ru/nncp/pkt_test.go b/src/pkt_test.go
rename from src/cypherpunks.ru/nncp/pkt_test.go
rename to src/pkt_test.go
index f006b07f6f72e9594f264c34c91c28d036edb6e4af63d0bc94a787a012d60161..42d3a01aa6bc21f285aafb024e1f0174ee3e2ddc2f54951c2abd47474f15c8ea 100644
--- a/src/cypherpunks.ru/nncp/pkt_test.go
+++ b/src/pkt_test.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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/cypherpunks.ru/nncp/sortbynice.go b/src/sortbynice.go
rename from src/cypherpunks.ru/nncp/sortbynice.go
rename to src/sortbynice.go
diff --git a/src/cypherpunks.ru/nncp/sp.go b/src/sp.go
rename from src/cypherpunks.ru/nncp/sp.go
rename to src/sp.go
index 43941c7678b24832d081168625933eb07c1ab6e13bdb1e497bbe5f5eb0a58a21..899d5c6268a60e5c71b9c2fa6ca38811afcfbfa4565a87e68b2586e21d2a0d5d 100644
--- a/src/cypherpunks.ru/nncp/sp.go
+++ b/src/sp.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ nice uint8
}
type ConnDeadlined interface {
- io.ReadWriter
+ io.ReadWriteCloser
SetReadDeadline(t time.Time) error
SetWriteDeadline(t time.Time) error
}
@@ -849,7 +848,7 @@ state.Ctx.LogD("sp-file", sdsp, "opening part")
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}), "")
diff --git a/src/cypherpunks.ru/nncp/tmp.go b/src/tmp.go
rename from src/cypherpunks.ru/nncp/tmp.go
rename to src/tmp.go
index 14325c1d01b283166af762161479e39528e27287b967f69efcc931f396316714..0b1672a56890508dbdc28b9c69a68e0ef026fde497b5538fc2745fffd76a5413 100644
--- a/src/cypherpunks.ru/nncp/tmp.go
+++ b/src/tmp.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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) 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 {
diff --git a/src/cypherpunks.ru/nncp/toss.go b/src/toss.go
rename from src/cypherpunks.ru/nncp/toss.go
rename to src/toss.go
index a8664d437621f851a69b6d5032e7907490d26455a533cd723e1451e711b82265..2f312920a4d4ac3dd26bbe3a91328135ff18b72fd7b51ac00bd16dc2f7fe8415 100644
--- a/src/cypherpunks.ru/nncp/toss.go
+++ b/src/toss.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@
import (
"bufio"
"bytes"
- "compress/zlib"
"fmt"
"io"
"io/ioutil"
@@ -36,6 +34,7 @@ "strings"
"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 @@ nice uint8,
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,16 +122,15 @@ sds := SdsAdd(sds, SDS{
"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 {
ctx.LogE("rx", SdsAdd(sds, SDS{"err": "No handle found"}), "")
isBad = true
goto Closing
+ }
+ if err = decompressor.Reset(pipeR); err != nil {
+ log.Fatalln(err)
}
if !dryRun {
cmd := exec.Command(
@@ -177,13 +180,13 @@ isBad = true
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 @@ ctx.LogE("rx", SdsAdd(sds, SDS{"err": err}), "stat")
isBad = true
goto Closing
}
- dstPath = dstPathOrig + strconv.Itoa(dstPathCtr)
+ dstPath = dstPathOrig + "." + strconv.Itoa(dstPathCtr)
dstPathCtr++
}
if err = os.Rename(tmp.Name(), dstPath); err != nil {
diff --git a/src/cypherpunks.ru/nncp/toss_test.go b/src/toss_test.go
rename from src/cypherpunks.ru/nncp/toss_test.go
rename to src/toss_test.go
index 5a64475c4f0e9eae9154f0275d73981bd313e5d8dd7b365113a1163004c3526b..2ff29b5ec9611a7c0f0da76d2cb7450384ad8bbfd8117998ca68386ea8c17a4d 100644
--- a/src/cypherpunks.ru/nncp/toss_test.go
+++ b/src/toss_test.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@ "io/ioutil"
"os"
"path/filepath"
"strconv"
+ "strings"
"testing"
"testing/quick"
@@ -97,7 +97,7 @@ DefaultNiceExec,
replyNice,
handle,
[]string{"arg0", "arg1"},
- []byte("BODY\n"),
+ strings.NewReader("BODY\n"),
1<<15,
); err != nil {
t.Error(err)
@@ -286,7 +286,7 @@ ctx.Toss(ctx.Self.Id, DefaultNiceFile, false, false, false, false, false, false)
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 @@ txPath := filepath.Join(spool, ctx.Self.Id.String(), string(TTx))
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),
diff --git a/src/cypherpunks.ru/nncp/tx.go b/src/tx.go
rename from src/cypherpunks.ru/nncp/tx.go
rename to src/tx.go
index 9296a40a0cd64175c93e58ffca64c513388a08850b1bd66673ccd79f1f2f7c1b..7fb6bb93ee05f5b1081204a4ba8d357c848011d921bf3b15c8b9fe419cc2d42d 100644
--- a/src/cypherpunks.ru/nncp/tx.go
+++ b/src/tx.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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 @@
import (
"bufio"
"bytes"
- "compress/zlib"
"crypto/rand"
"errors"
"hash"
@@ -33,6 +31,7 @@ "strconv"
"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 @@ node *Node,
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 @@ if err != nil {
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{
diff --git a/src/cypherpunks.ru/nncp/tx_test.go b/src/tx_test.go
rename from src/cypherpunks.ru/nncp/tx_test.go
rename to src/tx_test.go
index 035838f903707994fbe5a74d7ad0213100ae65363c503cf84c04a55f0e328d72..001c3e18b166efe0bf5604a126d0fa2ed670f34fceb2de938cadc8de101d133b 100644
--- a/src/cypherpunks.ru/nncp/tx_test.go
+++ b/src/tx_test.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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/cypherpunks.ru/nncp/via.go b/src/via.go
rename from src/cypherpunks.ru/nncp/via.go
rename to src/via.go
index ca80c96bbbb1151c1df566f5a0594d596287583ac1e8558237a75a9cf17d939a..ff82b6e438a3eb8cf4e5f5e29f4c347d54ae3e7672c24437b7bff229740deb8c 100644
--- a/src/cypherpunks.ru/nncp/via.go
+++ b/src/via.go
@@ -4,8 +4,7 @@ Copyright (C) 2016-2019 Sergey Matveev
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/go.mod b/src/go.mod
new file mode 100644
index 0000000000000000000000000000000000000000..637148a836bea72d5f3ed0d2e4903ffec057bbdeb4fe986a7a1f653d863e9920
--- /dev/null
+++ b/src/go.mod
@@ -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
index 0000000000000000000000000000000000000000..cc93040520235046200fdbee7cafd74955f140be686b0ef6aeec0676b846f382
--- /dev/null
+++ b/src/go.sum
@@ -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=
diff --git a/src/pipe.go b/src/pipe.go
new file mode 100644
index 0000000000000000000000000000000000000000..265557ca7a5e7547ca2202362b6b19256a53c05f247584361c71c5825345f1a0
--- /dev/null
+++ b/src/pipe.go
@@ -0,0 +1,72 @@
+/*
+NNCP -- Node to Node copy, utilities for store-and-forward data exchange
+Copyright (C) 2016-2019 Sergey Matveev
+
+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 .
+*/
+
+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
+}
diff --git a/supplementary_files.sh b/supplementary_files.sh
deleted file mode 100755
index 74b1571a502a1762fce90941b122723ef8be4ef183e7b6b27c6ccc65c8c5a916..0000000000000000000000000000000000000000
--- a/supplementary_files.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh
-
-texi=`mktemp`
-
-cat > $texi < $texi < $texi < $texi <