Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
func Start ¶
func Start(input OperationInput) *Operation
func (*Operation) Closest ¶
func (op *Operation) Closest() *k_nearest_nodes.Type
type OperationInput ¶
type OperationInput struct { Target krpc.ID Alpha int K int DoQuery func(context.Context, krpc.NodeAddr) QueryResult NodeFilter func(types.AddrMaybeId) bool // This filters the adding of nodes to the "closest data" set based on the data they provided. // The data is (usually?) derived from the token field in a reply. For the get_peers traversal // operation for example, we would filter out non-strings, since we later need to pass strings // in to the Token field to announce ourselves to the closest nodes we found to the target. DataFilter func(data any) bool }
type QueryResult ¶
type QueryResult struct { // This is set non-nil if a query reply is a response-type as defined by the DHT BEP 5 (contains // "r") ResponseFrom *krpc.NodeInfo // Data associated with a closest node. Is this ever not a string? I think using generics for // this leaks throughout the entire Operation. Hardly worth it. It's still possible to handle // invalid token types at runtime. ClosestData interface{} Nodes []krpc.NodeInfo Nodes6 []krpc.NodeInfo }
Click to show internal directories.
Click to hide internal directories.