dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 355cf47b2bce38a8f67ecd8dc7472845814244fa
parent 25518df855b549ab686d8bad8a6cc600bfab1d8d
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 30 Jan 2023 21:28:57 -0800

add doc

Diffstat:
Mcmd/dkfupload/main.go | 25+++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/cmd/dkfupload/main.go b/cmd/dkfupload/main.go @@ -68,6 +68,7 @@ func main() { log.Fatalln(err.Error()) } + // Calculate sha256 of file h := sha256.New() if _, err := io.Copy(h, f); err != nil { log.Fatalln(err) @@ -77,18 +78,22 @@ func main() { fileSize := fs.Size() nbChunks := int64(math.Ceil(float64(fileSize) / float64(maxChunkSize))) - log.Printf("filedrop UUID: %s\n", filedropUUID) - log.Printf(" file: %s\n", fs.Name()) - log.Printf(" sha256: %s\n", fileSha256) - log.Printf(" file size: %s (%s)\n", humanize.Bytes(uint64(fileSize)), humanize.Comma(fileSize)) - log.Printf(" chunks size: %s (%s)\n", humanize.Bytes(uint64(maxChunkSize)), humanize.Comma(maxChunkSize)) - log.Printf(" nb chunks: %d\n", nbChunks) - log.Printf(" nb threads: %d\n", nbThreads) - if dry { - log.Printf(" dry run: %t\n", dry) + // Print out information about the file + { + log.Printf("filedrop UUID: %s\n", filedropUUID) + log.Printf(" file: %s\n", fs.Name()) + log.Printf(" sha256: %s\n", fileSha256) + log.Printf(" file size: %s (%s)\n", humanize.Bytes(uint64(fileSize)), humanize.Comma(fileSize)) + log.Printf(" chunks size: %s (%s)\n", humanize.Bytes(uint64(maxChunkSize)), humanize.Comma(maxChunkSize)) + log.Printf(" nb chunks: %d\n", nbChunks) + log.Printf(" nb threads: %d\n", nbThreads) + if dry { + log.Printf(" dry run: %t\n", dry) + } + log.Println(strings.Repeat("-", 80)) } - log.Println(strings.Repeat("-", 80)) + // Init the filedrop and send metadata about the file { client := doGetClient(isLocal) body := url.Values{}