cfgs.go raw
1 package podcfgs
2
3 import (
4 "math"
5 "math/rand"
6 "net"
7 "path/filepath"
8 "reflect"
9 "runtime"
10 "sync/atomic"
11 "time"
12
13 "github.com/p9c/p9/pkg/opts/binary"
14 "github.com/p9c/p9/pkg/opts/duration"
15 "github.com/p9c/p9/pkg/opts/float"
16 "github.com/p9c/p9/pkg/opts/integer"
17 "github.com/p9c/p9/pkg/opts/list"
18 "github.com/p9c/p9/pkg/opts/meta"
19 "github.com/p9c/p9/pkg/opts/opt"
20 "github.com/p9c/p9/pkg/opts/sanitizers"
21 "github.com/p9c/p9/pkg/opts/text"
22 "github.com/p9c/p9/pkg/appdata"
23 "github.com/p9c/p9/pkg/base58"
24 "github.com/p9c/p9/pkg/blockchain"
25 "github.com/p9c/p9/pkg/chaincfg"
26 "github.com/p9c/p9/pkg/constant"
27 "github.com/p9c/p9/pkg/database"
28 "github.com/p9c/p9/pkg/util/hdkeychain"
29 "github.com/p9c/p9/pod/config"
30 "github.com/p9c/p9/pod/podcmds"
31 "github.com/p9c/p9/pod/podconfig/checkpoints"
32 )
33
34 // GetDefaultConfig returns a Config struct pristine factory fresh
35 func GetDefaultConfig() (c *config.Config) {
36 T.Ln("getting default config")
37 c = &config.Config{
38 Commands: podcmds.GetCommands(),
39 Map: GetConfigs(),
40 }
41 c.RunningCommand = c.Commands[0]
42
43 t := reflect.ValueOf(c)
44 t = t.Elem()
45 for i := range c.Map {
46 tf := t.FieldByName(i)
47 if tf.IsValid() && tf.CanSet() && tf.CanAddr() {
48 val := reflect.ValueOf(c.Map[i])
49 tf.Set(val)
50 }
51 }
52 c.ForEach(func(ifc opt.Option) bool {
53
54 return true
55 })
56 return
57 }
58
59 // GetConfigs returns configuration options for ParallelCoin Pod
60 func GetConfigs() (c config.Configs) {
61 tags := func(s ...string) []string {
62 return s
63 }
64 network := "mainnet"
65 rand.Seed(time.Now().UnixNano())
66 var datadir = &atomic.Value{}
67 datadir.Store([]byte(appdata.Dir(constant.Name, false)))
68 c = config.Configs{
69 "AddCheckpoints": list.New(meta.Data{
70 Aliases: []string{"AC"},
71 Group: "debug",
72 Tags: tags("node"),
73 Label: "Add Checkpoints",
74 Description:
75 "add custom checkpoints",
76 Documentation: "<placeholder for detailed documentation>",
77 OmitEmpty: true,
78 },
79 []string{},
80 func(chkPts []string) (e error) {
81 // todo: this closure should be added by the node and assign the output to its correct location
82 var cpts []chaincfg.Checkpoint
83 cpts, e = checkpoints.Parse(chkPts)
84 _ = cpts
85 return
86 },
87 ),
88 "AddPeers": list.New(meta.Data{
89 Aliases: []string{"AP"},
90 Group: "node",
91 Tags: tags("node"),
92 Label: "Add Peers",
93 Description:
94 "manually adds addresses to try to connect to",
95 // Type: sanitizers.NetAddress,
96 Documentation: "<placeholder for detailed documentation>",
97 OmitEmpty: true,
98 },
99 []string{},
100 ),
101 "AddrIndex": binary.New(meta.Data{
102 Aliases: []string{"AI"},
103 Group: "node",
104 Tags: tags("node"),
105 Label: "Address Index",
106 Description:
107 "maintain a full address-based transaction index which makes the searchrawtransactions RPC available",
108 Documentation: "<placeholder for detailed documentation>",
109 OmitEmpty: true,
110 },
111 false,
112 ),
113 "AutoPorts": binary.New(meta.Data{
114 Group: "debug",
115 Label: "Automatic Ports",
116 Tags: tags("node", "wallet"),
117 Description:
118 "RPC and controller ports are randomized, use with controller for automatic peer discovery",
119 Documentation: "<placeholder for detailed documentation>",
120 OmitEmpty: true,
121 },
122 false,
123 ),
124 "AutoListen": binary.New(meta.Data{
125 Aliases: []string{"AL"},
126 Group: "node",
127 Tags: tags("node", "wallet"),
128 Label: "Automatic Listeners",
129 Description:
130 "automatically update inbound addresses dynamically according to discovered network interfaces",
131 Documentation: "<placeholder for detailed documentation>",
132 OmitEmpty: true,
133 },
134 false,
135 ),
136 "BanDuration": duration.New(meta.Data{
137 Aliases: []string{"BD"},
138 Group: "debug",
139 Tags: tags("node"),
140 Label: "Ban Opt",
141 Description:
142 "how long a ban of a misbehaving peer lasts",
143 Documentation: "<placeholder for detailed documentation>",
144 OmitEmpty: true,
145 },
146 time.Hour*24,
147 time.Second, time.Hour*24*365,
148 ),
149 "BanThreshold": integer.New(meta.Data{
150 Aliases: []string{"BT"},
151 Group: "debug",
152 Tags: tags("node"),
153 Label: "Ban Threshold",
154 Description:
155 "ban score that triggers a ban (default 100)",
156 Documentation: "<placeholder for detailed documentation>",
157 OmitEmpty: true,
158 },
159 constant.DefaultBanThreshold,
160 1, 10000,
161 ),
162 "BlockMaxSize": integer.New(meta.Data{
163 Aliases: []string{"BMXS"},
164 Group: "mining",
165 Tags: tags("node"),
166 Label: "Block Max Size",
167 Description:
168 "maximum block size in bytes to be used when creating a block",
169 Documentation: "<placeholder for detailed documentation>",
170 OmitEmpty: true,
171 },
172 blockchain.MaxBlockBaseSize-1000,
173 constant.BlockMaxSizeMin, constant.BlockMaxSizeMax,
174 ),
175 "BlockMaxWeight": integer.New(meta.Data{
176 Aliases: []string{"BMXW"},
177 Group: "mining",
178 Tags: tags("node"),
179 Label: "Block Max Weight",
180 Description:
181 "maximum block weight to be used when creating a block",
182 Documentation: "<placeholder for detailed documentation>",
183 OmitEmpty: true,
184 },
185 constant.BlockMaxWeightMax,
186 constant.BlockMaxWeightMin, constant.BlockMaxWeightMax,
187 ),
188 "BlockMinSize": integer.New(meta.Data{
189 Aliases: []string{"BMS"},
190 Group: "mining",
191 Tags: tags("node"),
192 Label: "Block Min Size",
193 Description:
194 "minimum block size in bytes to be used when creating a block",
195 Documentation: "<placeholder for detailed documentation>",
196 OmitEmpty: true,
197 },
198 constant.BlockMaxSizeMin,
199 constant.BlockMaxSizeMin, constant.BlockMaxSizeMax,
200 ),
201 "BlockMinWeight": integer.New(meta.Data{
202 Aliases: []string{"BMW"},
203 Group: "mining",
204 Tags: tags("node"),
205 Label: "Block Min Weight",
206 Description:
207 "minimum block weight to be used when creating a block",
208 Documentation: "<placeholder for detailed documentation>",
209 OmitEmpty: true,
210 },
211 constant.BlockMaxWeightMin,
212 constant.BlockMaxWeightMin, constant.BlockMaxWeightMax,
213 ),
214 "BlockPrioritySize": integer.New(meta.Data{
215 Aliases: []string{"BPS"},
216 Group: "mining",
217 Tags: tags("node"),
218 Label: "Block Priority Size",
219 Description:
220 "size in bytes for high-priority/low-fee transactions when creating a block",
221 Documentation: "<placeholder for detailed documentation>",
222 OmitEmpty: true,
223 },
224 constant.DefaultBlockPrioritySize,
225 constant.BlockMaxSizeMin, constant.BlockMaxSizeMax,
226 ),
227 "BlocksOnly": binary.New(meta.Data{
228 Aliases: []string{"BO"},
229 Group: "node",
230 Tags: tags("node"),
231 Label: "Blocks Only",
232 Description:
233 "do not accept transactions from remote peers",
234 Documentation: "<placeholder for detailed documentation>",
235 OmitEmpty: true,
236 },
237 false,
238 ),
239 "CAFile": text.New(meta.Data{
240 Aliases: []string{"CA"},
241 Group: "tls",
242 Tags: tags("node", "wallet"),
243 Label: "Certificate Authority File",
244 Description:
245 "certificate authority file for TLS certificate validation",
246 Type: sanitizers.FilePath,
247 Documentation: "<placeholder for detailed documentation>",
248 OmitEmpty: true,
249 },
250 filepath.Join(string(datadir.Load().([]byte)), "ca.cert"),
251 ),
252 "ConfigFile": text.New(meta.Data{
253 Aliases: []string{"CF"},
254 Label: "Configuration File",
255 Description:
256 "location of configuration file, cannot actually be changed",
257 Type: sanitizers.FilePath,
258 Documentation: "<placeholder for detailed documentation>",
259 OmitEmpty: true,
260 },
261 filepath.Join(string(datadir.Load().([]byte)), constant.PodConfigFilename),
262 ),
263 "ConnectPeers": list.New(meta.Data{
264 Aliases: []string{"CPS"},
265 Group: "node",
266 Tags: tags("node"),
267 Label: "Connect Peers",
268 Description:
269 "connect ONLY to these addresses (disables inbound connections)",
270 Type: sanitizers.NetAddress,
271 Documentation: "<placeholder for detailed documentation>",
272 OmitEmpty: true,
273 DefaultPort: constant.DefaultP2PPort,
274 },
275 []string{},
276 ),
277 "Controller": binary.New(meta.Data{
278 Aliases: []string{"CN"},
279 Group: "node",
280 Tags: tags("node"),
281 Label: "Enable Controller",
282 Description:
283 "delivers mining jobs over multicast",
284 Documentation: "<placeholder for detailed documentation>",
285 OmitEmpty: true,
286 },
287 false,
288 ),
289 "CPUProfile": text.New(meta.Data{
290 Aliases: []string{"CPR"},
291 Group: "debug",
292 Tags: tags("node", "wallet", "kopach", "worker"),
293 Label: "CPU Profile",
294 Description:
295 "write cpu profile to this file",
296 Type: sanitizers.FilePath,
297 Documentation: "<placeholder for detailed documentation>",
298 OmitEmpty: true,
299 },
300 "",
301 ),
302 "DarkTheme": binary.New(meta.Data{
303 Aliases: []string{"DT"},
304 Group: "config",
305 Tags: tags("gui"),
306 Label: "Dark Theme",
307 Description:
308 "sets dark theme for GUI",
309 Documentation: "<placeholder for detailed documentation>",
310 OmitEmpty: true,
311 },
312 false,
313 ),
314 "DataDir": text.New(meta.Data{
315 Aliases: []string{"DD"},
316 Label: "Data Directory",
317 Tags: tags("node", "wallet", "ctl", "kopach", "worker"),
318 Description:
319 "root folder where application data is stored",
320 Type: sanitizers.Directory,
321 Documentation: "<placeholder for detailed documentation>",
322 OmitEmpty: true,
323 },
324 appdata.Dir(constant.Name, false),
325 ),
326 "DbType": text.New(meta.Data{
327 Aliases: []string{"DB"},
328 Group: "debug",
329 Tags: tags("node"),
330 Label: "Database Type",
331 Description:
332 "type of database storage engine to use for node (" +
333 "only one right now, ffldb)",
334 Documentation: "<placeholder for detailed documentation>",
335 OmitEmpty: true,
336 Options: database.SupportedDrivers(),
337 },
338 constant.DefaultDbType,
339 ),
340 "DisableBanning": binary.New(meta.Data{
341 Aliases: []string{"NB"},
342 Group: "debug",
343 Tags: tags("node"),
344 Label: "Disable Banning",
345 Description:
346 "disables banning of misbehaving peers",
347 Documentation: "<placeholder for detailed documentation>",
348 OmitEmpty: true,
349 },
350 false,
351 ),
352 "DisableCheckpoints": binary.New(meta.Data{
353 Aliases: []string{"NCP"},
354 Group: "debug",
355 Tags: tags("node"),
356 Label: "Disable Checkpoints",
357 Description:
358 "disables all checkpoints",
359 Documentation: "<placeholder for detailed documentation>",
360 OmitEmpty: true,
361 },
362 false,
363 ),
364 "DisableDNSSeed": binary.New(meta.Data{
365 Aliases: []string{"NDS"},
366 Group: "node",
367 Tags: tags("node"),
368 Label: "Disable DNS Seed",
369 Description:
370 "disable seeding of addresses to peers",
371 Documentation: "<placeholder for detailed documentation>",
372 OmitEmpty: true,
373 },
374 false,
375 ),
376 "DisableListen": binary.New(meta.Data{
377 Aliases: []string{"NL"},
378 Group: "node",
379 Tags: tags("node", "wallet"),
380 Label: "Disable Listen",
381 Description:
382 "disables inbound connections for the peer to peer network",
383 Documentation: "<placeholder for detailed documentation>",
384 OmitEmpty: true,
385 },
386 false,
387 ),
388 "DisableRPC": binary.New(meta.Data{
389 Aliases: []string{"NRPC"},
390 Group: "rpc",
391 Tags: tags("node", "wallet"),
392 Label: "Disable RPC",
393 Description:
394 "disable rpc servers, as well as kopach controller",
395 Documentation: "<placeholder for detailed documentation>",
396 OmitEmpty: true,
397 },
398 false,
399 ),
400 "Discovery": binary.New(meta.Data{
401 Aliases: []string{"DI"},
402 Group: "node",
403 Tags: tags("node"),
404 Label: "Disovery",
405 Description:
406 "enable LAN peer discovery in GUI",
407 Documentation: "<placeholder for detailed documentation>",
408 OmitEmpty: true,
409 },
410 false,
411 ),
412 "ExternalIPs": list.New(meta.Data{
413 Aliases: []string{"EI"},
414 Group: "node",
415 Tags: tags("node"),
416 Label: "External IP Addresses",
417 Description:
418 "extra addresses to tell peers they can connect to",
419 Type: sanitizers.NetAddress,
420 Documentation: "<placeholder for detailed documentation>",
421 OmitEmpty: true,
422 },
423 []string{},
424 ),
425 "FreeTxRelayLimit": float.New(meta.Data{
426 Aliases: []string{"LR"},
427 Group: "policy",
428 Tags: tags("node"),
429 Label: "Free Tx Relay Limit",
430 Description:
431 "limit relay of transactions with no transaction fee to the given amount in thousands of bytes per minute",
432 Documentation: "<placeholder for detailed documentation>",
433 OmitEmpty: true,
434 },
435 constant.DefaultFreeTxRelayLimit,
436 0, math.MaxFloat64,
437 ),
438 "Generate": binary.New(meta.Data{
439 Aliases: []string{"GB"},
440 Group: "mining",
441 Tags: tags("node", "kopach"),
442 Label: "Generate Blocks",
443 Description:
444 "turn on Kopach CPU miner",
445 Documentation: "<placeholder for detailed documentation>",
446 OmitEmpty: true,
447 },
448 false,
449 ),
450 "GenThreads": integer.New(meta.Data{
451 Aliases: []string{"GT"},
452 Group: "mining",
453 Tags: tags("kopach"),
454 Label: "Generate Threads",
455 Description:
456 "number of threads to mine with",
457 Documentation: "<placeholder for detailed documentation>",
458 OmitEmpty: true,
459 },
460 -1,
461 -math.MaxInt64, runtime.NumCPU(),
462 ),
463 "Hilite": list.New(meta.Data{
464 Aliases: []string{"HL"},
465 Group: "debug",
466 Tags: tags("node", "wallet", "ctl", "kopach", "worker"),
467 Label: "Hilite",
468 Description:
469 "list of packages that will print with attention getters",
470 Type: "",
471 Documentation: "<placeholder for detailed documentation>",
472 OmitEmpty: true,
473 },
474 []string{},
475 ),
476 "LAN": binary.New(meta.Data{
477 Group: "debug",
478 Tags: tags("node"),
479 Label: "LAN Testnet Mode",
480 Description:
481 "run without any connection to nodes on the internet (does not apply on mainnet)",
482 Documentation: "<placeholder for detailed documentation>",
483 OmitEmpty: true,
484 },
485 false,
486 ),
487 "Locale": text.New(meta.Data{
488 Aliases: []string{"LC"},
489 Group: "config",
490 Tags: tags("node", "wallet", "ctl", "kopach", "worker"),
491 Label: "Language",
492 Description:
493 "user interface language i18 localization",
494 Documentation: "<placeholder for detailed documentation>",
495 OmitEmpty: true,
496 Options: []string{"en"},
497 },
498 "en",
499 ),
500 "LimitPass": text.New(meta.Data{
501 Aliases: []string{"LP"},
502 Group: "rpc",
503 Tags: tags("node", "wallet"),
504 Label: "Limit Password",
505 Description:
506 "limited user password",
507 Documentation: "<placeholder for detailed documentation>",
508 OmitEmpty: false,
509 },
510 genPassword(),
511 ),
512 "LimitUser": text.New(meta.Data{
513 Aliases: []string{"LU"},
514 Group: "rpc",
515 Tags: tags("node", "wallet"),
516 Label: "Limit Username",
517 Description:
518 "limited user name",
519 Documentation: "<placeholder for detailed documentation>",
520 OmitEmpty: false,
521 },
522 "limit",
523 ),
524 "LogDir": text.New(meta.Data{
525 Aliases: []string{"LD"},
526 Group: "config",
527 Tags: tags("node", "wallet", "ctl", "kopach", "worker"),
528 Label: "Log Directory",
529 Description:
530 "folder where log files are written",
531 Type: sanitizers.Directory,
532 Documentation: "<placeholder for detailed documentation>",
533 OmitEmpty: true,
534 },
535 string(datadir.Load().([]byte)),
536 ),
537 "LogFilter": list.New(meta.Data{
538 Aliases: []string{"LF"},
539 Group: "debug",
540 Tags: tags("node", "wallet", "ctl", "kopach", "worker"),
541 Label: "Log Filter",
542 Description:
543 "list of packages that will not print logs",
544 Type: "",
545 Documentation: "<placeholder for detailed documentation>",
546 OmitEmpty: true,
547 },
548 []string{},
549 ),
550 "LogLevel": text.New(meta.Data{
551 Aliases: []string{"LL"},
552 Group: "config",
553 Tags: tags("node", "wallet", "ctl", "kopach", "worker"),
554 Label: "Log Level",
555 Description:
556 "maximum log level to output",
557 Options: []string{
558 "off",
559 "fatal",
560 "error",
561 "info",
562 "check",
563 "debug",
564 "trace",
565 },
566 Documentation: "<placeholder for detailed documentation>",
567 OmitEmpty: true,
568 },
569 "info",
570
571 ),
572 "MaxOrphanTxs": integer.New(meta.Data{
573 Aliases: []string{"MO"},
574 Group: "policy",
575 Tags: tags("node"),
576 Label: "Max Orphan Txs",
577 Description:
578 "max number of orphan transactions to keep in memory",
579 Documentation: "<placeholder for detailed documentation>",
580 OmitEmpty: true,
581 },
582 constant.DefaultMaxOrphanTransactions,
583 0, math.MaxInt64,
584 ),
585 "MaxPeers": integer.New(meta.Data{
586 Aliases: []string{"MP"},
587 Group: "node",
588 Tags: tags("node"),
589 Label: "Max Peers",
590 Description:
591 "maximum number of peers to hold connections with",
592 Documentation: "<placeholder for detailed documentation>",
593 OmitEmpty: true,
594 },
595 constant.DefaultMaxPeers,
596 1, 256,
597 ),
598 "MulticastPass": text.New(meta.Data{
599 Aliases: []string{"PM"},
600 Group: "config",
601 Tags: tags("node", "kopach"),
602 Label: "Multicast Pass",
603 Description:
604 "password that encrypts the connection to the mining controller",
605 Type: sanitizers.Password,
606 Documentation: "<placeholder for detailed documentation>",
607 OmitEmpty: true,
608 },
609 "pa55word",
610 ),
611 "MinRelayTxFee": float.New(meta.Data{
612 Aliases: []string{"MRTF"},
613 Group: "policy",
614 Tags: tags("node"),
615 Label: "Min Relay Transaction Fee",
616 Description:
617 "the minimum transaction fee in DUO/kB to be considered a non-zero fee",
618 Documentation: "<placeholder for detailed documentation>",
619 OmitEmpty: true,
620 },
621 constant.DefaultMinRelayTxFee.ToDUO(),
622 0, math.MaxFloat64,
623
624 ),
625 "Network": text.New(meta.Data{
626 Aliases: []string{"NW"},
627 Group: "node",
628 Tags: tags("node", "wallet"),
629 Label: "Network",
630 Description:
631 "connect to this network:",
632 Options: []string{
633 "mainnet",
634 "testnet",
635 "regtestnet",
636 "simnet",
637 },
638 Documentation: "<placeholder for detailed documentation>",
639 OmitEmpty: true,
640 },
641 network,
642 ),
643 "NoCFilters": binary.New(meta.Data{
644 Aliases: []string{"NCF"},
645 Group: "node",
646 Tags: tags("node"),
647 Label: "No CFilters",
648 Description:
649 "disable committed filtering (CF) support",
650 Documentation: "<placeholder for detailed documentation>",
651 OmitEmpty: true,
652 },
653 false,
654 ),
655 "NodeOff": binary.New(meta.Data{
656 Aliases: []string{"NO"},
657 Group: "debug",
658 Tags: tags("node"),
659 Label: "Node Off",
660 Description:
661 "turn off the node backend",
662 Documentation: "<placeholder for detailed documentation>",
663 OmitEmpty: true,
664 },
665 false,
666 ),
667 "NoInitialLoad": binary.New(meta.Data{
668 Aliases: []string{"NIL"},
669 Group: "wallet",
670 Tags: tags("wallet"),
671 Label: "No Initial Load",
672 Description:
673 "do not load a wallet at startup",
674 Documentation: "<placeholder for detailed documentation>",
675 OmitEmpty: true,
676 },
677 false,
678 ),
679 "NoPeerBloomFilters": binary.New(meta.Data{
680 Aliases: []string{"NPBF"},
681 Group: "node",
682 Tags: tags("node"),
683 Label: "No Peer Bloom Filters",
684 Description:
685 "disable bloom filtering support",
686 Documentation: "<placeholder for detailed documentation>",
687 OmitEmpty: true,
688 },
689 false,
690 ),
691 "NoRelayPriority": binary.New(meta.Data{
692 Aliases: []string{"NRPR"},
693 Group: "policy",
694 Tags: tags("node"),
695 Label: "No Relay Priority",
696 Description:
697 "do not require free or low-fee transactions to have high priority for relaying",
698 Documentation: "<placeholder for detailed documentation>",
699 OmitEmpty: true,
700 },
701 false,
702 ),
703 "OneTimeTLSKey": binary.New(meta.Data{
704 Aliases: []string{"OTK"},
705 Group: "wallet",
706 Tags: tags("node", "wallet"),
707 Label: "One Time TLS Key",
708 Description:
709 "generate a new TLS certificate pair at startup, but only write the certificate to disk",
710 Documentation: "<placeholder for detailed documentation>",
711 OmitEmpty: true,
712 },
713 false,
714 ),
715 "OnionEnabled": binary.New(meta.Data{
716 Aliases: []string{"OE"},
717 Group: "proxy",
718 Tags: tags("node"),
719 Label: "Onion Enabled",
720 Description:
721 "enable tor proxy",
722 Documentation: "<placeholder for detailed documentation>",
723 OmitEmpty: true,
724 },
725 false,
726 ),
727 "OnionProxyAddress": text.New(meta.Data{
728 Aliases: []string{"OPA"},
729 Group: "proxy",
730 Tags: tags("node"),
731 Label: "Onion Proxy Address",
732 Description:
733 "address of tor proxy you want to connect to",
734 Type: sanitizers.NetAddress,
735 Documentation: "<placeholder for detailed documentation>",
736 OmitEmpty: true,
737 },
738 "",
739 ),
740 "OnionProxyPass": text.New(meta.Data{
741 Aliases: []string{"OPW"},
742 Group: "proxy",
743 Tags: tags("node"),
744 Label: "Onion Proxy Password",
745 Description:
746 "password for tor proxy",
747 Type: sanitizers.Password,
748 Documentation: "<placeholder for detailed documentation>",
749 OmitEmpty: true,
750 },
751 "",
752 ),
753 "OnionProxyUser": text.New(meta.Data{
754 Aliases: []string{"OU"},
755 Group: "proxy",
756 Tags: tags("node"),
757 Label: "Onion Proxy Username",
758 Description:
759 "tor proxy username",
760 Documentation: "<placeholder for detailed documentation>",
761 OmitEmpty: true,
762 },
763 "",
764 ),
765 "P2PConnect": list.New(meta.Data{
766 Aliases: []string{"P2P"},
767 Group: "node",
768 Tags: tags("node"),
769 Label: "P2P Connect",
770 Description:
771 "list of addresses reachable from connected networks",
772 Type: sanitizers.NetAddress,
773 Documentation: "<placeholder for detailed documentation>",
774 OmitEmpty: true,
775 },
776 []string{},
777 ),
778 "P2PListeners": list.New(meta.Data{
779 Aliases: []string{"LA"},
780 Group: "node",
781 Tags: tags("node"),
782 Label: "P2PListeners",
783 Description:
784 "list of addresses to bind the node listener to",
785 Type: sanitizers.NetAddress,
786 Documentation: "<placeholder for detailed documentation>",
787 OmitEmpty: true,
788 },
789 []string{
790 net.JoinHostPort("0.0.0.0",
791 chaincfg.MainNetParams.DefaultPort,
792 ),
793 },
794 ),
795 "Password": text.New(meta.Data{
796 Aliases: []string{"PW"},
797 Group: "rpc",
798 Tags: tags("node", "wallet"),
799 Label: "Password",
800 Description:
801 "password for client RPC connections",
802 Type: sanitizers.Password,
803 Documentation: "<placeholder for detailed documentation>",
804 OmitEmpty: false,
805 },
806 genPassword(),
807 ),
808 "PipeLog": binary.New(meta.Data{
809 Aliases: []string{"PL"},
810 Label: "Pipe Logger",
811 Tags: tags("node", "wallet", "ctl", "kopach", "worker"),
812 Description:
813 "enable pipe based logger IPC",
814 Documentation: "<placeholder for detailed documentation>",
815 OmitEmpty: true,
816 },
817 false,
818 ),
819 "Profile": text.New(meta.Data{
820 Aliases: []string{"HPR"},
821 Group: "debug",
822 Tags: tags("node", "wallet", "ctl", "kopach", "worker"),
823 Label: "Profile",
824 Description:
825 "http profiling on given port (1024-40000)",
826 // Type: "",
827 Documentation: "<placeholder for detailed documentation>",
828 OmitEmpty: true,
829 },
830 "",
831 ),
832 "ProxyAddress": text.New(meta.Data{
833 Aliases: []string{"PA"},
834 Group: "proxy",
835 Tags: tags("node"),
836 Label: "Proxy",
837 Description:
838 "address of proxy to connect to for outbound connections",
839 Type: sanitizers.NetAddress,
840 Documentation: "<placeholder for detailed documentation>",
841 OmitEmpty: true,
842 },
843 "",
844 ),
845 "ProxyPass": text.New(meta.Data{
846 Aliases: []string{"PPW"},
847 Group: "proxy",
848 Tags: tags("node"),
849 Label: "Proxy Pass",
850 Description:
851 "proxy password, if required",
852 Type: sanitizers.Password,
853 Documentation: "<placeholder for detailed documentation>",
854 OmitEmpty: false,
855 },
856 genPassword(),
857 ),
858 "ProxyUser": text.New(meta.Data{
859 Aliases: []string{"PU"},
860 Group: "proxy",
861 Tags: tags("node"),
862 Label: "ProxyUser",
863 Description:
864 "proxy username, if required",
865 Documentation: "<placeholder for detailed documentation>",
866 OmitEmpty: false,
867 },
868 "proxyuser",
869 ),
870 "RejectNonStd": binary.New(meta.Data{
871 Aliases: []string{"REJ"},
872 Group: "node",
873 Tags: tags("node"),
874 Label: "Reject Non Std",
875 Description:
876 "reject non-standard transactions regardless of the default settings for the active network",
877 Documentation: "<placeholder for detailed documentation>",
878 OmitEmpty: true,
879 },
880 false,
881 ),
882 "RelayNonStd": binary.New(meta.Data{
883 Aliases: []string{"RNS"},
884 Group: "node",
885 Tags: tags("node"),
886 Label: "Relay Nonstandard Transactions",
887 Description:
888 "relay non-standard transactions regardless of the default settings for the active network",
889 Documentation: "<placeholder for detailed documentation>",
890 OmitEmpty: true,
891 },
892 false,
893 ),
894 "RPCCert": text.New(meta.Data{
895 Aliases: []string{"RC"},
896 Group: "rpc",
897 Tags: tags("node", "wallet"),
898 Label: "RPC Cert",
899 Description:
900 "location of RPC TLS certificate",
901 Type: sanitizers.FilePath,
902 Documentation: "<placeholder for detailed documentation>",
903 OmitEmpty: true,
904 },
905 filepath.Join(string(datadir.Load().([]byte)), "rpc.cert"),
906 ),
907 "RPCConnect": text.New(meta.Data{
908 Aliases: []string{"RA"},
909 Group: "node",
910 Tags: tags("node"),
911 Label: "RPC Connect",
912 Description:
913 "full node RPC for wallet",
914 Type: sanitizers.NetAddress,
915 Documentation: "<placeholder for detailed documentation>",
916 OmitEmpty: true,
917 },
918 net.JoinHostPort("127.0.0.1", chaincfg.MainNetParams.RPCClientPort),
919 ),
920 "RPCKey": text.New(meta.Data{
921 Aliases: []string{"RK"},
922 Group: "rpc",
923 Tags: tags("node", "wallet"),
924 Label: "RPC Key",
925 Description:
926 "location of rpc TLS key",
927 Type: sanitizers.FilePath,
928 Documentation: "<placeholder for detailed documentation>",
929 OmitEmpty: true,
930 },
931 filepath.Join(string(datadir.Load().([]byte)), "rpc.key"),
932 ),
933 "RPCListeners": list.New(meta.Data{
934 Aliases: []string{"RL"},
935 Group: "rpc",
936 Tags: tags("node"),
937 Label: "Node RPC Listeners",
938 Description:
939 "addresses to listen for RPC connections",
940 Type: sanitizers.NetAddress,
941 Documentation: "<placeholder for detailed documentation>",
942 OmitEmpty: true,
943 },
944 []string{
945 net.JoinHostPort("127.0.0.1", chaincfg.MainNetParams.RPCClientPort),
946 },
947 ),
948 "RPCMaxClients": integer.New(meta.Data{
949 Aliases: []string{"RMXC"},
950 Group: "rpc",
951 Tags: tags("node"),
952 Label: "Maximum Node RPC Clients",
953 Description:
954 "maximum number of clients for regular RPC",
955 Documentation: "<placeholder for detailed documentation>",
956 OmitEmpty: true,
957 },
958 constant.DefaultMaxRPCClients,
959 0, 256,
960 ),
961 "RPCMaxConcurrentReqs": integer.New(meta.Data{
962 Aliases: []string{"RMCR"},
963 Group: "rpc",
964 Tags: tags("node"),
965 Label: "Maximum Node RPC Concurrent Reqs",
966 Description:
967 "maximum number of requests to process concurrently",
968 Documentation: "<placeholder for detailed documentation>",
969 OmitEmpty: true,
970 },
971 constant.DefaultMaxRPCConcurrentReqs,
972 0, 4096,
973 ),
974 "RPCMaxWebsockets": integer.New(meta.Data{
975 Aliases: []string{"RMWS"},
976 Group: "rpc",
977 Tags: tags("node"),
978 Label: "Maximum Node RPC Websockets",
979 Description:
980 "maximum number of websocket clients to allow",
981 Documentation: "<placeholder for detailed documentation>",
982 OmitEmpty: true,
983 },
984 constant.DefaultMaxRPCWebsockets,
985 0, 4096,
986 ),
987 "RPCQuirks": binary.New(meta.Data{
988 Aliases: []string{"RQ"},
989 Group: "rpc",
990 Tags: tags("node"),
991 Label: "Emulate Bitcoin Core RPC Quirks",
992 Description:
993 "enable bugs that replicate bitcoin core RPC's JSON",
994 Documentation: "<placeholder for detailed documentation>",
995 OmitEmpty: true,
996 },
997 false,
998 ),
999 "RunAsService": binary.New(meta.Data{
1000 Aliases: []string{"RS"},
1001 Label: "Run As Service",
1002 Description:
1003 "shuts down on lock timeout",
1004 Documentation: "<placeholder for detailed documentation>",
1005 OmitEmpty: true,
1006 },
1007 false,
1008 ),
1009 "Save": binary.New(meta.Data{
1010 Aliases: []string{"SV"},
1011 Label: "Save Configuration",
1012 Description:
1013 "save opts given on commandline",
1014 Documentation: "<placeholder for detailed documentation>",
1015 OmitEmpty: true,
1016 },
1017 false,
1018 ),
1019 "ServerTLS": binary.New(meta.Data{
1020 Aliases: []string{"ST"},
1021 Group: "wallet",
1022 Tags: tags("node", "wallet"),
1023 Label: "Server TLS",
1024 Description:
1025 "enable TLS for the wallet connection to node RPC server",
1026 Documentation: "<placeholder for detailed documentation>",
1027 OmitEmpty: true,
1028 },
1029 true,
1030 ),
1031 "SigCacheMaxSize": integer.New(meta.Data{
1032 Aliases: []string{"SCM"},
1033 Group: "node",
1034 Tags: tags("node"),
1035 Label: "Signature Cache Max Size",
1036 Description:
1037 "the maximum number of entries in the signature verification cache",
1038 Documentation: "<placeholder for detailed documentation>",
1039 OmitEmpty: true,
1040 },
1041 constant.DefaultSigCacheMaxSize,
1042 constant.DefaultSigCacheMaxSize, constant.BlockMaxSizeMax,
1043 ),
1044 "Solo": binary.New(meta.Data{
1045 Group: "mining",
1046 Label: "Solo Generate",
1047 Tags: tags("node"),
1048 Description:
1049 "mine even if not connected to a network",
1050 Documentation: "<placeholder for detailed documentation>",
1051 OmitEmpty: true,
1052 },
1053 false,
1054 ),
1055 "ClientTLS": binary.New(meta.Data{
1056 Aliases: []string{"CT"},
1057 Group: "tls",
1058 Tags: tags("node", "wallet"),
1059 Label: "TLS",
1060 Description:
1061 "enable TLS for RPC client connections",
1062 Documentation: "<placeholder for detailed documentation>",
1063 OmitEmpty: true,
1064 },
1065 true,
1066 ),
1067 "TLSSkipVerify": binary.New(meta.Data{
1068 Aliases: []string{"TSV"},
1069 Group: "tls",
1070 Tags: tags("node", "wallet"),
1071 Label: "TLS Skip Verify",
1072 Description:
1073 "skip TLS certificate verification (ignore CA errors)",
1074 Documentation: "<placeholder for detailed documentation>",
1075 OmitEmpty: true,
1076 },
1077 false,
1078 ),
1079 "TorIsolation": binary.New(meta.Data{
1080 Aliases: []string{"TI"},
1081 Group: "proxy",
1082 Tags: tags("node"),
1083 Label: "Tor Isolation",
1084 Description:
1085 "makes a separate proxy connection for each connection",
1086 Documentation: "<placeholder for detailed documentation>",
1087 OmitEmpty: true,
1088 },
1089 false,
1090 ),
1091 "TrickleInterval": duration.New(meta.Data{
1092 Aliases: []string{"TKI"},
1093 Group: "policy",
1094 Tags: tags("node"),
1095 Label: "Trickle Interval",
1096 Description:
1097 "minimum time between attempts to send new inventory to a connected peer",
1098 Documentation: "<placeholder for detailed documentation>",
1099 OmitEmpty: true,
1100 },
1101 constant.DefaultTrickleInterval,
1102 time.Second, time.Second*30,
1103 ),
1104 "TxIndex": binary.New(meta.Data{
1105 Aliases: []string{"TXI"},
1106 Group: "node",
1107 Tags: tags("node"),
1108 Label: "Tx Index",
1109 Description:
1110 "maintain a full hash-based transaction index which makes all transactions available via the getrawtransaction RPC",
1111 Documentation: "<placeholder for detailed documentation>",
1112 OmitEmpty: true,
1113 },
1114 false,
1115 ),
1116 "UPNP": binary.New(meta.Data{
1117 Aliases: []string{"UP"},
1118 Group: "node",
1119 Tags: tags("node"),
1120 Label: "UPNP",
1121 Description:
1122 "enable UPNP for NAT traversal",
1123 Documentation: "<placeholder for detailed documentation>",
1124 OmitEmpty: true,
1125 },
1126 false,
1127 ),
1128 "UserAgentComments": list.New(meta.Data{
1129 Aliases: []string{"UA"},
1130 Group: "policy",
1131 Tags: tags("node"),
1132 Label: "User Agent Comments",
1133 Description:
1134 "comment to add to the user agent -- See BIP 14 for more information",
1135 Documentation: "<placeholder for detailed documentation>",
1136 OmitEmpty: true,
1137 },
1138 []string{},
1139 ),
1140 "Username": text.New(meta.Data{
1141 Aliases: []string{"UN"},
1142 Group: "rpc",
1143 Tags: tags("node", "wallet"),
1144 Label: "Username",
1145 Description:
1146 "password for client RPC connections",
1147 Documentation: "<placeholder for detailed documentation>",
1148 OmitEmpty: false,
1149 },
1150 "username",
1151 ),
1152 "UUID": integer.New(meta.Data{
1153 Label: "UUID",
1154 Description:
1155 "instance unique id (32bit random value) (json mangles big 64 bit integers due to float64 numbers)",
1156 Documentation: "<placeholder for detailed documentation>",
1157 OmitEmpty: false,
1158 },
1159 int64(rand.Uint32()),
1160 -math.MaxInt64, math.MaxInt64,
1161 ),
1162 "UseWallet": binary.New(meta.Data{
1163 Aliases: []string{"WC"},
1164 Group: "debug",
1165 Tags: tags("ctl"),
1166 Label: "Connect to Wallet",
1167 Description:
1168 "set ctl to connect to wallet instead of chain server",
1169 Documentation: "<placeholder for detailed documentation>",
1170 OmitEmpty: true,
1171 },
1172 false,
1173 ),
1174 "WalletFile": text.New(meta.Data{
1175 Aliases: []string{"WF"},
1176 Group: "config",
1177 Tags: tags("wallet"),
1178 Label: "Wallet File",
1179 Description:
1180 "wallet database file",
1181 Type: sanitizers.FilePath,
1182 Documentation: "<placeholder for detailed documentation>",
1183 OmitEmpty: true,
1184 },
1185 filepath.Join(string(datadir.Load().([]byte)), "mainnet", constant.DbName),
1186 ),
1187 "WalletOff": binary.New(meta.Data{
1188 Aliases: []string{"WO"},
1189 Group: "debug",
1190 Tags: tags("wallet"),
1191 Label: "Wallet Off",
1192 Description:
1193 "turn off the wallet backend",
1194 Documentation: "<placeholder for detailed documentation>",
1195 OmitEmpty: true,
1196 },
1197 false,
1198 ),
1199 "WalletPass": text.New(meta.Data{
1200 Aliases: []string{"WPW"},
1201 Label: "Wallet Pass",
1202 Tags: tags("wallet"),
1203 Description:
1204 "password encrypting public data in wallet - only hash is stored" +
1205 " so give on command line or in environment POD_WALLETPASS",
1206 Type: sanitizers.Password,
1207 Documentation: "<placeholder for detailed documentation>",
1208 OmitEmpty: false,
1209 },
1210 "",
1211 ),
1212 "WalletRPCListeners": list.New(meta.Data{
1213 Aliases: []string{"WRL"},
1214 Group: "wallet",
1215 Tags: tags("wallet"),
1216 Label: "Wallet RPC Listeners",
1217 Description:
1218 "addresses for wallet RPC server to listen on",
1219 Type: sanitizers.NetAddress,
1220 Documentation: "<placeholder for detailed documentation>",
1221 OmitEmpty: true,
1222 },
1223 []string{
1224 net.JoinHostPort("0.0.0.0",
1225 chaincfg.MainNetParams.WalletRPCServerPort,
1226 ),
1227 },
1228 ),
1229 "WalletRPCMaxClients": integer.New(meta.Data{
1230 Aliases: []string{"WRMC"},
1231 Group: "wallet",
1232 Tags: tags("wallet"),
1233 Label: "Legacy RPC Max Clients",
1234 Description:
1235 "maximum number of RPC clients allowed for wallet RPC",
1236 Documentation: "<placeholder for detailed documentation>",
1237 OmitEmpty: true,
1238 },
1239 constant.DefaultRPCMaxClients,
1240 0, 4096,
1241 ),
1242 "WalletRPCMaxWebsockets": integer.New(meta.Data{
1243 Aliases: []string{"WRMWS"},
1244 Group: "wallet",
1245 Tags: tags("wallet"),
1246 Label: "Legacy RPC Max Websockets",
1247 Description:
1248 "maximum number of websocket clients allowed for wallet RPC",
1249 Documentation: "<placeholder for detailed documentation>",
1250 OmitEmpty: true,
1251 },
1252 constant.DefaultRPCMaxWebsockets,
1253 0, 4096,
1254 ),
1255 "WalletServer": text.New(meta.Data{
1256 Aliases: []string{"WS"},
1257 Group: "wallet",
1258 Tags: tags("wallet"),
1259 Label: "Wallet Server",
1260 Description:
1261 "node address to connect wallet server to",
1262 Type: sanitizers.NetAddress,
1263 Documentation: "<placeholder for detailed documentation>",
1264 OmitEmpty: true,
1265 },
1266 net.JoinHostPort("127.0.0.1",
1267 chaincfg.MainNetParams.WalletRPCServerPort,
1268 ),
1269 ),
1270 "Whitelists": list.New(meta.Data{
1271 Aliases: []string{"WL"},
1272 Group: "debug",
1273 Tags: tags("node"),
1274 Label: "Whitelists",
1275 Description:
1276 "peers that you don't want to ever ban",
1277 Type: sanitizers.NetAddress,
1278 Documentation: "<placeholder for detailed documentation>",
1279 OmitEmpty: true,
1280 },
1281 []string{},
1282 ),
1283 }
1284 for i := range c {
1285 c[i].SetName(i)
1286 }
1287 return
1288 }
1289
1290 func genPassword() string {
1291 s, e := hdkeychain.GenerateSeed(16)
1292 if e != nil {
1293 panic("can't do nothing without entropy! " + e.Error())
1294 }
1295 return base58.Encode(s)
1296 }
1297