X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-cfgnew%2Fmain.go;h=8e0fa9f819c48e2e4ad1801e6a106229c73a1f4a;hb=857b50285a0b75f03c2f2bfa5daa39901cfdf320;hp=30bdaa9077270f686ae0957b4e360424d0808542;hpb=22a3ed111c98f81f884df47bf1040a76c36e84ab;p=nncp.git diff --git a/src/cmd/nncp-cfgnew/main.go b/src/cmd/nncp-cfgnew/main.go index 30bdaa9..8e0fa9f 100644 --- a/src/cmd/nncp-cfgnew/main.go +++ b/src/cmd/nncp-cfgnew/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 @@ -19,7 +19,9 @@ along with this program. If not, see . package main import ( + "crypto/ed25519" "crypto/rand" + "encoding/hex" "encoding/json" "flag" "fmt" @@ -30,7 +32,7 @@ import ( "golang.org/x/crypto/blake2b" "golang.org/x/crypto/nacl/box" - "go.cypherpunks.ru/nncp/v7" + "go.cypherpunks.ru/nncp/v8" ) func usage() { @@ -42,6 +44,7 @@ func usage() { func main() { var ( areaName = flag.String("area", "", "Generate area's keypairs") + yggdrasil = flag.Bool("yggdrasil", false, "Generate Yggdrasil keypair") noComments = flag.Bool("nocomments", false, "Do not include descriptive comments") version = flag.Bool("version", false, "Print version information") warranty = flag.Bool("warranty", false, "Print warranty information") @@ -57,6 +60,17 @@ func main() { fmt.Println(nncp.VersionGet()) return } + + if *yggdrasil { + pub, prv, err := ed25519.GenerateKey(rand.Reader) + if err != nil { + log.Fatalln(err) + } + fmt.Println("Public:", hex.EncodeToString(pub)) + fmt.Println("Private:", hex.EncodeToString(prv)) + return + } + if *areaName != "" { pub, prv, err := box.GenerateKey(rand.Reader) if err != nil { @@ -123,6 +137,7 @@ func main() { fmt.Println(cfgRaw) return } + nodeOur, err := nncp.NewNodeGenerate() if err != nil { log.Fatalln(err) @@ -179,14 +194,23 @@ func main() { # umask: "022" # Omit progress showing by default # noprogress: true - # Do not use .hdr files + # Do not use hdr/ files # 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: { + # myprv: 60bb...27aa + # bob-pub: 98de...ac19d + # alice-endpoint: tcp://example.com:1234?key=689c...13fb + # default-endpoints: tcp://[::1]:2345,alice-endpoint + # } # Enable notification email sending # notify: {