]> Cypherpunks.ru repositories - nncp.git/commitdiff
Ability to disable relaying with -via - option
authorSergey Matveev <stargrave@stargrave.org>
Sun, 27 May 2018 11:21:32 +0000 (14:21 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 27 May 2018 11:24:45 +0000 (14:24 +0300)
VERSION
doc/cmds.texi
doc/integrity.texi
doc/news.ru.texi
doc/news.texi
doc/platforms.texi
ports/nncp/Makefile
src/cypherpunks.ru/nncp/cmd/nncp-exec/main.go
src/cypherpunks.ru/nncp/cmd/nncp-file/main.go
src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go
src/cypherpunks.ru/nncp/via.go [new file with mode: 0644]

diff --git a/VERSION b/VERSION
index 9f55b2ccb5f234fc6b87ada62389a3d73815d0d1..8c50098d8aed57b02fd10f40a670a7c673b7c5a5 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.0
+3.1
index e7090afff73fe4d0d7be71d68bd4937d9602872d..7d05bf2363ef8b8296f50aca81bcbaa3372a4c17 100644 (file)
@@ -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.
index 174c27c6c458534a812cfbd44ced148b6d63f49e..67edc7240558ce8b92fe475e2af418ebd8f6fab5 100644 (file)
@@ -33,5 +33,5 @@ uid   NNCP releases <releases at nncpgo dot org>
 
 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
index ea8606a2476bd1f3cb445491232b77cb6272546d..5061c81da743dbe38045814bc0f3bf0e5ad9587d 100644 (file)
@@ -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
index 4d9e7dccdd8a07fed6a787cb9e1c4f2a518c5130..f3116d89c653c127b19b4317be2f434d5f1f838d 100644 (file)
@@ -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
index 02e77a7b3ee98e60229ba8ae18e296b7a21ea917..a162de26c450af842b1e7137d66333330ea9927e 100644 (file)
@@ -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
index ce2e217be19c9f5c5fd69006534f3040e65927e6..971db0b504cfaf24db7d55aba98677ec3d07dac1 100644 (file)
@@ -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/
 
index 8e7aec62682a1e3002d2557145ee33144273b044..3a5328dc009a1e46c1e277696257771fc461a203 100644 (file)
@@ -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 {
index 43259146071cd558e3e4e99df367e65ec751354a..e19eb9365463a52634e51231e1f734c8c925e71d 100644 (file)
@@ -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 {
index cab8a8d2d53e67aec22ad5cd403e6d404acdb38b..1c8e248cb60ce27a1f2c7e0be57566ad778a3b4d 100644 (file)
@@ -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 (file)
index 0000000..f6f3e98
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+NNCP -- Node to Node copy, utilities for store-and-forward data exchange
+Copyright (C) 2016-2018 Sergey Matveev <stargrave@stargrave.org>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+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
+}