diff options
author | Janos Guljas <janos@resenje.org> | 2017-12-18 23:22:39 +0800 |
---|---|---|
committer | Janos Guljas <janos@resenje.org> | 2017-12-18 23:22:39 +0800 |
commit | c0a4d9e1e64a09a19484c8c12e24505d9bacbd57 (patch) | |
tree | 1ccb0df96f947a17a23dcdf84a6871bd4a9759ba /swarm | |
parent | 47a801455966298d1d1519eebb955024c8f02b84 (diff) | |
download | go-tangerine-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.tar go-tangerine-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.tar.gz go-tangerine-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.tar.bz2 go-tangerine-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.tar.lz go-tangerine-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.tar.xz go-tangerine-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.tar.zst go-tangerine-c0a4d9e1e64a09a19484c8c12e24505d9bacbd57.zip |
cmd/swarm, swarm: disable ENS API by default
Specifying ENS API CLI flag, env variable or configuration
field is required for ENS resolving. Backward compatibility is
preserved with --ens-api="" CLI flag value.
Diffstat (limited to 'swarm')
-rw-r--r-- | swarm/api/config.go | 2 | ||||
-rw-r--r-- | swarm/swarm.go | 23 |
2 files changed, 7 insertions, 18 deletions
diff --git a/swarm/api/config.go b/swarm/api/config.go index 3f1a2a074..6b224140a 100644 --- a/swarm/api/config.go +++ b/swarm/api/config.go @@ -48,7 +48,6 @@ type Config struct { *network.SyncParams Contract common.Address EnsRoot common.Address - EnsDisabled bool EnsAPIs []string Path string ListenAddr string @@ -78,7 +77,6 @@ func NewDefaultConfig() (self *Config) { Path: node.DefaultDataDir(), EnsAPIs: nil, EnsRoot: ens.TestNetAddress, - EnsDisabled: false, NetworkId: network.NetworkId, SwapEnabled: false, SyncEnabled: true, diff --git a/swarm/swarm.go b/swarm/swarm.go index ae6805dfd..3c77d6eab 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -138,26 +138,17 @@ func NewSwarm(ctx *node.ServiceContext, backend chequebook.Backend, config *api. self.dpa = storage.NewDPA(dpaChunkStore, self.config.ChunkerParams) log.Debug(fmt.Sprintf("-> Content Store API")) - if !config.EnsDisabled { - if len(config.EnsAPIs) == 0 { - // ENS is enabled and has no specific configuration, - // use defaults - self.dns, err = newEnsClient(node.DefaultIPCEndpoint("geth"), config.EnsRoot, config) + if len(config.EnsAPIs) > 0 { + opts := []api.MultiResolverOption{} + for _, c := range config.EnsAPIs { + tld, endpoint, addr := parseEnsAPIAddress(c) + r, err := newEnsClient(endpoint, addr, config) if err != nil { return nil, err } - } else { - opts := []api.MultiResolverOption{} - for _, c := range config.EnsAPIs { - tld, endpoint, addr := parseEnsAPIAddress(c) - r, err := newEnsClient(endpoint, addr, config) - if err != nil { - return nil, err - } - opts = append(opts, api.MultiResolverOptionWithResolver(r, tld)) - } - self.dns = api.NewMultiResolver(opts...) + opts = append(opts, api.MultiResolverOptionWithResolver(r, tld)) } + self.dns = api.NewMultiResolver(opts...) } self.api = api.NewApi(self.dpa, self.dns) |