storj/pkg/node/client.go
Maximillian von Briesen 553def620a TLS Support (#252)
* begin adding tls

* remove incomplete line in gw/main.go

* identity fixes+:

+ fix `peertls.NewCert` public key issue
+ fix `peertls.verfiyChain` issue
+ fix identity dial option
+ rename `GenerateCA` to `NewCA` and `generateCAWorker` to `newCAWorker` for better consistency/convention

* use pdbclient instead of pointerdb in miniogw

* fix tests

* go fmt

* make review changes

* modify how context.Background() is used

* more context stuff
2018-08-23 22:01:03 -06:00

34 lines
834 B
Go

// Copyright (C) 2018 Storj Labs, Inc.
// See LICENSE for copying information
package node
import (
"context"
"github.com/zeebo/errs"
"storj.io/storj/pkg/pool"
"storj.io/storj/pkg/provider"
"storj.io/storj/pkg/transport"
proto "storj.io/storj/protos/overlay"
)
//NodeClientErr is the class for all errors pertaining to node client operations
var NodeClientErr = errs.Class("node client error")
// NewNodeClient instantiates a node client
func NewNodeClient(identity *provider.FullIdentity, self proto.Node) (Client, error) {
client := transport.NewClient(identity)
return &Node{
self: self,
tc: client,
cache: pool.NewConnectionPool(),
}, nil
}
// Client is the Node client communication interface
type Client interface {
Lookup(ctx context.Context, to proto.Node, find proto.Node) ([]*proto.Node, error)
}