cmd/ipfs: error out on invalid routing option
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
Jeromy committed
Dec 7, 2016 at 16:22 UTC
58a2c5f8153c5061b3a9e2211cf85144e819c621
1 file changed
+6
cmd/ipfs/daemon.go
+6
@@ -44,6 +44,7 @@ const (
44
routingOptionKwd = "routing"
45
routingOptionSupernodeKwd = "supernode"
46
routingOptionDHTClientKwd = "dhtclient"
47
+ routingOptionDHTKwd = "dht"
48
unencryptTransportKwd = "disable-transport-encryption"
49
unrestrictedApiAccessKwd = "unrestricted-api"
50
writableKwd = "writable"
@@ -328,6 +329,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
329
ncfg.Routing = corerouting.SupernodeClient(infos...)
330
case routingOptionDHTClientKwd:
331
ncfg.Routing = core.DHTClientOption
332
+ case routingOptionDHTKwd:
333
+ ncfg.Routing = core.DHTOption
334
+ default:
335
+ res.SetError(fmt.Errorf("unrecognized routing option: %s", routingOption), cmds.ErrNormal)
336
+ return
337
}
338
339
node, err := core.NewNode(req.Context(), ncfg)