2 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
3 Copyright (C) 2016-2017 Sergey Matveev <stargrave@stargrave.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 // Generate new NNCP node keys
32 fmt.Fprintf(os.Stderr, nncp.UsageHeader())
33 fmt.Fprintln(os.Stderr, "nncp-newnode -- generate new node keys\nOptions:")
39 version = flag.Bool("version", false, "Print version information")
40 warranty = flag.Bool("warranty", false, "Print warranty information")
45 fmt.Println(nncp.Warranty)
49 fmt.Println(nncp.VersionGet())
52 nodeOur, err := nncp.NewNodeGenerate()
56 incoming := "/path/to/upload/dir, omit it to forbid uploading"
57 freq := "/path/to/freq/able/dir, omit to forbid freqing"
59 Self: nncp.NodeOurYAML{
60 Id: nodeOur.Id.String(),
61 ExchPub: nncp.ToBase32(nodeOur.ExchPub[:]),
62 ExchPrv: nncp.ToBase32(nodeOur.ExchPrv[:]),
63 SignPub: nncp.ToBase32(nodeOur.SignPub[:]),
64 SignPrv: nncp.ToBase32(nodeOur.SignPrv[:]),
65 NoisePub: nncp.ToBase32(nodeOur.NoisePub[:]),
66 NoisePrv: nncp.ToBase32(nodeOur.NoisePrv[:]),
68 Neigh: map[string]nncp.NodeYAML{
69 "self": nncp.NodeYAML{
70 Id: nodeOur.Id.String(),
71 ExchPub: nncp.ToBase32(nodeOur.ExchPub[:]),
72 SignPub: nncp.ToBase32(nodeOur.SignPub[:]),
73 NoisePub: nncp.ToBase32(nodeOur.NoisePub[:]),
74 Sendmail: []string{nncp.DefaultSendmailPath},
77 Addrs: map[string]string{"main": "localhost:5400"},
80 Spool: "/path/to/spool",
81 Log: "/path/to/log.file",
82 Notify: &nncp.NotifyYAML{
83 File: &nncp.FromToYAML{
84 From: "nncp@localhost",
85 To: "root@localhost, delete section to disable notifies",
87 Freq: &nncp.FromToYAML{
88 From: "nncp@localhost",
89 To: "root@localhost, delete section to disable notifies",
93 raw, err := yaml.Marshal(&cfg)
97 fmt.Print(string(raw))