VERSION | 2 +- common.mk | 6 +++++- doc/cmds.texi | 11 +++++++++++ doc/download.texi | 4 ++++ doc/news.texi | 7 +++++++ ports/nncp/Makefile | 3 ++- src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/VERSION b/VERSION index b287f61f2187bdb29def32040afe740fa61c36f1ce343b22c840f76bfa835d77..3de37169f6c8e4050f9dd746f327e07d86078365055b53f2bbdbcf96c0202654 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5 +0.6 diff --git a/common.mk b/common.mk index 6285890ff283a51d88a9b78ca12009f4e08a85d7e16c2067baaee88f94b05915..8b97a633c3f2b7ad83c7375ba245440f475206d37c02e0b78f04ce95d032304c 100644 --- a/common.mk +++ b/common.mk @@ -17,7 +17,6 @@ -X cypherpunks.ru/nncp.DefaultSpoolPath=$(SPOOLPATH) \ -X cypherpunks.ru/nncp.DefaultLogPath=$(LOGPATH) ALL = \ - nncp-mail \ nncp-call \ nncp-caller \ nncp-check \ @@ -25,9 +24,11 @@ nncp-daemon \ nncp-file \ nncp-freq \ nncp-log \ + nncp-mail \ nncp-mincfg \ nncp-newcfg \ nncp-pkt \ + nncp-rm \ nncp-stat \ nncp-toss \ nncp-xfer @@ -66,6 +67,9 @@ GOPATH=$(GOPATH) go build -ldflags "$(LDFLAGS)" cypherpunks.ru/nncp/cmd/nncp-newcfg nncp-pkt: GOPATH=$(GOPATH) go build -ldflags "$(LDFLAGS)" cypherpunks.ru/nncp/cmd/nncp-pkt + +nncp-rm: + GOPATH=$(GOPATH) go build -ldflags "$(LDFLAGS)" cypherpunks.ru/nncp/cmd/nncp-rm nncp-stat: GOPATH=$(GOPATH) go build -ldflags "$(LDFLAGS)" cypherpunks.ru/nncp/cmd/nncp-stat diff --git a/doc/cmds.texi b/doc/cmds.texi index 17272e5a282816f8c54ee87922b81dbbac91e6511267ecd694e752d7334d44bf..ca75fe63cf2272a412767eeec262858d7776b61bfbe75376c0d68a4401bb178a 100644 --- a/doc/cmds.texi +++ b/doc/cmds.texi @@ -289,3 +289,14 @@ @file{DIR} directory has the following structure: @file{RECIPIENT/SENDER/PACKET}, where @file{RECIPIENT} is Base32 encoded destination node, @file{SENDER} is Base32 encoded sender node. + +@node nncp-rm +@section nncp-rm + +@verbatim +% nncp-rm [options] NODE PKT +@end verbatim + +Remove specified packet (Base32 name) in @option{NODE}'s queues. This +command is useful when you want to remove the packet that is failing to +be processed. diff --git a/doc/download.texi b/doc/download.texi index e9f4708d386153a1173404d9d959173af80f201049f2479c97bcf63e6005e736..dfebc2f385c95cb1ddc7d43b11845f456bae83aa66dbddcad882ebbc1498cc11 100644 --- a/doc/download.texi +++ b/doc/download.texi @@ -23,6 +23,10 @@ @multitable {XXXXX} {XXXX KiB} {link sign} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} @headitem Version @tab Size @tab Tarball @tab SHA256 checksum +@item @ref{Release 0.5, 0.5} @tab 743 KiB +@tab @url{download/nncp-0.5.tar.xz, link} @url{download/nncp-0.5.tar.xz.sig, sign} +@tab @code{D98F9149 5A6D6726 4C659640 1AD7F400 271A58CE 5D8D4AC5 5D1CF934 59BEDFA6} + @item @ref{Release 0.4, 0.4} @tab 741 KiB @tab @url{download/nncp-0.4.tar.xz, link} @url{download/nncp-0.4.tar.xz.sig, sign} @tab @code{93577327 B3DEBFE3 A80BEB0D 8325B2E6 0939EC55 4DBB05F3 4CA34B99 229C3722} diff --git a/doc/news.texi b/doc/news.texi index b9260b642d9d74007ae9bbaa01a9b9c896f0e5d6a05732bea7084b8b6ce92eb3..1679b58c445b4fe3885e611885c55ae385a5c1da79e90068735168424cdf3c59 100644 --- a/doc/news.texi +++ b/doc/news.texi @@ -1,6 +1,13 @@ @node News @unnumbered News +@node Release 0.6 +@section Release 0.6 +@itemize +@item Small @command{nncp-rm} command appeared. +@item Cryptographic libraries (dependecies) are updated. +@end itemize + @node Release 0.5 @section Release 0.5 @itemize diff --git a/ports/nncp/Makefile b/ports/nncp/Makefile index 5b172196be9b0f35a7a003a6e56ca9a2ed09c847b321f5d8bbe865dcbaa044c4..ddc2770e6d51f8fc2e858f7d0aae820e0cf5319a80354ee92662ac59bd3e9e4f 100644 --- a/ports/nncp/Makefile +++ b/ports/nncp/Makefile @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= nncp -PORTVERSION= 0.5 +PORTVERSION= 0.6 CATEGORIES= net MASTER_SITES= http://www.nncpgo.org/download/ \ http://sourceforge.net/projects/nncp/files/ @@ -37,6 +37,7 @@ bin/nncp-mail \ bin/nncp-mincfg \ bin/nncp-newcfg \ bin/nncp-pkt \ + bin/nncp-rm \ bin/nncp-stat \ bin/nncp-toss \ bin/nncp-xfer \ diff --git a/src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go b/src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go new file mode 100644 index 0000000000000000000000000000000000000000..b934a404ccea32e37341de07103b601b4cfc2c3812211d330df4a775377f856f --- /dev/null +++ b/src/cypherpunks.ru/nncp/cmd/nncp-rm/main.go @@ -0,0 +1,96 @@ +/* +NNCP -- Node to Node copy, utilities for store-and-forward data exchange +Copyright (C) 2016-2017 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 . +*/ + +// Remove packet from the queue +package main + +import ( + "flag" + "fmt" + "io/ioutil" + "log" + "os" + "path/filepath" + + "cypherpunks.ru/nncp" +) + +func usage() { + fmt.Fprintf(os.Stderr, nncp.UsageHeader()) + fmt.Fprintln(os.Stderr, "nncp-rm -- remove packet\n") + fmt.Fprintf(os.Stderr, "Usage: %s [options] NODE PKT\nOptions:\n", os.Args[0]) + flag.PrintDefaults() +} + +func main() { + var ( + cfgPath = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file") + 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() + if *warranty { + fmt.Println(nncp.Warranty) + return + } + if *version { + fmt.Println(nncp.VersionGet()) + return + } + if flag.NArg() != 2 { + usage() + os.Exit(1) + } + + cfgRaw, err := ioutil.ReadFile(nncp.CfgPathFromEnv(cfgPath)) + if err != nil { + log.Fatalln("Can not read config:", err) + } + ctx, err := nncp.CfgParse(cfgRaw) + if err != nil { + log.Fatalln("Can not parse config:", err) + } + ctx.Quiet = *quiet + ctx.Debug = *debug + + node, err := ctx.FindNode(flag.Arg(0)) + if err != nil { + log.Fatalln("Invalid NODE specified:", err) + } + + pktName := flag.Arg(1) + remove := func(xx nncp.TRxTx) bool { + for job := range ctx.Jobs(node.Id, xx) { + job.Fd.Close() + if filepath.Base(job.Fd.Name()) == pktName { + if err = os.Remove(job.Fd.Name()); err != nil { + log.Fatalln("Can not remove packet:", err) + } + return true + } + } + return false + } + + if !(remove(nncp.TRx) || remove(nncp.TTx)) { + log.Fatalln("Have not found specified packet") + } +}