/*
NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2022 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
"bytes"
"encoding/json"
"errors"
+ "fmt"
"log"
"os"
"path"
Neigh map[string]NodeJSON `json:"neigh"`
Areas map[string]AreaJSON `json:"areas,omitempty"`
+
+ YggdrasilAliases map[string]string `json:"yggdrasil-aliases,omitempty"`
}
func NewNode(name string, cfg NodeJSON) (*Node, error) {
}
var freqPath *string
- freqChunked := int64(MaxFileSize)
+ var freqChunked int64
var freqMinSize int64
freqMaxSize := int64(MaxFileSize)
if cfg.Freq != nil {
copy(area.Pub[:], pub)
}
if cfg.Prv != nil {
+ if area.Pub == nil {
+ return nil, fmt.Errorf("area %s: prv requires pub presence", name)
+ }
prv, err := Base32Codec.DecodeString(*cfg.Prv)
if err != nil {
return nil, err
func CfgParse(data []byte) (*CfgJSON, error) {
var err error
if bytes.Compare(data[:8], MagicNNCPBv3.B[:]) == 0 {
- os.Stderr.WriteString("Passphrase:") // #nosec G104
+ os.Stderr.WriteString("Passphrase:")
password, err := term.ReadPassword(0)
if err != nil {
log.Fatalln(err)
}
- os.Stderr.WriteString("\n") // #nosec G104
+ os.Stderr.WriteString("\n")
data, err = DeEBlob(data, password)
if err != nil {
return nil, err
Alias: make(map[string]*NodeId),
MCDRxIfis: cfgJSON.MCDRxIfis,
MCDTxIfis: cfgJSON.MCDTxIfis,
+
+ YggdrasilAliases: cfgJSON.YggdrasilAliases,
}
if cfgJSON.Notify != nil {
if cfgJSON.Notify.File != nil {