diff --git a/p2p/discover/api.go b/p2p/discover/api.go index 363765ca8f..47f26c3977 100644 --- a/p2p/discover/api.go +++ b/p2p/discover/api.go @@ -46,6 +46,22 @@ type ContentInfo struct { UtpTransfer bool `json:"utpTransfer"` } +type TraceContentResult struct { + Content string `json:"content"` + UtpTransfer bool `json:"utpTransfer"` + Trace Trace `json:"trace"` +} + +type Trace struct { + Origin string `json:"origin"` // local node id + TargetId string `json:"targetId"` // target content id + ReceivedFrom string `json:"receivedFrom"` // the node id of which content from + Responses map[string]ContentInfo `json:"responses"` // the node id and there response + Metadata map[string]any `json:"metadata"` // node id and there metadata object + StartedAtMs int `json:"startedAtMs"` // timestamp of the beginning of this request in milliseconds + Cancelled []string `json:"cancelled"` // the node ids which are send but cancelled +} + type Enrs struct { Enrs []string `json:"enrs"` } diff --git a/p2p/discover/portal_protocol.go b/p2p/discover/portal_protocol.go index 67eb3248a0..3b84f1da68 100644 --- a/p2p/discover/portal_protocol.go +++ b/p2p/discover/portal_protocol.go @@ -1499,6 +1499,8 @@ func (p *PortalProtocol) contentLookupWorker(n *enode.Node, contentKey []byte, r return wrapedNode, nil } +// func (p *PortalProtocol) traceContentLookupWorker() + func (p *PortalProtocol) ToContentId(contentKey []byte) []byte { return p.toContentId(contentKey) }