5d20cf8829
* peertls: don't log errors for double close understood that this part of the code is undergoing heavy change right now, but just want to make sure this fix gets incorporated somewhere * git cleanup: node-id stuff * cleanup * rename identity_util.go * wip `CertificateAuthority` refactor * refactoring * gitignore update * wip * Merge remote-tracking branch 'storj/doubleclose' into node-id3 * storj/doubleclose: peertls: don't log errors for double close * add peertls tests & gomports * wip: + refactor + style changes + cleanup + [wip] add version to CA and identity configs + [wip] heavy client setup * refactor * wip: + refactor + style changes + add `CAConfig.Load` + add `CAConfig.Save` * wip: + add `LoadOrCreate` and `Create` to CA and Identity configs + add overwrite to CA and identity configs + heavy client setup + refactor + style changes + cleanup * wip * fixing things * fixing things * wip hc setup * hc setup: + refactor + bugfixing * improvements based on reveiw feedback * goimports * improvements: + responding to review feedback + refactor * feedback-based improvements * feedback-based improvements * feedback-based improvements * feedback-based improvements * feedback-based improvements * feedback-based improvements * cleanup * refactoring CA and Identity structs * Merge branch 'master' into node-id3 * move version field to setup config structs for CA and identity * fix typo * responding to revieiw feedback * responding to revieiw feedback * responding to revieiw feedback * responding to revieiw feedback * responding to revieiw feedback * responding to revieiw feedback * Merge branch 'master' into node-id3 * fix gateway setup finally * go imports * fix `FullCertificateAuthority.GenerateIdentity` * cleanup overlay tests * bugfixing * update ca/identity setup * go imports * fix peertls test copy/paste fail * responding to review feedback * setup tweaking * update farmer setup
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
// Copyright (C) 2018 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package dht
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
proto "storj.io/storj/protos/overlay"
|
|
)
|
|
|
|
// NodeID is the unique identifer used for Nodes in the DHT
|
|
type NodeID interface {
|
|
String() string
|
|
Bytes() []byte
|
|
}
|
|
|
|
// DHT is the interface for the DHT in the Storj network
|
|
type DHT interface {
|
|
GetNodes(ctx context.Context, start string, limit int, restrictions ...proto.Restriction) ([]*proto.Node, error)
|
|
GetRoutingTable(ctx context.Context) (RoutingTable, error)
|
|
Bootstrap(ctx context.Context) error
|
|
Ping(ctx context.Context, node proto.Node) (proto.Node, error)
|
|
FindNode(ctx context.Context, ID NodeID) (proto.Node, error)
|
|
Disconnect() error
|
|
}
|
|
|
|
// RoutingTable contains information on nodes we have locally
|
|
type RoutingTable interface {
|
|
// local params
|
|
Local() proto.Node
|
|
K() int
|
|
CacheSize() int
|
|
|
|
GetBucket(id string) (bucket Bucket, ok bool)
|
|
GetBuckets() ([]Bucket, error)
|
|
|
|
FindNear(id NodeID, limit int) ([]*proto.Node, error)
|
|
|
|
ConnectionSuccess(id string, address proto.NodeAddress)
|
|
ConnectionFailed(id string, address proto.NodeAddress)
|
|
|
|
// these are for refreshing
|
|
SetBucketTimestamp(id string, now time.Time) error
|
|
GetBucketTimestamp(id string, bucket Bucket) (time.Time, error)
|
|
}
|
|
|
|
// Bucket is a set of methods to act on kademlia k buckets
|
|
type Bucket interface {
|
|
Routing() []proto.Node
|
|
Cache() []proto.Node
|
|
Midpoint() string
|
|
Nodes() []*proto.Node
|
|
}
|