X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-cfgnew%2Fmain.go;fp=src%2Fcmd%2Fnncp-cfgnew%2Fmain.go;h=e049b444bdb87a61f9d59c0d57659a150bfee773;hb=e068d88291cd45a4d6b748e258077dd6c0ffb9c2;hp=a772069b05f0781b9f4ee0f2f56d919adf55ccf9;hpb=655146e4ee2bde72c9e8daa1361010fefe016df9;p=nncp.git diff --git a/src/cmd/nncp-cfgnew/main.go b/src/cmd/nncp-cfgnew/main.go index a772069..e049b44 100644 --- a/src/cmd/nncp-cfgnew/main.go +++ b/src/cmd/nncp-cfgnew/main.go @@ -19,7 +19,9 @@ along with this program. If not, see . package main import ( + "crypto/ed25519" "crypto/rand" + "encoding/hex" "encoding/json" "flag" "fmt" @@ -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) @@ -188,6 +203,14 @@ func main() { # Interfaces and intervals (in seconds) where to send MCD announcements # mcd-send: {em0: 60, igb1: 5} + # 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: { # file: {