/*
NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2020 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2021 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
"strings"
"time"
- "go.cypherpunks.ru/nncp/v5"
+ "go.cypherpunks.ru/nncp/v6"
)
func usage() {
rxOnly = flag.Bool("rx", false, "Only receive packets")
txOnly = flag.Bool("tx", false, "Only transmit packets")
listOnly = flag.Bool("list", false, "Only list remote packets")
+ noCK = flag.Bool("nock", false, "Do no checksum checking")
onlyPktsRaw = flag.String("pkts", "", "Recieve only that packets, comma separated")
rxRate = flag.Int("rxrate", 0, "Maximal receive rate, pkts/sec")
txRate = flag.Int("txrate", 0, "Maximal transmit rate, pkts/sec")
onlineDeadlineSec = flag.Uint("onlinedeadline", 0, "Override onlinedeadline option")
maxOnlineTimeSec = flag.Uint("maxonlinetime", 0, "Override maxonlinetime option")
+
+ autoToss = flag.Bool("autotoss", false, "Toss after call is finished")
+ autoTossDoSeen = flag.Bool("autotoss-seen", false, "Create .seen files during tossing")
+ autoTossNoFile = flag.Bool("autotoss-nofile", false, "Do not process \"file\" packets during tossing")
+ autoTossNoFreq = flag.Bool("autotoss-nofreq", false, "Do not process \"freq\" packets during tossing")
+ autoTossNoExec = flag.Bool("autotoss-noexec", false, "Do not process \"exec\" packets during tossing")
+ autoTossNoTrns = flag.Bool("autotoss-notrns", false, "Do not process \"trns\" packets during tossing")
)
flag.Usage = usage
flag.Parse()
}
ctx.Umask()
- if !ctx.CallNode(
+
+ var autoTossFinish chan struct{}
+ var autoTossBadCode chan bool
+ if *autoToss {
+ autoTossFinish, autoTossBadCode = ctx.AutoToss(
+ node.Id,
+ nice,
+ *autoTossDoSeen,
+ *autoTossNoFile,
+ *autoTossNoFreq,
+ *autoTossNoExec,
+ *autoTossNoTrns,
+ )
+ }
+
+ badCode := !ctx.CallNode(
node,
addrs,
nice,
onlineDeadline,
maxOnlineTime,
*listOnly,
+ *noCK,
onlyPkts,
- ) {
+ )
+
+ if *autoToss {
+ close(autoTossFinish)
+ badCode = (<-autoTossBadCode) || badCode
+ }
+ if badCode {
os.Exit(1)
}
}