Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport Client #89

Merged
merged 67 commits into from
Jun 29, 2018
Merged

Transport Client #89

merged 67 commits into from
Jun 29, 2018

Conversation

aligeti
Copy link
Contributor

@aligeti aligeti commented Jun 12, 2018

Client library that can find IP and port from node ids (implement dhclient and netclient)
PivotalTracker ID#158238491


This change is Reviewable

@aligeti
Copy link
Contributor Author

aligeti commented Jun 12, 2018

Created a pull request and initial devlopment setup for the pivotal tracker ID#158238491

@kaloyan-raev
Copy link
Member

@aligeti The ticket in PivotalTracker is about creating a client library that implements the netclient interface. I don't see anything like that in this PR. In contrast, I see some code related to the Minio Gateway that is not in scope of this ticket.

@kaloyan-raev
Copy link
Member

Review status: 0 of 10 files reviewed, 8 unresolved discussions (waiting on @aligeti)


pkg/clients/netclient/iface.go, line 12 at r8 (raw file):

	"go.uber.org/zap"
	"google.golang.org/grpc"
	"storj.io/storj/pkg/dtypes"

Add an empty line before the storj.io import group.


pkg/clients/netclient/iface.go, line 15 at r8 (raw file):

)

// NetClient defines the interface to an overlay client.

This is not an interface to an overlay client, but to a network client.


pkg/clients/netclient/iface.go, line 18 at r8 (raw file):

type NetClient interface {
	DialUnauthenticated(ctx context.Context, address dtypes.Address) (*grpc.ClientConn, error)
	DialNode(ctx context.Context, nodeID dtypes.Node) (*grpc.ClientConn, error)

The nodeID should be of type NodeID instead of Node. This is what the light client will get from the Network State Pointer before calling the NetClient.


pkg/clients/netclient/iface.go, line 21 at r8 (raw file):

}

// Overlay is the overlay concrete implementation of the client interface

There is nothing related to overlay in this type.


pkg/clients/netclient/iface.go, line 22 at r8 (raw file):

// Overlay is the overlay concrete implementation of the client interface
type storjClient struct {

netClient would be a better name for the type.


pkg/clients/netclient/iface.go, line 23 at r8 (raw file):

// Overlay is the overlay concrete implementation of the client interface
type storjClient struct {
	nodeID dtypes.Node

Why do you need to store the nodeID here?


pkg/clients/netclient/iface.go, line 30 at r8 (raw file):

func (o *storjClient) DialNode(ctx context.Context, nodeID dtypes.Node) (*grpc.ClientConn, error) {
	/* TODO@ASK: call the DHT functions to open up a connection to the DHT (cache) servers */
	conn, err := grpc.Dial((nodeID.Address.Network + ":" + strconv.Itoa(nodeID.Address.Port)), grpc.WithInsecure())

You can't actually do it just like that. As commented above the nodeID is of type NodeID, but not Node. So you don't have access to the node's Address directly from the NodeID. You need to Lookup the Node struct from the Overlay Client (PR #91) passing the NodeID you have.


pkg/dtypes/common.go, line 4 at r8 (raw file):

// See LICENSE for copying information.

package dtypes

You should not define this types yourself in this PR. Instead you should use the Node, NodeID and Address types defined by the Overlay Client (PR #91).


Comments from Reviewable

@jtolio
Copy link
Member

jtolio commented Jun 15, 2018

Review status: 0 of 10 files reviewed, 10 unresolved discussions (waiting on @aligeti)


pkg/clients/netclient/iface.go, line 18 at r8 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

The nodeID should be of type NodeID instead of Node. This is what the light client will get from the Network State Pointer before calling the NetClient.

actually! it should be of type dtypes.Node. here's why:

the DHT cache is going to return a list of 40 nodes to talk to. for each of the 40 nodes, we're going to call DialNode. If we only pass an id and not a full dtypes.Node, we don't have an address, and we have to look it up again, which means talking to the DHT cache 40 more times. shoot!

if we use a dtypes.Node, if the address is filled in, we'll use the provided address and confirm it's the right node id before returning the ClientConn (the confirmation thing is something bryan is working on). If the address is not filled in and types.Node only has a NodeID, then we have to look up the address.

i should have left a comment about this. sorry!


pkg/miniogw/gateway-storj.go, line 18 at r8 (raw file):

	"time"

	"storj.io/storj/pkg/overlay"

would it be okay if we kept all of the changes in this file in a separate review?


pkg/overlay/client_test.go, line 1 at r8 (raw file):

// Copyright (C) 2018 Storj Labs, Inc.

can you leave dennis's commits out of this review as well?


Comments from Reviewable

@kaloyan-raev
Copy link
Member

Review status: 0 of 10 files reviewed, 10 unresolved discussions (waiting on @aligeti)


pkg/clients/netclient/iface.go, line 18 at r8 (raw file):

Previously, jtolds (JT Olio) wrote…

actually! it should be of type dtypes.Node. here's why:

the DHT cache is going to return a list of 40 nodes to talk to. for each of the 40 nodes, we're going to call DialNode. If we only pass an id and not a full dtypes.Node, we don't have an address, and we have to look it up again, which means talking to the DHT cache 40 more times. shoot!

if we use a dtypes.Node, if the address is filled in, we'll use the provided address and confirm it's the right node id before returning the ClientConn (the confirmation thing is something bryan is working on). If the address is not filled in and types.Node only has a NodeID, then we have to look up the address.

i should have left a comment about this. sorry!

Well, it seems I misunderstood the workflow. I thought that the NetClient will call the DHT cache as necessary instead of the caller looking up the Node from the DHT cache before calling NetClient's Dial.

In any case, my concern was that the name of the parameter does not reflect its type. If the type should be Node then the param name should be node instead of nodeID.


Comments from Reviewable

@jtolio
Copy link
Member

jtolio commented Jun 15, 2018

Review status: 0 of 10 files reviewed, 10 unresolved discussions (waiting on @aligeti)


pkg/clients/netclient/iface.go, line 18 at r8 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

Well, it seems I misunderstood the workflow. I thought that the NetClient will call the DHT cache as necessary instead of the caller looking up the Node from the DHT cache before calling NetClient's Dial.

In any case, my concern was that the name of the parameter does not reflect its type. If the type should be Node then the param name should be node instead of nodeID.

No no, you're right, that is the workflow. The NetClient will call the DHT cache as necessary! When you're dialing a specific node, this will do the lookup if you don't already have the address.

There's one side workflow which is weird that this is optimizing for is when someone else has already asked the DHT cache for 40 random nodes. You say "give me 40 nodes, I don't care about the ids", and it gives you back 40 nodes. Those 40 nodes, if they have addresses, can give the address to the DialNode method to save a lookup.


Comments from Reviewable

@coyle
Copy link
Contributor

coyle commented Jun 28, 2018

Reviewed 1 of 6 files at r10, 1 of 3 files at r11, 2 of 5 files at r14, 3 of 3 files at r16.
Review status: all files reviewed, 11 unresolved discussions (waiting on @jtolds)


Comments from Reviewable

@coyle
Copy link
Contributor

coyle commented Jun 28, 2018

:lgtm:


Review status: all files reviewed, 11 unresolved discussions (waiting on @jtolds)


Comments from Reviewable

@kaloyan-raev
Copy link
Member

Review status: all files reviewed, 14 unresolved discussions (waiting on @jtolds and @aligeti)


pkg/transport/transport.go, line 32 at r16 (raw file):

	if node.Address == nil || node.Address.Address == "" {
		return nil, errors.New("No Address")

We defined an error class above, so we should use it when creating new errors.


pkg/transport/client.go, line 18 at r16 (raw file):

var (
	mon   = monkit.Package()
	Error = errs.Class("error")

We should initialize the error class with "transport error", not just "error", so we can distinguish it from other error classes.


pkg/transport/client.go, line 23 at r16 (raw file):

// client defines the interface to an network client.
type Client interface {
	DialUnauthenticated(ctx context.Context, node proto.Node) (*grpc.ClientConn, error)

This method should take NodeAddress, not Node.

I remember from the discussion on Wednesday that DialUnauthenticated just dials the provided address, while DialNode will in addition (in future, when Bryan add some security stuff) check that the client dialed the expected node. And this is why DialNode takes a Node, but DialUnathenticated only a NodeAddress.


Comments from Reviewable

@aligeti
Copy link
Contributor Author

aligeti commented Jun 29, 2018

Review status: all files reviewed, 14 unresolved discussions (waiting on @jtolds and @aligeti)


pkg/transport/transport.go, line 32 at r16 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

We defined an error class above, so we should use it when creating new errors.

Am I missing something here? That is what I am using errors.New("...") to create new errors. Let me know what you want it to be ..... Also I reviewed with Dennis. he is fine.


pkg/clients/connectioncache/connectioncache_iface.go, line 26 at r13 (raw file):

Previously, jtolds (JT Olio) wrote…

i don't think you need this Client thing. grpc connections are grpc connections, independent of anything else

removed the file


pkg/clients/connectioncache/connectioncache_impl.go, line 20 at r13 (raw file):

Previously, jtolds (JT Olio) wrote…

you don't need to do this. all the connection cache does is return *grpc.ClientConns. why do you need an overlay client at all?

removed the file


pkg/clients/connectioncache/connectioncache_impl.go, line 26 at r13 (raw file):

Previously, jtolds (JT Olio) wrote…

you do need a transport client though

Done.


pkg/clients/connectioncache/connectioncache_impl.go, line 51 at r13 (raw file):

Previously, jtolds (JT Olio) wrote…

you should also be able to unindent a bunch of this logic by getting rid of elses. if you return in an if, you don't need an else!

Done.


pkg/clients/connectioncache/connectioncache_impl.go, line 74 at r13 (raw file):

Previously, jtolds (JT Olio) wrote…

else unneeded

Done.


pkg/transport/client.go, line 18 at r16 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

We should initialize the error class with "transport error", not just "error", so we can distinguish it from other error classes.

Will look into it ...


pkg/transport/client.go, line 23 at r16 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

This method should take NodeAddress, not Node.

I remember from the discussion on Wednesday that DialUnauthenticated just dials the provided address, while DialNode will in addition (in future, when Bryan add some security stuff) check that the client dialed the expected node. And this is why DialNode takes a Node, but DialUnathenticated only a NodeAddress.

kaloyan, there are lot of things unknown....we need to have a framework in place and thing will change as we figure out the stuff. Should it be a NodeAddress or NodeID or pointer... will take shape once we start putting all pieces together. So for now I will hold on to what it is there now.

If you see any error in the code implemented, I would be happy to change.


pkg/clients/transportclient/transportclient.go, line 4 at r12 (raw file):

Previously, coyle (Dennis Coyle) wrote…

still needs to be moved

renamed/moved as suggested


pkg/clients/transportclient/transportclient.go, line 17 at r13 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

The second parameter should be node proto.Node instead of addr string.

Done.


pkg/clients/transportclient/transportclient_iface.go, line 4 at r15 (raw file):

Previously, coyle (Dennis Coyle) wrote…

This is not the correct place for this. We should create a pkg/transport and place it in a file called client.go and rename the interface to Client

Done...


pkg/clients/transportclient/transportclient_impl.go, line 17 at r14 (raw file):

Previously, aligeti wrote…

used proto.Node

Done.


pkg/clients/transportclient/transportclient_impl.go, line 23 at r14 (raw file):

Previously, aligeti wrote…

changed as suggested

Done.


pkg/clients/transportclient/transportclient_impl.go, line 32 at r14 (raw file):

Previously, aligeti wrote…

removed the error/retry attempt code

Done.


pkg/clients/transportclient/transportclient_impl.go, line 10 at r15 (raw file):

Previously, coyle (Dennis Coyle) wrote…

there needs to be a line separator

Done.


pkg/clients/transportclient/transportclient_impl.go, line 22 at r15 (raw file):

Previously, coyle (Dennis Coyle) wrote…

you should first check that node.Address is not nil before indexing off it

Done.


Comments from Reviewable

@aligeti
Copy link
Contributor Author

aligeti commented Jun 29, 2018

Review status: all files reviewed, 14 unresolved discussions (waiting on @jtolds and @kaloyan-raev)


pkg/transport/client.go, line 18 at r16 (raw file):

Previously, aligeti wrote…

Will look into it ...

Done.


pkg/transport/client.go, line 23 at r16 (raw file):

Previously, aligeti wrote…

kaloyan, there are lot of things unknown....we need to have a framework in place and thing will change as we figure out the stuff. Should it be a NodeAddress or NodeID or pointer... will take shape once we start putting all pieces together. So for now I will hold on to what it is there now.

If you see any error in the code implemented, I would be happy to change.

Done.


Comments from Reviewable

@aligeti
Copy link
Contributor Author

aligeti commented Jun 29, 2018

Review status: all files reviewed, 14 unresolved discussions (waiting on @jtolds and @kaloyan-raev)


pkg/transport/transport.go, line 32 at r16 (raw file):

Previously, aligeti wrote…

Am I missing something here? That is what I am using errors.New("...") to create new errors. Let me know what you want it to be ..... Also I reviewed with Dennis. he is fine.

Done.


pkg/clients/connectioncache/connectioncache_iface.go, line 26 at r13 (raw file):

Previously, aligeti wrote…

removed the file

Done.


pkg/clients/connectioncache/connectioncache_impl.go, line 20 at r13 (raw file):

Previously, aligeti wrote…

removed the file

Done.


Comments from Reviewable

@kaloyan-raev
Copy link
Member

Review status: all files reviewed, 15 unresolved discussions (waiting on @jtolds, @kaloyan-raev, and @aligeti)


pkg/transport/transport.go, line 15 at r16 (raw file):

)

// transportClient is the concrete implementation of the networkclient interface

Is this doc comment saying anything meaningful? At least I cannot understand it.


pkg/transport/transport.go, line 32 at r16 (raw file):

Previously, aligeti wrote…

Done.

errors.New() creates a raw error. You've defined a zeebo error class in the client.go file, so I guess the intention was to use it in places like this one?


pkg/transport/client.go, line 18 at r16 (raw file):

Previously, aligeti wrote…

Done.

I don't see any change you've done here. Why marking it as Done?


pkg/transport/client.go, line 23 at r16 (raw file):

Previously, aligeti wrote…

Done.

We've discussed this interface thoroughly on the Wednesday meeting and I think everyone agreed we now have a very clear understanding of it. If you still think there is any uncertainty then I suggest to simply follow the original definition of the interface from #86 instead of changing it for no reason. Interfaces are important contracts between components and we should define them with care.


Comments from Reviewable

@aligeti
Copy link
Contributor Author

aligeti commented Jun 29, 2018

Review status: 0 of 3 files reviewed, 15 unresolved discussions (waiting on @coyle, @jtolds, @aligeti, and @kaloyan-raev)


pkg/transport/transport.go, line 15 at r16 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

Is this doc comment saying anything meaningful? At least I cannot understand it.

Changed the comment


pkg/transport/transport.go, line 32 at r16 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

errors.New() creates a raw error. You've defined a zeebo error class in the client.go file, so I guess the intention was to use it in places like this one?

modified using zeebos


Comments from Reviewable

@kaloyan-raev
Copy link
Member

Review status: 0 of 3 files reviewed, 13 unresolved discussions (waiting on @coyle, @jtolds, @kaloyan-raev, and @aligeti)


pkg/transport/transport.go, line 15 at r16 (raw file):

Previously, aligeti wrote…

Changed the comment

There is no networkclient interface. Perhaps it should be transport.Client.


pkg/transport/client.go, line 22 at r17 (raw file):

)

// Client defines the interface to an network client.

There is no network client. We call it transport client now.


Comments from Reviewable

@aligeti
Copy link
Contributor Author

aligeti commented Jun 29, 2018

Review status: 0 of 3 files reviewed, 13 unresolved discussions (waiting on @coyle, @jtolds, @kaloyan-raev, and @aligeti)


pkg/transport/transport.go, line 15 at r16 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

There is no networkclient interface. Perhaps it should be transport.Client.

Done.


Comments from Reviewable

@aligeti
Copy link
Contributor Author

aligeti commented Jun 29, 2018

Review status: 0 of 3 files reviewed, 13 unresolved discussions (waiting on @coyle, @jtolds, and @kaloyan-raev)


pkg/transport/client.go, line 22 at r17 (raw file):

Previously, kaloyan-raev (Kaloyan Raev) wrote…

There is no network client. We call it transport client now.

Done.


Comments from Reviewable

@kaloyan-raev
Copy link
Member

Review status: 0 of 3 files reviewed, 12 unresolved discussions (waiting on @coyle, @jtolds, and @kaloyan-raev)


pkg/transport/transport.go, line 15 at r16 (raw file):

Previously, aligeti wrote…

Done.

It still says "networkclient interface".


Comments from Reviewable

@kaloyan-raev
Copy link
Member

:lgtm:


Reviewed 1 of 6 files at r10, 1 of 3 files at r11, 2 of 5 files at r14, 1 of 3 files at r16, 1 of 3 files at r17, 2 of 2 files at r18.
Review status: all files reviewed, 11 unresolved discussions (waiting on @jtolds)


Comments from Reviewable

@kaloyan-raev kaloyan-raev merged commit 26f68fa into master Jun 29, 2018
@kaloyan-raev kaloyan-raev deleted the dev_dht_cache_int branch June 29, 2018 18:28
bryanchriswhite added a commit to bryanchriswhite/storj that referenced this pull request Jul 5, 2018
* master:
  Remove some structural folders we don't seem to be using. (storj#125)
  license code with agplv3 (storj#126)
  Update .clabot (storj#124)
  added team memebers (storj#123)
  clabot file added (storj#121)
  ECClient (storj#110)
  docker image issue fixed (storj#118)
  Piecestore Farmer CLI  (storj#92)
  Define Path type (storj#101)
  adds netstate pagination (storj#95)
  Transport Client (storj#89)
  Implement psclient interface (storj#107)
  pkg/process: start replacing pkg/process with cobra helpers (storj#98)
  protos/netstate: remove stuff we're not using (storj#100)
  adding coveralls / code coverage  (storj#112)
bryanchriswhite added a commit to bryanchriswhite/storj that referenced this pull request Jul 7, 2018
* tls: (97 commits)
  responding to review feedback / cleanup / add copywrite headers
  refactor
  cleanup
  refactoring `VerifyPeerCertificate`
  Remove some structural folders we don't seem to be using. (storj#125)
  license code with agplv3 (storj#126)
  Add tls certificate chain signature veification (spike):
  Update .clabot (storj#124)
  added team memebers (storj#123)
  clabot file added (storj#121)
  Properly write/read certificate chain (root/leaf):
  ECClient (storj#110)
  docker image issue fixed (storj#118)
  Piecestore Farmer CLI  (storj#92)
  Define Path type (storj#101)
  Experimenting/bugfixing?:
  not sure if actually working:
  implement `TLSFileOptions#loadTLS`, refactoring:
  adds netstate pagination (storj#95)
  Transport Client (storj#89)
  ...
bryanchriswhite added a commit that referenced this pull request Jul 9, 2018
* wip initial transport security

* wip: transport security (add tests / refactor)

* wip tests

* refactoring - still wip

* refactor, improve tests

* wip tls testing

* fix typo

* wip testing

* wip testing

* wip

* tls_test passing

* code-style improvemente / refactor; service and tls tests passing!

* code-style auto-format

* add TestNewServer_LoadTLS

* refactor; test improvements

* refactor

* add client cert

* port changes

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* files created

* Merge remote-tracking branch 'upstream/master' into coyle/kad-tests

* wip

* add separate `Process` tests for bolt and redis-backed overlay

* more testing

* fix gitignore

* fix linter error

* goimports goimports GOIMPORTS GoImPortS!!!!

* wip

* fix port madness

* forgot to add

* add `mux` as handler and shorten context timeouts

* gofreakingimports

* fix comments

* refactor test & add logger/monkit registry

* debugging travis

* add comment

* Set redisAddress to empty string for bolt-test

* Merge remote-tracking branch 'upstream/master' into coyle/kad-tests

* Merge branch 'tls' into tls-upstream

* tls:
  add client cert
  refactor
  refactor; test improvements
  add TestNewServer_LoadTLS
  code-style auto-format
  code-style improvemente / refactor; service and tls tests passing!
  tls_test passing
  wip
  wip testing
  wip testing
  fix typo
  wip tls testing
  refactor, improve tests
  refactoring - still wip
  wip tests
  wip: transport security (add tests / refactor)
  wip initial transport security

* fixing linter things

* wip

* remove bkad dependencie from tests

* wip

* wip

* wip

* wip

* wip

* updated coyle/kademlia

* wip

* cleanup

* ports

* overlay upgraded

* linter fixes

* piecestore kademlia newID

* Merge branch 'master' into tls-upstream

* master:
  Add error to the return values of Ranger.Range method (#90)
  udp-forwarding: demo week work! (#84)

* Merge branch 'kad-tests' into tls-upstream

* kad-tests:
  piecestore kademlia newID
  linter fixes
  overlay upgraded
  ports
  cleanup
  wip
  updated coyle/kademlia
  wip
  wip
  wip
  wip
  wip
  remove bkad dependencie from tests
  wip
  wip
  files created
  port changes

* wip

* finish merging service tests

* add test for different client/server certs

* wip

* Merge branch 'master' into tls-upstream

* master:
  Add context to Ranger.Range method (#99)
  Coyle/kad client (#91)

* wip

* wip; refactoring/cleanup

* wip

* Merge branch 'master' into tls

* master:
  Bolt backed overlay cache (#94)
  internal/test: switch errors to error classes (#96)

* wip - test passing

* cleanup

* remove port.go

* cleanup

* Merge branch 'master' into tls

* master:
  hardcode version (#111)
  Coyle/docker fix (#109)
  pkg/kademlia tests and restructuring (#97)
  Use continue instead of return in table tests (#106)
  prepend storjlabs to docker tag (#108)
  Automatically build, tag and push docker images on merge to master (#103)

* more belated merging

* more belated merging

* more belated merging

* add copyrights

* cleanup

* goimports

* refactoring

* wip

* wip

* implement `TLSFileOptions#loadTLS`, refactoring:

`peertls.TestNewClient_LoadTLS` is the failing holdout; Still trying to figure out why I'm getting ECDSA verification is failing.

* not sure if actually working:

Tests are now passing (no more "ECDSA verification failed"); however,
`len(*tls.Certificates.Certificate) == 1` which I don't think should be
the case if the root and leaf are being created correctly.

* Experimenting/bugfixing?:

I think leaf certs should be properly signed by the parent now but not
entirely certain. It's also unclear to me why in
`VerifyPeerCertificate`, `len(rawCerts) == 1` when the certs should
contain both the root and leaf afaik.

* Properly write/read certificate chain (root/leaf):

I think I'm now properly reading and writing the root and leaf
certificate chain such that they're both being received by
`VerifyPeerCertificate`.

The next step is to parse the certificates with `x509.ParseCertificate`
(or similar) and verify that the public keys and signatures match.

* Add tls certificate chain signature veification (spike):

+ `VerifyPeerCertificate` verifies signatures of certificates using the
key of it's parent if there is one; otherwise, it verifies the
certificate is self-signed
+ TODO: refactor
+ TODO: test

* refactoring `VerifyPeerCertificate`

* cleanup

* refactor

* Merge branch 'master' into tls

* master:
  Remove some structural folders we don't seem to be using. (#125)
  license code with agplv3 (#126)
  Update .clabot (#124)
  added team memebers (#123)
  clabot file added (#121)
  ECClient (#110)
  docker image issue fixed (#118)
  Piecestore Farmer CLI  (#92)
  Define Path type (#101)
  adds netstate pagination (#95)
  Transport Client (#89)
  Implement psclient interface (#107)
  pkg/process: start replacing pkg/process with cobra helpers (#98)
  protos/netstate: remove stuff we're not using (#100)
  adding coveralls / code coverage  (#112)

* responding to review feedback / cleanup / add copywrite headers

* suggestions

* realitive

* Merge pull request #1 from coyle/coyle/tls

suggestions

* remove unnecessary `_`s

* Merge branch 'tls' of github.com:bryanchriswhite/storj into tls

* 'tls' of github.com:bryanchriswhite/storj:
  realitive
  suggestions

* Responding to review feedback:

+ refactor `VerifyPeerCertificate`

* remove tls expiration

* remove "hosts" and "clien option" from tls options

* goimports

* linter fixes
iglesiasbrandon pushed a commit that referenced this pull request Dec 7, 2018
* port changes

* Task monitor and setup merge from the staging

* Restructure + additional interface

* Add NewOverlayClient

* integrated DHT client interface

* added test for interface

* PR comments addressed

* lint issue

* added generated protobuf

* adding new interface

* added the interface framework

* deleted file

* fixes compilation errors and integrates new dhtcclient interface

* merged netstat latest changes and dht new interface chagnes

* fixed the address's port

* adding comments

* PR comments addressed

* netclient interface dial method added

* rename and integrated transportclient with minio gateway

* rename and code clean up

* made changes based on the Dennis's changes on the kad-client

* Code review comment changes based on kaloyan review comments

* reverted the changes to be similar to master

* removed unused file

* renamed to transportclient

* added the review changes

* store the address of the client

* updates per the code review comments, changes-> added error retry connection attempt logic, added error conditions including nil parameters

* updated the test case to test the bad address passed condition

* updated the code per code review comments

* Bolt backed overlay cache (#94)

* wip

* add separate `Process` tests for bolt and redis-backed overlay

* more testing

* fix gitignore

* fix linter error

* goimports goimports GOIMPORTS GoImPortS!!!!

* fix port madness

* forgot to add

* add `mux` as handler and shorten context timeouts

* gofreakingimports

* fix comments

* refactor test & add logger/monkit registry

* debugging travis

* add comment

* Set redisAddress to empty string for bolt-test

* travis experiment

* refactoring tests

* Merge remote-tracking branch 'upstream/master' into bolt-backed-overlay-cache

* Automatically build, tag and push docker images on merge to master (#103)

* port changes

* build overlay on successful merge to master

* fixes to Makefile

* permissions

* dep ensure

* gopath

* let's try vgo

* remove dep

* maybe alpine is the issue

* tagging go version on build

* stupid vgo

* vgo

* adding tags to push

* quotes

* local linting fixes & stupid travis

* prepend storjlabs to docker tag (#108)

* port changes

* fixing tag name

* Use continue instead of return in table tests (#106)

I did a dumb mistake for some of the table tests, which made some of the
test cases not being executed.

* pkg/kademlia tests and restructuring (#97)

* port changes

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* files created

* Merge remote-tracking branch 'upstream/master' into coyle/kad-tests

* wip

* Merge remote-tracking branch 'upstream/master' into coyle/kad-tests

* wip

* remove bkad dependencie from tests

* wip

* wip

* wip

* wip

* wip

* updated coyle/kademlia

* wip

* cleanup

* ports

* overlay upgraded

* linter fixes

* piecestore kademlia newID

* add changes from kad demo

* PR comments addresses

* go func

* force travis build

* fixed merge conflicts

* fixed merge conflicts

* Merge branch 'coyle/kad-tests' of https://github.com/coyle/storj into coyle/kad-tests

* linter issues

* linting issues

* fixed merge conflicts

* linter is stupid

* Coyle/docker fix (#109)

* port changes

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* Merge branch 'master' of https://github.com/storj/storj

* fixing tag name

* no idea

* testing

* changes

* testing on travis

* testing

* changes to travis build

* new approach

* Merge branch 'master' into coyle/docker-fix

* hardcode version (#111)

* hardcode version

* adding coveralls / code coverage  (#112)

* adding coveralls

* adding code coverage badge

* fixing badges

* verbose

* swap tests and coverage

* extra line

* maybe

* maybe

* moar

* gover maybe

* testing

* cleanup

* protos/netstate: remove stuff we're not using (#100)

* protos/netstate: remove stuff we're not using

* protos/netstate: add metadata field for segmentstore

* fix netstate client test

* pkg/process: start replacing pkg/process with cobra helpers (#98)

* Implement psclient interface (#107)

* Implement psclient interface

* Add string method to pieceID type

* try to fix linter errors

* Whoops missed an error

* More linter errors

* Typo

* Lol double typo

*  Get everything working, begin adding tests for psclient rpc

* goimports

* Forgot to change the piecestore cli when changed the piecestore code

* Fix CLI

* remove ID length, added validator to pieceID

* Move grpc ranger to client
Change client PUT api to take a reader rather than return a writer

* GRPCRanger -> PieceRanger; Make PieceRanger a RangeCloser

* Forgot to remove offset

* Added message upon successful store

* Do that thing dennis and kaloyan wanted

* goimports

* Make closeConn a part of the interface for psclient

* Use interface

* Removed uneccessary new lines

* goimport

* Whoops

* Actually we don't want to use the interface in Piece Ranger

* Renamed piecestore in examples to piecestore-client; moved piecestore-cli to examples

* Make comments look nicer

* modified transport client based on the the design discussion

* modified transport client based on the the design discussion

* added the as discussed connection cache interface functionality

* added the as discussed connection cache interface functionality

* transport client changes

* transport client per code review changes

* per the code review comments

* transport client incorporates review comments

* fixes lint warnings

* lint warning fixes....client interface has to be Client

* client.go changes

* transport.go changes

* added test case

* added test cases

* comment fix

* comment fix
iglesiasbrandon pushed a commit that referenced this pull request Dec 7, 2018
* wip initial transport security

* wip: transport security (add tests / refactor)

* wip tests

* refactoring - still wip

* refactor, improve tests

* wip tls testing

* fix typo

* wip testing

* wip testing

* wip

* tls_test passing

* code-style improvemente / refactor; service and tls tests passing!

* code-style auto-format

* add TestNewServer_LoadTLS

* refactor; test improvements

* refactor

* add client cert

* port changes

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* Merge remote-tracking branch 'upstream/master'

* files created

* Merge remote-tracking branch 'upstream/master' into coyle/kad-tests

* wip

* add separate `Process` tests for bolt and redis-backed overlay

* more testing

* fix gitignore

* fix linter error

* goimports goimports GOIMPORTS GoImPortS!!!!

* wip

* fix port madness

* forgot to add

* add `mux` as handler and shorten context timeouts

* gofreakingimports

* fix comments

* refactor test & add logger/monkit registry

* debugging travis

* add comment

* Set redisAddress to empty string for bolt-test

* Merge remote-tracking branch 'upstream/master' into coyle/kad-tests

* Merge branch 'tls' into tls-upstream

* tls:
  add client cert
  refactor
  refactor; test improvements
  add TestNewServer_LoadTLS
  code-style auto-format
  code-style improvemente / refactor; service and tls tests passing!
  tls_test passing
  wip
  wip testing
  wip testing
  fix typo
  wip tls testing
  refactor, improve tests
  refactoring - still wip
  wip tests
  wip: transport security (add tests / refactor)
  wip initial transport security

* fixing linter things

* wip

* remove bkad dependencie from tests

* wip

* wip

* wip

* wip

* wip

* updated coyle/kademlia

* wip

* cleanup

* ports

* overlay upgraded

* linter fixes

* piecestore kademlia newID

* Merge branch 'master' into tls-upstream

* master:
  Add error to the return values of Ranger.Range method (#90)
  udp-forwarding: demo week work! (#84)

* Merge branch 'kad-tests' into tls-upstream

* kad-tests:
  piecestore kademlia newID
  linter fixes
  overlay upgraded
  ports
  cleanup
  wip
  updated coyle/kademlia
  wip
  wip
  wip
  wip
  wip
  remove bkad dependencie from tests
  wip
  wip
  files created
  port changes

* wip

* finish merging service tests

* add test for different client/server certs

* wip

* Merge branch 'master' into tls-upstream

* master:
  Add context to Ranger.Range method (#99)
  Coyle/kad client (#91)

* wip

* wip; refactoring/cleanup

* wip

* Merge branch 'master' into tls

* master:
  Bolt backed overlay cache (#94)
  internal/test: switch errors to error classes (#96)

* wip - test passing

* cleanup

* remove port.go

* cleanup

* Merge branch 'master' into tls

* master:
  hardcode version (#111)
  Coyle/docker fix (#109)
  pkg/kademlia tests and restructuring (#97)
  Use continue instead of return in table tests (#106)
  prepend storjlabs to docker tag (#108)
  Automatically build, tag and push docker images on merge to master (#103)

* more belated merging

* more belated merging

* more belated merging

* add copyrights

* cleanup

* goimports

* refactoring

* wip

* wip

* implement `TLSFileOptions#loadTLS`, refactoring:

`peertls.TestNewClient_LoadTLS` is the failing holdout; Still trying to figure out why I'm getting ECDSA verification is failing.

* not sure if actually working:

Tests are now passing (no more "ECDSA verification failed"); however,
`len(*tls.Certificates.Certificate) == 1` which I don't think should be
the case if the root and leaf are being created correctly.

* Experimenting/bugfixing?:

I think leaf certs should be properly signed by the parent now but not
entirely certain. It's also unclear to me why in
`VerifyPeerCertificate`, `len(rawCerts) == 1` when the certs should
contain both the root and leaf afaik.

* Properly write/read certificate chain (root/leaf):

I think I'm now properly reading and writing the root and leaf
certificate chain such that they're both being received by
`VerifyPeerCertificate`.

The next step is to parse the certificates with `x509.ParseCertificate`
(or similar) and verify that the public keys and signatures match.

* Add tls certificate chain signature veification (spike):

+ `VerifyPeerCertificate` verifies signatures of certificates using the
key of it's parent if there is one; otherwise, it verifies the
certificate is self-signed
+ TODO: refactor
+ TODO: test

* refactoring `VerifyPeerCertificate`

* cleanup

* refactor

* Merge branch 'master' into tls

* master:
  Remove some structural folders we don't seem to be using. (#125)
  license code with agplv3 (#126)
  Update .clabot (#124)
  added team memebers (#123)
  clabot file added (#121)
  ECClient (#110)
  docker image issue fixed (#118)
  Piecestore Farmer CLI  (#92)
  Define Path type (#101)
  adds netstate pagination (#95)
  Transport Client (#89)
  Implement psclient interface (#107)
  pkg/process: start replacing pkg/process with cobra helpers (#98)
  protos/netstate: remove stuff we're not using (#100)
  adding coveralls / code coverage  (#112)

* responding to review feedback / cleanup / add copywrite headers

* suggestions

* realitive

* Merge pull request #1 from coyle/coyle/tls

suggestions

* remove unnecessary `_`s

* Merge branch 'tls' of github.com:bryanchriswhite/storj into tls

* 'tls' of github.com:bryanchriswhite/storj:
  realitive
  suggestions

* Responding to review feedback:

+ refactor `VerifyPeerCertificate`

* remove tls expiration

* remove "hosts" and "clien option" from tls options

* goimports

* linter fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants