From: Sergey Matveev Date: Sun, 27 May 2018 11:21:32 +0000 (+0300) Subject: Ability to disable relaying with -via - option X-Git-Tag: 3.1^2 X-Git-Url: http://www.git.cypherpunks.ru/?p=nncp.git;a=commitdiff_plain;h=2a5c56d7ba8cecf8f200255d5e5c61589c43009c Ability to disable relaying with -via - option --- diff --git a/VERSION b/VERSION index 9f55b2c..8c50098 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0 +3.1 diff --git a/doc/cmds.texi b/doc/cmds.texi index e7090af..7d05bf2 100644 --- a/doc/cmds.texi +++ b/doc/cmds.texi @@ -27,6 +27,7 @@ Nearly all commands have the following common options: @item -via Override @ref{CfgVia, via} configuration option for destination node. Specified nodes must be separated with comma: @verb{|NODE1,NODE2|}. + With @verb{|-via -|} you can disable relaying at all. @item -spool Override path to spool directory. May be specified by @env{NNCPSPOOL} environment variable. diff --git a/doc/integrity.texi b/doc/integrity.texi index 174c27c..67edc72 100644 --- a/doc/integrity.texi +++ b/doc/integrity.texi @@ -33,5 +33,5 @@ uid NNCP releases Then you could verify tarballs signature: @verbatim -% gpg --verify nncp-3.0.tar.xz.sig nncp-3.0.tar.xz +% gpg --verify nncp-3.1.tar.xz.sig nncp-3.1.tar.xz @end verbatim diff --git a/doc/news.ru.texi b/doc/news.ru.texi index ea8606a..5061c81 100644 --- a/doc/news.ru.texi +++ b/doc/news.ru.texi @@ -1,6 +1,14 @@ @node Новости @section Новости +@node Релиз 3.1 +@subsection Релиз 3.1 +@itemize +@item +Возможность отключать пересылку через промежуточные ноды используя +@verb{|-via -|} опцию командной строки. +@end itemize + @node Релиз 3.0 @subsection Релиз 3.0 @itemize diff --git a/doc/news.texi b/doc/news.texi index 4d9e7dc..f3116d8 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -3,6 +3,13 @@ See also this page @ref{Новости, on russian}. +@node Release 3.1 +@section Release 3.1 +@itemize +@item +Ability to disable relaying at all using @verb{|-via -|} command line option. +@end itemize + @node Release 3.0 @section Release 3.0 @itemize diff --git a/doc/platforms.texi b/doc/platforms.texi index 02e77a7..a162de2 100644 --- a/doc/platforms.texi +++ b/doc/platforms.texi @@ -7,12 +7,12 @@ Look @ref{Integrity, here} for finding public keys for tarball authentication. @verbatim -% wget http://www.nncpgo.org/download/nncp-3.0.tar.xz -% wget http://www.nncpgo.org/download/nncp-3.0.tar.xz.sig -% gpg --verify nncp-3.0.tar.xz.sig nncp-3.0.tar.xz -% xz -d nncp-3.0.tar.xz -% tar xf nncp-3.0.tar -% make -C nncp-3.0 all +% 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 @@ -33,19 +33,19 @@ Look @ref{Integrity, here} for finding public keys for tarball authentication. follow @ref{General, general} installation instructions @verbatim -# make -C nncp-3.0 install PREFIX=/usr +# 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.0.tar.xz -% wget http://www.nncpgo.org/download/nncp-3.0.tar.xz.sig -% gpg --verify nncp-3.0.tar.xz.sig nncp-3.0.tar.xz -% tar xf nncp-3.0.tar.xz -% PATH=/usr/lib/go-1.6/bin:$PATH make -C nncp-3.0 all -# make -C nncp-3.0 install PREFIX=/usr +% 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/ports/nncp/Makefile b/ports/nncp/Makefile index ce2e217..971db0b 100644 --- a/ports/nncp/Makefile +++ b/ports/nncp/Makefile @@ -1,7 +1,7 @@ # $FreeBSD: head/net/nncp/Makefile 460314 2018-01-29 16:17:45Z yuri $ PORTNAME= nncp -DISTVERSION= 3.0 +DISTVERSION= 3.1 CATEGORIES= net MASTER_SITES= http://www.nncpgo.org/download/ diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go index 8e7aec6..3a5328d 100644 --- a/src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go +++ b/src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go @@ -26,7 +26,6 @@ import ( "io/ioutil" "log" "os" - "strings" "cypherpunks.ru/nncp" ) @@ -88,17 +87,7 @@ func main() { log.Fatalln("Invalid NODE specified:", err) } - if *viaOverride != "" { - vias := make([]*nncp.NodeId, 0, strings.Count(*viaOverride, ",")+1) - for _, via := range strings.Split(*viaOverride, ",") { - foundNodeId, err := ctx.FindNode(via) - if err != nil { - log.Fatalln("Invalid Via node specified:", err) - } - vias = append(vias, foundNodeId.Id) - } - node.Via = vias - } + nncp.ViaOverride(*viaOverride, ctx, node) body, err := ioutil.ReadAll(bufio.NewReader(os.Stdin)) if err != nil { diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-file/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-file/main.go index 4325914..e19eb93 100644 --- a/src/cypherpunks.ru/nncp/cmd/nncp-file/main.go +++ b/src/cypherpunks.ru/nncp/cmd/nncp-file/main.go @@ -93,17 +93,7 @@ func main() { log.Fatalln("Invalid NODE specified:", err) } - if *viaOverride != "" { - vias := make([]*nncp.NodeId, 0, strings.Count(*viaOverride, ",")+1) - for _, via := range strings.Split(*viaOverride, ",") { - foundNodeId, err := ctx.FindNode(via) - if err != nil { - log.Fatalln("Invalid Via node specified:", err) - } - vias = append(vias, foundNodeId.Id) - } - node.Via = vias - } + nncp.ViaOverride(*viaOverride, ctx, node) var minSize int64 if *argMinSize < 0 { diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go index cab8a8d..1c8e248 100644 --- a/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go +++ b/src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go @@ -92,17 +92,7 @@ func main() { log.Fatalln("Invalid NODE specified:", err) } - if *viaOverride != "" { - vias := make([]*nncp.NodeId, 0, strings.Count(*viaOverride, ",")+1) - for _, via := range strings.Split(*viaOverride, ",") { - foundNodeId, err := ctx.FindNode(via) - if err != nil { - log.Fatalln("Invalid Via node specified:", err) - } - vias = append(vias, foundNodeId.Id) - } - node.Via = vias - } + nncp.ViaOverride(*viaOverride, ctx, node) var dst string if flag.NArg() == 2 { diff --git a/src/cypherpunks.ru/nncp/via.go b/src/cypherpunks.ru/nncp/via.go new file mode 100644 index 0000000..f6f3e98 --- /dev/null +++ b/src/cypherpunks.ru/nncp/via.go @@ -0,0 +1,44 @@ +/* +NNCP -- Node to Node copy, utilities for store-and-forward data exchange +Copyright (C) 2016-2018 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 . +*/ + +package nncp + +import ( + "log" + "strings" +) + +// Helper function for parsing -via command line option +func ViaOverride(argValue string, ctx *Ctx, node *Node) { + if argValue == "" { + return + } + if argValue == "-" { + node.Via = make([]*NodeId, 0) + return + } + vias := make([]*NodeId, 0, strings.Count(argValue, ",")+1) + for _, via := range strings.Split(argValue, ",") { + foundNodeId, err := ctx.FindNode(via) + if err != nil { + log.Fatalln("Invalid Via node specified:", err) + } + vias = append(vias, foundNodeId.Id) + } + node.Via = vias +}