]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cmd/nncp-bundle/main.go
Streamed NNCPE format
[nncp.git] / src / cmd / nncp-bundle / main.go
index da2aafdbc568996b243b52d419042c44dba6f411..def4f86d01250325aae5e88babd591a92a7df90b 100644 (file)
@@ -34,7 +34,7 @@ import (
 
        xdr "github.com/davecgh/go-xdr/xdr2"
        "github.com/dustin/go-humanize"
-       "go.cypherpunks.ru/nncp/v7"
+       "go.cypherpunks.ru/nncp/v8"
 )
 
 const (
@@ -187,7 +187,7 @@ func main() {
                                        if err = os.Remove(job.Path); err != nil {
                                                log.Fatalln("Error during deletion:", err)
                                        } else if ctx.HdrUsage {
-                                               os.Remove(job.Path + nncp.HdrSuffix)
+                                               os.Remove(nncp.JobPath2Hdr(job.Path))
                                        }
                                }
                                ctx.LogI(
@@ -221,7 +221,7 @@ func main() {
                                if err == io.EOF {
                                        break
                                }
-                               bufStdin.Discard(bufStdin.Buffered() - (len(nncp.NNCPBundlePrefix) - 1)) // #nosec G104
+                               bufStdin.Discard(bufStdin.Buffered() - (len(nncp.NNCPBundlePrefix) - 1))
                                continue
                        }
                        if _, err = bufStdin.Discard(prefixIdx); err != nil {
@@ -376,7 +376,7 @@ func main() {
                                        if !*dryRun {
                                                os.Remove(dstPath)
                                                if ctx.HdrUsage {
-                                                       os.Remove(dstPath + nncp.HdrSuffix)
+                                                       os.Remove(nncp.JobPath2Hdr(dstPath))
                                                }
                                        }
                                } else {
@@ -416,7 +416,9 @@ func main() {
                                })
                                continue
                        }
-                       if _, err = os.Stat(dstPath + nncp.SeenSuffix); err == nil || !os.IsNotExist(err) {
+                       if _, err = os.Stat(filepath.Join(
+                               dstDirPath, nncp.SeenDir, pktName,
+                       )); err == nil || !os.IsNotExist(err) {
                                ctx.LogD("bundle-rx-seen", les, func(les nncp.LEs) string {
                                        return logMsg(les) + ": packet already seen"
                                })