提交 2a322ad7 作者: Brian Tiger Chow

feat(daemon) learns --routing=supernode

上级 87c6604b
......@@ -18,12 +18,13 @@ import (
)
const (
initOptionKwd = "init"
gcrKwd = "gcr"
mountKwd = "mount"
writableKwd = "writable"
ipfsMountKwd = "mount-ipfs"
ipnsMountKwd = "mount-ipns"
initOptionKwd = "init"
routingOptionKwd = "routing"
routingOptionSupernodeKwd = "supernode"
mountKwd = "mount"
writableKwd = "writable"
ipfsMountKwd = "mount-ipfs"
ipnsMountKwd = "mount-ipns"
// apiAddrKwd = "address-api"
// swarmAddrKwd = "address-swarm"
)
......@@ -42,7 +43,7 @@ the daemon.
Options: []cmds.Option{
cmds.BoolOption(initOptionKwd, "Initialize IPFS with default settings if not already initialized"),
cmds.BoolOption(gcrKwd, "Enables Grandcentral Routing"),
cmds.StringOption(routingOptionKwd, "Overrides the routing option (dht, supernode)"),
cmds.BoolOption(mountKwd, "Mounts IPFS to the filesystem"),
cmds.BoolOption(writableKwd, "Enable writing objects (with POST, PUT and DELETE)"),
cmds.StringOption(ipfsMountKwd, "Path to the mountpoint for IPFS (if using --mount)"),
......@@ -107,12 +108,12 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
nb := core.NewNodeBuilder().Online()
nb.SetRepo(repo)
useGCR, _, err := req.Option(gcrKwd).Bool()
routingOption, _, err := req.Option(routingOptionKwd).String()
if err != nil {
res.SetError(err, cmds.ErrNormal)
return
}
if useGCR {
if routingOption == routingOptionSupernodeKwd {
servers, err := repo.Config().GCR.ServerIPFSAddrs()
if err != nil {
res.SetError(err, cmds.ErrNormal)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论