From 358949b03052dbeefa29c271ff98c0bc4e66d226 Mon Sep 17 00:00:00 2001 From: Kifen Date: Fri, 6 Mar 2020 16:10:02 +0000 Subject: [PATCH 1/2] check for empty public key --- pkg/app/appnet/skywire_networker.go | 8 +++++++- vendor/modules.txt | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/app/appnet/skywire_networker.go b/pkg/app/appnet/skywire_networker.go index 4bf78bc5f5..eedfcf619c 100644 --- a/pkg/app/appnet/skywire_networker.go +++ b/pkg/app/appnet/skywire_networker.go @@ -3,6 +3,7 @@ package appnet import ( "context" "errors" + "fmt" "io" "net" "strings" @@ -50,7 +51,12 @@ func (r *SkywireNetworker) DialContext(ctx context.Context, addr Addr) (net.Conn return nil, err } - rg, err := r.r.DialRoutes(ctx, addr.PubKey, routing.Port(localPort), addr.Port, router.DefaultDialOptions()) + rPK := addr.PubKey + if rPK.Null() { + return nil, fmt.Errorf("Empty public key: %s", rPK) + } + + rg, err := r.r.DialRoutes(ctx, rPK, routing.Port(localPort), addr.Port, router.DefaultDialOptions()) if err != nil { return nil, err } diff --git a/vendor/modules.txt b/vendor/modules.txt index f854256bb5..c471287f1f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/SkycoinProject/dmsg v0.0.0-20200306131535-fabb2c8177e9 +# github.com/SkycoinProject/dmsg v0.0.0-20200306131535-fabb2c8177e9 => ../dmsg github.com/SkycoinProject/dmsg github.com/SkycoinProject/dmsg/cipher github.com/SkycoinProject/dmsg/disc From 22056bf65e34f873ec672a556989452fe4412f00 Mon Sep 17 00:00:00 2001 From: Kifen Date: Fri, 6 Mar 2020 17:00:59 +0000 Subject: [PATCH 2/2] refactor error --- pkg/app/appnet/skywire_networker.go | 3 +-- vendor/modules.txt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/app/appnet/skywire_networker.go b/pkg/app/appnet/skywire_networker.go index eedfcf619c..2eb2bf1769 100644 --- a/pkg/app/appnet/skywire_networker.go +++ b/pkg/app/appnet/skywire_networker.go @@ -3,7 +3,6 @@ package appnet import ( "context" "errors" - "fmt" "io" "net" "strings" @@ -53,7 +52,7 @@ func (r *SkywireNetworker) DialContext(ctx context.Context, addr Addr) (net.Conn rPK := addr.PubKey if rPK.Null() { - return nil, fmt.Errorf("Empty public key: %s", rPK) + return nil, errors.New("cannot dial to address with empty public key") } rg, err := r.r.DialRoutes(ctx, rPK, routing.Port(localPort), addr.Port, router.DefaultDialOptions()) diff --git a/vendor/modules.txt b/vendor/modules.txt index c471287f1f..235412ac1f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/SkycoinProject/dmsg v0.0.0-20200306131535-fabb2c8177e9 => ../dmsg +# github.com/SkycoinProject/dmsg v0.0.0-20200306152741-acee74fa4514 github.com/SkycoinProject/dmsg github.com/SkycoinProject/dmsg/cipher github.com/SkycoinProject/dmsg/disc