diff --git a/README.md b/README.md index 1db5ae5b14f749cf3b24e181e78f81f77797b73f..4a4605ba11f807c4668d1c8ed8de8853320fcb4c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # go-reuseport -[![travisbadge](https://travis-ci.org/libp2p/go-reuseport.svg)](https://travis-ci.org/libp2p/go-reuseport) +[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](https://protocol.ai) +[![](https://img.shields.io/badge/project-libp2p-blue.svg?style=flat-square)](https://libp2p.io/) +[![](https://img.shields.io/badge/freenode-%23libp2p-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23libp2p) +[![codecov](https://codecov.io/gh/libp2p/go-reuseport/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-reuseport) +[![Travis CI](https://travis-ci.org/libp2p/go-reuseport.svg?branch=master)](https://travis-ci.org/libp2p/go-reuseport) **NOTE:** This package REQUIRES go >= 1.11. diff --git a/interface.go b/interface.go index 381710a2a8ded627c6ac69717635076ce5603711..64b48af8fc58029158347ade9a819dfda06c8f0d 100644 --- a/interface.go +++ b/interface.go @@ -49,7 +49,7 @@ func ListenPacket(network, address string) (net.PacketConn, error) { } // Dial dials the given network and address. see net.Dialer.Dial -// Returns a net.Conn created from a file discriptor for a socket +// Returns a net.Conn created from a file descriptor for a socket // with SO_REUSEPORT and SO_REUSEADDR option set. func Dial(network, laddr, raddr string) (net.Conn, error) { nla, err := ResolveAddr(network, laddr) diff --git a/old_go_warning.go b/old_go_warning.go deleted file mode 100644 index 835d53c28f8be9e387171e4ec02cbeff85a11d26..0000000000000000000000000000000000000000 --- a/old_go_warning.go +++ /dev/null @@ -1,6 +0,0 @@ -// +build !go1.11 - -"go-reuseport requires go >= 1.11" - -; - diff --git a/reuse_test.go b/reuse_test.go index a7ca69d155483388a556fc7492ce1d9e49d86745..883f89e8cfe77ba52a5a22c59e65c80560871932 100644 --- a/reuse_test.go +++ b/reuse_test.go @@ -6,6 +6,9 @@ import ( "strings" "testing" + "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) @@ -43,3 +46,10 @@ func TestListenPacketWildcardAddress(t *testing.T) { require.NoError(t, err) pc.Close() } + +func TestErrorWhenDialUnresolvable(t *testing.T) { + _, err := Dial("asd", "127.0.0.1:1234", "127.0.0.1:1234") + assert.IsType(t, net.UnknownNetworkError(""), errors.Cause(err)) + _, err = Dial("tcp", "a.b.c.d:1234", "a.b.c.d:1235") + assert.Error(t, err) +}