@cryptotaxi247 / kubo / commits / 2a322ad7f

feat(daemon) learns --routing=supernode

Brian Tiger Chow committed Feb 6, 2015 at 13:41 UTC 2a322ad7fbef27723ee7958f288a03b32eea7091
1 file changed +10 -9
cmd/ipfs/daemon.go
+10 -9
@@ -18,12 +18,13 @@ import (
18 )
19
20 const (
21 - initOptionKwd = "init"
22 - gcrKwd = "gcr"
23 - mountKwd = "mount"
24 - writableKwd = "writable"
25 - ipfsMountKwd = "mount-ipfs"
26 - ipnsMountKwd = "mount-ipns"
21 + initOptionKwd = "init"
22 + routingOptionKwd = "routing"
23 + routingOptionSupernodeKwd = "supernode"
24 + mountKwd = "mount"
25 + writableKwd = "writable"
26 + ipfsMountKwd = "mount-ipfs"
27 + ipnsMountKwd = "mount-ipns"
28 // apiAddrKwd = "address-api"
29 // swarmAddrKwd = "address-swarm"
30 )
@@ -42,7 +43,7 @@ the daemon.
43
44 Options: []cmds.Option{
45 cmds.BoolOption(initOptionKwd, "Initialize IPFS with default settings if not already initialized"),
45 - cmds.BoolOption(gcrKwd, "Enables Grandcentral Routing"),
46 + cmds.StringOption(routingOptionKwd, "Overrides the routing option (dht, supernode)"),
47 cmds.BoolOption(mountKwd, "Mounts IPFS to the filesystem"),
48 cmds.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
49 cmds.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount)"),
@@ -107,12 +108,12 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
108 nb := core.NewNodeBuilder().Online()
109 nb.SetRepo(repo)
110
110 - useGCR, _, err := req.Option(gcrKwd).Bool()
111 + routingOption, _, err := req.Option(routingOptionKwd).String()
112 if err != nil {
113 res.SetError(err, cmds.ErrNormal)
114 return
115 }
115 - if useGCR {
116 + if routingOption == routingOptionSupernodeKwd {
117 servers, err := repo.Config().GCR.ServerIPFSAddrs()
118 if err != nil {
119 res.SetError(err, cmds.ErrNormal)