diff --git a/routing/dht/dht.go b/routing/dht/dht.go index b54d4698353..ad5dcd97d25 100644 --- a/routing/dht/dht.go +++ b/routing/dht/dht.go @@ -96,16 +96,6 @@ func NewDHT(ctx context.Context, h host.Host, dstore ds.Datastore) *IpfsDHT { return dht } -// LocalPeer returns the peer.Peer of the dht. -func (dht *IpfsDHT) LocalPeer() peer.ID { - return dht.self -} - -// log returns the dht's logger -func (dht *IpfsDHT) log() logging.EventLogger { - return log // TODO rm -} - // putValueToPeer stores the given key/value pair at the peer 'p' func (dht *IpfsDHT) putValueToPeer(ctx context.Context, p peer.ID, key key.Key, rec *pb.Record) error { diff --git a/routing/dht/dht_logger.go b/routing/dht/dht_logger.go deleted file mode 100644 index eea47ec1aeb..00000000000 --- a/routing/dht/dht_logger.go +++ /dev/null @@ -1,46 +0,0 @@ -package dht - -import ( - "encoding/json" - "fmt" - "time" -) - -type logDhtRPC struct { - Type string - Start time.Time - End time.Time - Duration time.Duration - RPCCount int - Success bool -} - -func startNewRPC(name string) *logDhtRPC { - r := new(logDhtRPC) - r.Type = name - r.Start = time.Now() - return r -} - -func (l *logDhtRPC) EndLog() { - l.End = time.Now() - l.Duration = l.End.Sub(l.Start) -} - -func (l *logDhtRPC) Print() { - b, err := json.Marshal(l) - if err != nil { - log.Debugf("Error marshaling logDhtRPC object: %s", err) - } else { - log.Debug(string(b)) - } -} - -func (l *logDhtRPC) String() string { - return fmt.Sprintf("DHT RPC: %s took %s, success = %v", l.Type, l.Duration, l.Success) -} - -func (l *logDhtRPC) EndAndPrint() { - l.EndLog() - l.Print() -} diff --git a/routing/dht/diag.go b/routing/dht/diag.go deleted file mode 100644 index 7958a27837c..00000000000 --- a/routing/dht/diag.go +++ /dev/null @@ -1,44 +0,0 @@ -package dht - -import ( - "encoding/json" - "time" - - peer "gx/ipfs/QmQGwpJy9P4yXZySmqkZEXCmbBpJUb8xntCv8Ca4taZwDC/go-libp2p-peer" -) - -type connDiagInfo struct { - Latency time.Duration - ID peer.ID -} - -type diagInfo struct { - ID peer.ID - Connections []connDiagInfo - Keys []string - LifeSpan time.Duration - CodeVersion string -} - -func (di *diagInfo) Marshal() []byte { - b, err := json.Marshal(di) - if err != nil { - panic(err) - } - //TODO: also consider compressing this. There will be a lot of these - return b -} - -func (dht *IpfsDHT) getDiagInfo() *diagInfo { - di := new(diagInfo) - di.CodeVersion = "github.com/ipfs/go-ipfs" - di.ID = dht.self - di.LifeSpan = time.Since(dht.birth) - di.Keys = nil // Currently no way to query datastore - - for _, p := range dht.routingTable.ListPeers() { - d := connDiagInfo{dht.peerstore.LatencyEWMA(p), p} - di.Connections = append(di.Connections, d) - } - return di -}