Skip to content

Commit

Permalink
Merge pull request #3482 from ipfs/fix/daemon-routing-opt-chk
Browse files Browse the repository at this point in the history
cmd/ipfs: error out on invalid routing option
  • Loading branch information
whyrusleeping authored Dec 8, 2016
2 parents b6c1155 + 58a2c5f commit e9215a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
routingOptionKwd = "routing"
routingOptionSupernodeKwd = "supernode"
routingOptionDHTClientKwd = "dhtclient"
routingOptionDHTKwd = "dht"
unencryptTransportKwd = "disable-transport-encryption"
unrestrictedApiAccessKwd = "unrestricted-api"
writableKwd = "writable"
Expand Down Expand Up @@ -328,6 +329,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
ncfg.Routing = corerouting.SupernodeClient(infos...)
case routingOptionDHTClientKwd:
ncfg.Routing = core.DHTClientOption
case routingOptionDHTKwd:
ncfg.Routing = core.DHTOption
default:
res.SetError(fmt.Errorf("unrecognized routing option: %s", routingOption), cmds.ErrNormal)
return
}

node, err := core.NewNode(req.Context(), ncfg)
Expand Down

0 comments on commit e9215a6

Please sign in to comment.