From d4b7b1d110c74f880fcd4d2db2603c8a64d94cd8 Mon Sep 17 00:00:00 2001 From: Age Date: Fri, 23 Dec 2016 12:12:58 +1100 Subject: [PATCH] swarm/api: correct bzz.resolve functionality - amended --- swarm/api/ens.go | 45 --------------------------------------------- swarm/swarm.go | 2 +- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 swarm/api/ens.go diff --git a/swarm/api/ens.go b/swarm/api/ens.go deleted file mode 100644 index 26abe72e2f..0000000000 --- a/swarm/api/ens.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - - -package api - -import ( - "github.com/ethereum/go-ethereum/logger/glog" - "github.com/ethereum/go-ethereum/logger" -) - -// Implements an RPC service -type Ens struct { - api *Api -} - -func NewEns(api *Api) *Ens { - return &Ens{api} -} - -// Resolves ENS domains to contentHashes. -// Could use swarm Api.Resolve if we wanted bzz.resolve both domains and hashes. -func (self *Ens) Resolve(domain string) (string, error) { - contentHash, err := self.api.dns.Resolve(domain) - if err != nil { - err = ErrResolve(err) - glog.V(logger.Warn).Infof("DNS error : %v", err) - } - glog.V(logger.Detail).Infof("host lookup: %v -> %v", err) - return contentHash.Hex(), err - -} diff --git a/swarm/swarm.go b/swarm/swarm.go index 02c93e2ce2..cdbb3af8a5 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -236,7 +236,7 @@ func (self *Swarm) APIs() []rpc.API { { Namespace: "bzz", Version: "0.1", - Service: api.NewEns(self.api), + Service: self.dns, Public: true, }, // admin APIs