Unverified Commit a07ef434 authored by Matt Joiner's avatar Matt Joiner Committed by GitHub

Add badges, fix spello, and test unresolvable dials (#68)

Add badges, fix spello, and test unresolvable dials
parent d779e4e5
# 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.
......
......@@ -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)
......
// +build !go1.11
"go-reuseport requires go >= 1.11"
;
......@@ -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)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment