X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-caller%2Fmain.go;h=50d9bf4fc8b85aa8737cc48f2fd428b53bffa89d;hb=2e59e1d8da61bc5dee797d351e50e8ed114aa4c7;hp=4024b5be4e07afe34c6f31adcf228492ed1b28ba;hpb=0639e0c1eb295d1a8e2be31c906ee22394a51d20;p=nncp.git diff --git a/src/cmd/nncp-caller/main.go b/src/cmd/nncp-caller/main.go index 4024b5b..50d9bf4 100644 --- a/src/cmd/nncp-caller/main.go +++ b/src/cmd/nncp-caller/main.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2021 Sergey Matveev +Copyright (C) 2016-2022 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 @@ -23,11 +23,13 @@ import ( "flag" "fmt" "log" + "net" "os" + "regexp" "sync" "time" - "go.cypherpunks.ru/nncp/v7" + "go.cypherpunks.ru/nncp/v8" ) func usage() { @@ -57,6 +59,7 @@ func main() { 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") autoTossNoArea = flag.Bool("autotoss-noarea", false, "Do not process \"area\" packets during tossing") + autoTossNoACK = flag.Bool("autotoss-noack", false, "Do not process \"ack\" packets during tossing") ) log.SetFlags(log.Lshortfile) flag.Usage = usage @@ -125,9 +128,21 @@ func main() { } } - for _, ifiName := range ctx.MCDRxIfis { - if err = ctx.MCDRx(ifiName); err != nil { - log.Printf("Can not run MCD reception on %s: %s", ifiName, err) + ifis, err := net.Interfaces() + if err != nil { + log.Fatalln("Can not get network interfaces list:", err) + } + for _, ifiReString := range ctx.MCDRxIfis { + ifiRe, err := regexp.CompilePOSIX(ifiReString) + if err != nil { + log.Fatalf("Can not compile POSIX regexp \"%s\": %s", ifiReString, err) + } + for _, ifi := range ifis { + if ifiRe.MatchString(ifi.Name) { + if err = ctx.MCDRx(ifi.Name); err != nil { + log.Printf("Can not run MCD reception on %s: %s", ifi.Name, err) + } + } } } @@ -205,6 +220,7 @@ func main() { call.AutoTossNoExec || *autoTossNoExec, call.AutoTossNoTrns || *autoTossNoTrns, call.AutoTossNoArea || *autoTossNoArea, + call.AutoTossNoACK || *autoTossNoACK, ) }