/*
NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2022 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
"path/filepath"
"github.com/dustin/go-humanize"
- "go.cypherpunks.ru/nncp/v7"
+ "go.cypherpunks.ru/nncp/v8"
)
func usage() {
continue
}
pktEnc, pktEncRaw, err := ctx.HdrRead(fd)
- if err != nil {
+ if err == nil {
switch pktEnc.Magic {
case nncp.MagicNNCPEv1.B:
err = nncp.MagicNNCPEv1.TooOld()
case nncp.MagicNNCPEv4.B:
err = nncp.MagicNNCPEv4.TooOld()
case nncp.MagicNNCPEv5.B:
+ err = nncp.MagicNNCPEv5.TooOld()
+ case nncp.MagicNNCPEv6.B:
default:
err = errors.New("is not an encrypted packet")
}
})
continue
}
- if _, err = os.Stat(filepath.Join(dstPath, pktName+nncp.SeenSuffix)); err == nil || !os.IsNotExist(err) {
+ if _, err = os.Stat(filepath.Join(
+ dstPath, nncp.SeenDir, pktName,
+ )); err == nil || !os.IsNotExist(err) {
ctx.LogD("xfer-tx-seen", les, func(les nncp.LEs) string {
return logMsg(les) + ": already seen"
})
})
isBad = true
} else if ctx.HdrUsage {
- os.Remove(job.Path + nncp.HdrSuffix)
+ os.Remove(nncp.JobPath2Hdr(job.Path))
}
}
}