]> Cypherpunks.ru repositories - nncp.git/commitdiff
Ability to override Via configuration option
authorSergey Matveev <stargrave@stargrave.org>
Wed, 14 Feb 2018 19:32:56 +0000 (22:32 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 15 Feb 2018 09:13:22 +0000 (12:13 +0300)
VERSION
doc/cfg.texi
doc/cmds.texi
doc/news.ru.texi
doc/news.texi
src/cypherpunks.ru/nncp/cmd/nncp-file/main.go
src/cypherpunks.ru/nncp/cmd/nncp-freq/main.go
src/cypherpunks.ru/nncp/cmd/nncp-mail/main.go

diff --git a/VERSION b/VERSION
index cd5ac039d67e0bdadb17976e4ac39f0ffe6bb6e4..879b416e609a820dafeff67d679a7e3849fe8a09 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.0
+2.1
index 0420d3959fec7352b25e7695cd1159fec9d3f12a..f898493feb5cc847cdf9121d9a38394aab1bf05b 100644 (file)
@@ -111,6 +111,7 @@ freqing. This is the desired chunk size in KiBs.
 If set, then apply @ref{OptMinSize, -minsize} option during file
 transmission.
 
+@anchor{CfgVia}
 @item via
 An array of node identifiers that will be used as a relay to that node.
 For example @verb{|[foo,bar]|} means that packet can reach current node
index 9868443f47a1c46f55717f8fb5a4f9b3cedac4fb..2b1d37f851f0b1c19ac8e97b51d2a044c7d737f3 100644 (file)
@@ -20,6 +20,9 @@ Nearly all commands have the following common options:
     1-255 values are allowed.
 @item -node
     Process only single specified node.
+@item -via
+    Override @ref{CfgVia, via} configuration option for destination node.
+    Specified nodes must be separated with comma: @verb{|NODE1,NODE2|}.
 @item -spool
     Override path to spool directory. May be specified by
     @env{NNCPSPOOL} environment variable.
index 3325a196eaf6ea4e05d4eeb145e061dd85ac16d6..ec168faf3c5374c161166e12399acc262ea1dbda 100644 (file)
@@ -1,6 +1,15 @@
 @node Новости
 @section Новости
 
+@node Релиз 2.1
+@subsection Релиз 2.1
+@itemize
+@item
+Возможность переопределить @option{via} опцию конфигурации для целевого
+узла через @option{-via} опцию командной строки для следующих команд:
+@command{nncp-file}, @command{nncp-freq}, @command{nncp-mail}.
+@end itemize
+
 @node Релиз 2.0
 @subsection Релиз 2.0
 @itemize
index 23112e29c27719d3245821a398699b6b91179d63..d2dbd6148436c8e12be1b433340932097d9563e0 100644 (file)
@@ -3,6 +3,15 @@
 
 See also this page @ref{Новости, on russian}.
 
+@node Release 2.1
+@section Release 2.1
+@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-mail}.
+@end itemize
+
 @node Release 2.0
 @section Release 2.0
 @itemize
index 0e34060aad31747db35228c9cd306313c2a036cb..b51dc6b0c012d7e156b5e2866e3dbadbca776bb8 100644 (file)
@@ -41,16 +41,17 @@ If SRC equals to -, then read data from stdin to temporary file.
 
 func main() {
        var (
-               cfgPath   = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
-               niceRaw   = flag.Int("nice", nncp.DefaultNiceFile, "Outbound packet niceness")
-               minSize   = flag.Uint64("minsize", 0, "Minimal required resulting packet size, in KiB")
-               chunkSize = flag.Uint64("chunked", 0, "Split file on specified size chunks, in KiB")
-               spoolPath = flag.String("spool", "", "Override path to spool")
-               logPath   = flag.String("log", "", "Override path to logfile")
-               quiet     = flag.Bool("quiet", false, "Print only errors")
-               debug     = flag.Bool("debug", false, "Print debug messages")
-               version   = flag.Bool("version", false, "Print version information")
-               warranty  = flag.Bool("warranty", false, "Print warranty information")
+               cfgPath     = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
+               niceRaw     = flag.Int("nice", nncp.DefaultNiceFile, "Outbound packet niceness")
+               minSize     = flag.Uint64("minsize", 0, "Minimal required resulting packet size, in KiB")
+               chunkSize   = flag.Uint64("chunked", 0, "Split file on specified size chunks, in KiB")
+               viaOverride = flag.String("via", "", "Override Via path to destination node")
+               spoolPath   = flag.String("spool", "", "Override path to spool")
+               logPath     = flag.String("log", "", "Override path to logfile")
+               quiet       = flag.Bool("quiet", false, "Print only errors")
+               debug       = flag.Bool("debug", false, "Print debug messages")
+               version     = flag.Bool("version", false, "Print version information")
+               warranty    = flag.Bool("warranty", false, "Print warranty information")
        )
        flag.Usage = usage
        flag.Parse()
@@ -89,6 +90,18 @@ 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
+       }
+
        if *chunkSize == 0 {
                err = ctx.TxFile(
                        node,
index 610853a3710627d0f328e5c332ea6666ae3a2fb9..18d93b64be32a83fedcce40aece9bf97b64e61b1 100644 (file)
@@ -39,15 +39,16 @@ func usage() {
 
 func main() {
        var (
-               cfgPath   = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
-               niceRaw   = flag.Int("nice", nncp.DefaultNiceFreq, "Outbound packet niceness")
-               minSize   = flag.Uint64("minsize", 0, "Minimal required resulting packet size, in KiB")
-               spoolPath = flag.String("spool", "", "Override path to spool")
-               logPath   = flag.String("log", "", "Override path to logfile")
-               quiet     = flag.Bool("quiet", false, "Print only errors")
-               debug     = flag.Bool("debug", false, "Print debug messages")
-               version   = flag.Bool("version", false, "Print version information")
-               warranty  = flag.Bool("warranty", false, "Print warranty information")
+               cfgPath     = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
+               niceRaw     = flag.Int("nice", nncp.DefaultNiceFreq, "Outbound packet niceness")
+               minSize     = flag.Uint64("minsize", 0, "Minimal required resulting packet size, in KiB")
+               viaOverride = flag.String("via", "", "Override Via path to destination node")
+               spoolPath   = flag.String("spool", "", "Override path to spool")
+               logPath     = flag.String("log", "", "Override path to logfile")
+               quiet       = flag.Bool("quiet", false, "Print only errors")
+               debug       = flag.Bool("debug", false, "Print debug messages")
+               version     = flag.Bool("version", false, "Print version information")
+               warranty    = flag.Bool("warranty", false, "Print warranty information")
        )
        flag.Usage = usage
        flag.Parse()
@@ -86,6 +87,18 @@ 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
+       }
+
        var dst string
        if flag.NArg() == 2 {
                dst = flag.Arg(1)
index 235ba971b58b1969c782d7aaa074efa5a94c51b4..4e3cc88bcb40a80a70021762dcac059d23b80263 100644 (file)
@@ -40,15 +40,16 @@ func usage() {
 
 func main() {
        var (
-               cfgPath   = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
-               niceRaw   = flag.Int("nice", nncp.DefaultNiceMail, "Outbound packet niceness")
-               minSize   = flag.Uint64("minsize", 0, "Minimal required resulting packet size, in KiB")
-               spoolPath = flag.String("spool", "", "Override path to spool")
-               logPath   = flag.String("log", "", "Override path to logfile")
-               quiet     = flag.Bool("quiet", false, "Print only errors")
-               debug     = flag.Bool("debug", false, "Print debug messages")
-               version   = flag.Bool("version", false, "Print version information")
-               warranty  = flag.Bool("warranty", false, "Print warranty information")
+               cfgPath     = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
+               niceRaw     = flag.Int("nice", nncp.DefaultNiceMail, "Outbound packet niceness")
+               minSize     = flag.Uint64("minsize", 0, "Minimal required resulting packet size, in KiB")
+               viaOverride = flag.String("via", "", "Override Via path to destination node")
+               spoolPath   = flag.String("spool", "", "Override path to spool")
+               logPath     = flag.String("log", "", "Override path to logfile")
+               quiet       = flag.Bool("quiet", false, "Print only errors")
+               debug       = flag.Bool("debug", false, "Print debug messages")
+               version     = flag.Bool("version", false, "Print version information")
+               warranty    = flag.Bool("warranty", false, "Print warranty information")
        )
        flag.Usage = usage
        flag.Parse()
@@ -82,6 +83,18 @@ 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
+       }
+
        body, err := ioutil.ReadAll(bufio.NewReader(os.Stdin))
        if err != nil {
                log.Fatalln("Can not read mail body from stdin:", err)