From 8142051a3b244f514ba05bc6b9a93efe45c0087f Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 28 Apr 2023 09:34:42 +0200 Subject: [PATCH] libnetwork/osl: unify stubs for NeighOption Use the same signature for all platforms, but stub the neigh type. Signed-off-by: Sebastiaan van Stijn --- libnetwork/osl/neigh_freebsd.go | 4 ---- libnetwork/osl/neigh_linux.go | 3 --- libnetwork/osl/neigh_unsupported.go | 6 ++++++ libnetwork/osl/neigh_windows.go | 4 ---- libnetwork/osl/sandbox.go | 3 +++ 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 libnetwork/osl/neigh_freebsd.go create mode 100644 libnetwork/osl/neigh_unsupported.go delete mode 100644 libnetwork/osl/neigh_windows.go diff --git a/libnetwork/osl/neigh_freebsd.go b/libnetwork/osl/neigh_freebsd.go deleted file mode 100644 index 280f006396..0000000000 --- a/libnetwork/osl/neigh_freebsd.go +++ /dev/null @@ -1,4 +0,0 @@ -package osl - -// NeighOption is a function option type to set neighbor options -type NeighOption func() diff --git a/libnetwork/osl/neigh_linux.go b/libnetwork/osl/neigh_linux.go index 7105bf6dde..e46b12a89f 100644 --- a/libnetwork/osl/neigh_linux.go +++ b/libnetwork/osl/neigh_linux.go @@ -20,9 +20,6 @@ func (n NeighborSearchError) Error() string { return fmt.Sprintf("Search neighbor failed for IP %v, mac %v, present in db:%t", n.ip, n.mac, n.present) } -// NeighOption is a function option type to set interface options -type NeighOption func(nh *neigh) - type neigh struct { dstIP net.IP dstMac net.HardwareAddr diff --git a/libnetwork/osl/neigh_unsupported.go b/libnetwork/osl/neigh_unsupported.go new file mode 100644 index 0000000000..6d2f285698 --- /dev/null +++ b/libnetwork/osl/neigh_unsupported.go @@ -0,0 +1,6 @@ +//go:build !linux +// +build !linux + +package osl + +type neigh struct{} diff --git a/libnetwork/osl/neigh_windows.go b/libnetwork/osl/neigh_windows.go deleted file mode 100644 index 280f006396..0000000000 --- a/libnetwork/osl/neigh_windows.go +++ /dev/null @@ -1,4 +0,0 @@ -package osl - -// NeighOption is a function option type to set neighbor options -type NeighOption func() diff --git a/libnetwork/osl/sandbox.go b/libnetwork/osl/sandbox.go index f9448212c6..84833167e6 100644 --- a/libnetwork/osl/sandbox.go +++ b/libnetwork/osl/sandbox.go @@ -20,6 +20,9 @@ const ( // IfaceOption is a function option type to set interface options. type IfaceOption func(i *nwIface) +// NeighOption is a function option type to set neighbor options. +type NeighOption func(nh *neigh) + // Sandbox represents a network sandbox, identified by a specific key. It // holds a list of Interfaces, routes etc, and more can be added dynamically. type Sandbox interface {