X-Git-Url: http://www.git.cypherpunks.ru/?p=nncp.git;a=blobdiff_plain;f=src%2Fcmd%2Fnncp-caller%2Fmain.go;h=690244141eaf87e151112c3822b7c8ff9c637ff0;hp=981e42e68d204e3faadf845d25036ac32a329d55;hb=857b50285a0b75f03c2f2bfa5daa39901cfdf320;hpb=6db8b9f512c485340ab55d64e8d9e5dd2f78a21d diff --git a/src/cmd/nncp-caller/main.go b/src/cmd/nncp-caller/main.go index 981e42e..6902441 100644 --- a/src/cmd/nncp-caller/main.go +++ b/src/cmd/nncp-caller/main.go @@ -23,7 +23,9 @@ import ( "flag" "fmt" "log" + "net" "os" + "regexp" "sync" "time" @@ -125,9 +127,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) + } + } } }