From a9779987474eba673d7faabdbd6cf3571f80e872 Mon Sep 17 00:00:00 2001 From: Chris O'Haver Date: Mon, 16 Aug 2021 11:57:26 -0400 Subject: [PATCH] Revert "pkg/reuseport: Remove pre-go1.11 impl (#4795)" (#4814) This reverts commit 4a34e8b8979f23a77000ad6580051b06d2e97508. --- plugin/pkg/reuseport/{listen.go => listen_go111.go} | 3 +++ plugin/pkg/reuseport/listen_go_not111.go | 13 +++++++++++++ 2 files changed, 16 insertions(+) rename plugin/pkg/reuseport/{listen.go => listen_go111.go} (93%) create mode 100644 plugin/pkg/reuseport/listen_go_not111.go 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) +}