nohdr: true
# MultiCast Discovery
-mcd-listen: ["em0", "igb1"]
-mcd-send: {em0: 60, igb1: 5}
+mcd-listen: ["em[0-3]", "igb_.*"]
+mcd-send: {"em[0-3]": 60, igb_.*: 5}
# Yggdrasil aliases
yggdrasil-aliases: {
@table @code
@anchor{CfgMCDListen}
@item mcd-listen
-Specifies list of network interfaces @ref{nncp-caller} will listen for
-incoming @ref{MCD} announcements.
+Specifies list of network interfaces regular expression
+@ref{nncp-caller} will listen for incoming @ref{MCD} announcements.
@anchor{CfgMCDSend}
@item mcd-send
-Specifies list of network interfaces, and intervals in seconds, where
-@ref{nncp-daemon} will send @ref{MCD} announcements.
+Specifies list of network interfaces regular expressions, and intervals
+in seconds, where @ref{nncp-daemon} will send @ref{MCD} announcements.
@end table
@anchor{CfgYggdrasilAliases}
[-autotoss*]
[-nock]
[-ucspi]
+ [-mcd-wait INT]
NODE[:ADDR] [FORCEADDR]
@end example
@command{nncp-call} command under some UCSPI-TCP compatible utility,
that provides read/write channels through 6/7 file descriptors.
+@option{-mcd-wait} options tells to wait up to specified number of
+seconds for the @ref{MCD} packet from the specified @code{NODE}. When
+the packet is received, initiate a call.
+
@option{-autotoss} option runs tosser on node's spool every second
during the call. All @option{-autotoss-*} options is the same as in
@ref{nncp-toss} command.
If @file{SRC} equals to @file{-}, to data is read from @code{stdin}.
If @file{SRC} points to directory, then
-@url{https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_01, pax archive}
-will be created on the fly with directory contents and destination
-filename @file{.tar} appended. It @strong{won't} contain any entities
-metainformation, but modification time with the names. UID/GID are set
-to zero. Directories have 777 permissions, files have 666, for being
-friendly with @command{umask}. Also each entity will have comment like
-@verb{|Autogenerated by NNCP version X.Y.Z built with goXXX|}.
+@url{https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_01,
+pax archive} will be created on the fly with directory contents and
+destination filename @file{.tar} appended. It @strong{won't} contain any
+entities metainformation, except for modification time with the names.
+UID/GID are set to zero. Directories have 777 permissions, files have
+666, for being friendly with @command{umask}. Everything except
+directories and regulars files is skipped. Also each entity will have
+comment like @verb{|Autogenerated by NNCP version X.Y.Z built with goXXX|}.
+For more precise metainformation and various file objects storage use
+external @command{tar} command piped in.
If @option{-chunked} is specified, then source file will be split
@ref{Chunked, on chunks}. @option{INT} is the desired chunk size in
@url{http://lists.cypherpunks.ru/nncp_002ddevel.html, nncp-devel}
mailing list. Announcements also go to this mailing list.
+There are also community-supported @code{#nncp:matrix.org} Matrix
+channel and @code{irc://irc.oftc.net/nncp} IRC channel bridged to it.
+
Official website is @url{http://www.nncpgo.org/}.
@multitable {XXXXX} {XXXX-XX-XX} {XXXX KiB} {meta4 link sig} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
@headitem Version @tab Date @tab Size @tab Tarball @tab SHA256 checksum
+@item @ref{Release 8_3_0, 8.3.0} @tab 2022-01-23 @tab 1682 KiB
+@tab
+ @url{download/nncp-8.3.0.tar.xz.meta4, meta4}
+ @url{download/nncp-8.3.0.tar.xz, link}
+ @url{download/nncp-8.3.0.tar.xz.sig, sig}
+@tab @code{6C14887A 9EF686D6 112F2096 ED1DA56B AABE5FEB 4BA92573 89ACC6B2 6D0A23EA}
+
@item @ref{Release 8_2_0, 8.2.0} @tab 2022-01-20 @tab 1669 KiB
@tab
@url{download/nncp-8.2.0.tar.xz.meta4, meta4}
@node Новости
@section Новости
+@node Релиз 8.4.0
+@subsection Релиз 8.4.0
+@itemize
+
+@item
+Имена интерфейсов относящихся к multicast (@code{mcd-listen} и
+@code{mcd-send} опции конфигурации) теперь являются регулярными
+выражениями. По умолчанию @command{nncp-cfgnew} не комментирует
+их теперь и прописывает @code{.*} имя интерфейса.
+
+@item
+У @command{nncp-call} команды появился @option{-mcd-wait} аргумент,
+позволяющий дожидаться multicast сообщения об адресе ноды.
+
+@item
+@command{nncp-file} команда пропускает всё что не является регулярным
+файлом или директорией во время создания pax-архива.
+
+@end itemize
+
@node Релиз 8.3.0
@subsection Релиз 8.3.0
@itemize
See also this page @ref{Новости, on russian}.
+@node Release 8_4_0
+@section Release 8.4.0
+@itemize
+
+@item
+Multicast related interface names (@code{mcd-listen} and @code{mcd-send}
+configuration options) are now regular expressions. By default
+@command{nncp-cfgnew} uncomments them now with @code{.*} interface name.
+
+@item
+@command{nncp-call} command has @option{-mcd-wait} option to wait for
+multicast packet about node's address.
+
+@item
+@command{nncp-file} command skips everything that is neither regular
+file nor directory during pax-archive creation.
+
+@end itemize
+
@node Release 8_3_0
@section Release 8.3.0
@itemize
"flag"
"fmt"
"log"
+ "net"
"os"
+ "regexp"
"strings"
"time"
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")
+ mcdWait = flag.Uint("mcd-wait", 60, "Wait for MCD for specified number of seconds")
rxRate = flag.Int("rxrate", 0, "Maximal receive rate, pkts/sec")
txRate = flag.Int("txrate", 0, "Maximal transmit rate, pkts/sec")
spoolPath = flag.String("spool", "", "Override path to spool")
}
}
+ if *mcdWait > 0 {
+ 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)
+ }
+ }
+ }
+ }
+ addrs = nil
+ for i := int(*mcdWait); i > 0; i-- {
+ nncp.MCDAddrsM.RLock()
+ for _, mcdAddr := range nncp.MCDAddrs[*node.Id] {
+ addrs = append(addrs, mcdAddr.Addr.String())
+ }
+ if len(addrs) > 0 {
+ break
+ }
+ nncp.MCDAddrsM.RUnlock()
+ time.Sleep(time.Second)
+ }
+ if len(addrs) == 0 {
+ log.Fatalf("No MCD packets from the node during %d seconds", *mcdWait)
+ }
+ }
+
var onlyPkts map[[32]byte]bool
if len(*onlyPktsRaw) > 0 {
splitted = strings.Split(*onlyPktsRaw, ",")
"flag"
"fmt"
"log"
+ "net"
"os"
+ "regexp"
"sync"
"time"
}
}
- 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)
+ }
+ }
}
}
# nohdr: true
# MultiCast Discovery:
- # List of interfaces where to listen for MCD announcements
- # mcd-listen: ["em0", "igb1"]
- # Interfaces and intervals (in seconds) where to send MCD announcements
- # mcd-send: {em0: 60, igb1: 5}
+ # List of interface regular expressions where to listen for MCD announcements
+ mcd-listen: [".*"]
+ # Interfaces regular expressions and intervals (in seconds) where to send
+ # MCD announcements
+ mcd-send: {.*: 10}
# Yggdrasil related aliases:
# yggdrasil-aliases: {
"log"
"net"
"os"
+ "regexp"
"strconv"
"strings"
"time"
close(nodeIdC)
}
+func startMCDTx(ctx *nncp.Ctx, port int, zeroInterval bool) error {
+ ifis, err := net.Interfaces()
+ if err != nil {
+ return err
+ }
+ for ifiReString, secs := range ctx.MCDTxIfis {
+ ifiRe, err := regexp.CompilePOSIX(ifiReString)
+ if err != nil {
+ return err
+ }
+ var interval time.Duration
+ if !zeroInterval {
+ interval = time.Duration(secs) * time.Second
+ }
+ for _, ifi := range ifis {
+ if ifiRe.MatchString(ifi.Name) {
+ if err = ctx.MCDTx(ifi.Name, port, interval); err != nil {
+ return err
+ }
+ }
+ }
+ }
+ return nil
+}
+
func main() {
var (
cfgPath = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
}
if *mcdOnce {
- for ifiName := range ctx.MCDTxIfis {
- if err = ctx.MCDTx(ifiName, port, 0); err != nil {
- log.Fatalln("Can not do MCD transmission:", err)
- }
+ if err = startMCDTx(ctx, port, true); err != nil {
+ log.Fatalln("Can not do MCD transmission:", err)
}
return
}
if err != nil {
log.Fatalln("Can not listen:", err)
}
-
- for ifiName, secs := range ctx.MCDTxIfis {
- if err = ctx.MCDTx(ifiName, port, time.Duration(secs)*time.Second); err != nil {
- log.Fatalln("Can not run MCD transmission:", err)
- }
+ if err = startMCDTx(ctx, port, false); err != nil {
+ log.Fatalln("Can not do MCD transmission:", err)
}
-
ln = netutil.LimitListener(ln, *maxConn)
go func() {
for {
const Base32Encoded32Len = 52
var (
- Version string = "8.3.0"
+ Version string = "8.4.0"
Base32Codec *base32.Encoding = base32.StdEncoding.WithPadding(base32.NoPadding)
)
r := <-results
if r.err != nil {
tmp.Fd.Close()
- return nil, 0, err
+ return nil, 0, r.err
}
if r.pktEncRaw != nil {
pktEncRaw = r.pktEncRaw
if err != nil {
return err
}
- if info.IsDir() {
+ if info.Mode().IsDir() {
// directory header, PAX record header+contents
srcSize += TarBlockSize + 2*TarBlockSize
dirs = append(dirs, einfo{path: path, modTime: info.ModTime()})
- } else {
+ } else if info.Mode().IsRegular() {
// file header, PAX record header+contents, file content
srcSize += TarBlockSize + 2*TarBlockSize + info.Size()
if n := info.Size() % TarBlockSize; n != 0 {