X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-pkt%2Fmain.go;h=94c4d61be228b2be95cc1a2c114ecf80f7bbe4bd;hb=0fad171c0d79ad583c0faf5427e22d1d62a0a52d;hp=3f42cd260e48a25c2f404b94ea769243f4be68db;hpb=271870ad4f56253e0918f673b90615e4749cf201;p=nncp.git diff --git a/src/cmd/nncp-pkt/main.go b/src/cmd/nncp-pkt/main.go index 3f42cd2..94c4d61 100644 --- a/src/cmd/nncp-pkt/main.go +++ b/src/cmd/nncp-pkt/main.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2020 Sergey Matveev +Copyright (C) 2016-2021 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 @@ -29,7 +29,7 @@ import ( xdr "github.com/davecgh/go-xdr/xdr2" "github.com/klauspost/compress/zstd" - "go.cypherpunks.ru/nncp/v5" + "go.cypherpunks.ru/nncp/v7" ) func usage() { @@ -49,6 +49,7 @@ func main() { version = flag.Bool("version", false, "Print version information") warranty = flag.Bool("warranty", false, "Print warranty information") ) + log.SetFlags(log.Lshortfile) flag.Usage = usage flag.Parse() if *warranty { @@ -105,12 +106,14 @@ func main() { payloadType = "file request" case nncp.PktTypeExec: payloadType = "exec" + case nncp.PktTypeExecFat: + payloadType = "exec uncompressed" case nncp.PktTypeTrns: payloadType = "transitional" } var path string switch pkt.Type { - case nncp.PktTypeExec: + case nncp.PktTypeExec, nncp.PktTypeExecFat: path = string(bytes.Replace( pkt.Path[:pkt.PathLen], []byte{0}, @@ -118,7 +121,7 @@ func main() { -1, )) case nncp.PktTypeTrns: - path = nncp.ToBase32(pkt.Path[:pkt.PathLen]) + path = nncp.Base32Codec.EncodeToString(pkt.Path[:pkt.PathLen]) default: path = string(pkt.Path[:pkt.PathLen]) } @@ -130,7 +133,7 @@ func main() { } var pktEnc nncp.PktEnc _, err = xdr.Unmarshal(bytes.NewReader(beginning), &pktEnc) - if err == nil && pktEnc.Magic == nncp.MagicNNCPEv4 { + if err == nil && pktEnc.Magic == nncp.MagicNNCPEv5 { if *dump { ctx, err := nncp.CtxFromCmdline(*cfgPath, "", "", false, false, false, false) if err != nil {