diff --git a/plugin/pkg/reuseport/listen.go b/plugin/pkg/reuseport/listen_go111.go similarity index 93% rename from plugin/pkg/reuseport/listen.go rename to plugin/pkg/reuseport/listen_go111.go index c15cdb34f..fa6f365d6 100644 --- a/plugin/pkg/reuseport/listen.go +++ b/plugin/pkg/reuseport/listen_go111.go @@ -1,3 +1,6 @@ +// +build go1.11 +// +build aix darwin dragonfly freebsd linux netbsd openbsd + package reuseport import ( diff --git a/plugin/pkg/reuseport/listen_go_not111.go b/plugin/pkg/reuseport/listen_go_not111.go new file mode 100644 index 000000000..e3bdfb906 --- /dev/null +++ b/plugin/pkg/reuseport/listen_go_not111.go @@ -0,0 +1,13 @@ +// +build !go1.11 !aix,!darwin,!dragonfly,!freebsd,!linux,!netbsd,!openbsd + +package reuseport + +import "net" + +// Listen is a wrapper around net.Listen. +func Listen(network, addr string) (net.Listener, error) { return net.Listen(network, addr) } + +// ListenPacket is a wrapper around net.ListenPacket. +func ListenPacket(network, addr string) (net.PacketConn, error) { + return net.ListenPacket(network, addr) +}