Skip to content

Commit

Permalink
Use peer.ID.Validate
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Aug 14, 2024
1 parent 0c698e6 commit 1dc65df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ generate: tidy
# Some packages are excluded from staticcheck due to deprecated warnings: #208.
lint: tidy
# Coding style static check.
@go install honnef.co/go/tools/cmd/staticcheck@latest
@go install honnef.co/go/tools/cmd/staticcheck@v0.4.7
staticcheck `go list ./... | grep -Ev "(go\.dedis\.ch/dela/internal/testing|go\.dedis\.ch/dela/mino/minogrpc/ptypes)"`

vet: tidy
Expand Down Expand Up @@ -54,4 +54,4 @@ coverage: tidy
pushdoc:
@echo "Requesting the proxy..."
@curl "https://proxy.golang.org/go.dedis.ch/dela/@v/$(shell git log origin/master -1 --format=format:%H).info"
@echo "\nDone."
@echo "\nDone."
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.21
require (
github.com/golang/protobuf v1.5.4
github.com/libp2p/go-libp2p v0.36.1
github.com/libp2p/go-yamux/v4 v4.0.1
github.com/multiformats/go-multiaddr v0.13.0
github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e
github.com/opentracing/opentracing-go v1.2.0
Expand Down Expand Up @@ -62,7 +63,6 @@ require (
github.com/libp2p/go-nat v0.2.0 // indirect
github.com/libp2p/go-netroute v0.2.1 // indirect
github.com/libp2p/go-reuseport v0.4.0 // indirect
github.com/libp2p/go-yamux/v4 v4.0.1 // indirect
github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
Expand Down
10 changes: 8 additions & 2 deletions mino/minows/address.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ type address struct {
// newAddress creates a new address from a publicly reachable location with a
// peer identity.
func newAddress(location ma.Multiaddr, identity peer.ID) (address, error) {
if location == nil || identity.String() == "" {
return address{}, xerrors.New("address must have location and identity")
if location == nil {
return address{}, xerrors.New("address must have a location")
}

err := identity.Validate()
if err != nil {
return address{}, xerrors.Errorf("address must have a valid identity: %v", err)
}

return address{
location: location,
identity: identity,
Expand Down

0 comments on commit 1dc65df

Please sign in to comment.