From 0ea41eaa51314fca8fa9b9d89f449901e2f86bae Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 28 Apr 2023 01:45:15 +0200 Subject: [PATCH] libnetwork/osl: unify stubs for IfaceOption Use the same signature for all platforms, but stub the nwIface type. Signed-off-by: Sebastiaan van Stijn --- libnetwork/osl/interface_freebsd.go | 4 ---- libnetwork/osl/interface_linux.go | 3 --- libnetwork/osl/interface_unsupported.go | 6 ++++++ libnetwork/osl/interface_windows.go | 4 ---- libnetwork/osl/sandbox.go | 3 +++ 5 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 libnetwork/osl/interface_freebsd.go create mode 100644 libnetwork/osl/interface_unsupported.go delete mode 100644 libnetwork/osl/interface_windows.go diff --git a/libnetwork/osl/interface_freebsd.go b/libnetwork/osl/interface_freebsd.go deleted file mode 100644 index 9c0141fd9b..0000000000 --- a/libnetwork/osl/interface_freebsd.go +++ /dev/null @@ -1,4 +0,0 @@ -package osl - -// IfaceOption is a function option type to set interface options -type IfaceOption func() diff --git a/libnetwork/osl/interface_linux.go b/libnetwork/osl/interface_linux.go index 561e7fc7e0..ee1b4ab842 100644 --- a/libnetwork/osl/interface_linux.go +++ b/libnetwork/osl/interface_linux.go @@ -14,9 +14,6 @@ import ( "github.com/vishvananda/netns" ) -// IfaceOption is a function option type to set interface options -type IfaceOption func(i *nwIface) - type nwIface struct { srcName string dstName string diff --git a/libnetwork/osl/interface_unsupported.go b/libnetwork/osl/interface_unsupported.go new file mode 100644 index 0000000000..55a6ae73f1 --- /dev/null +++ b/libnetwork/osl/interface_unsupported.go @@ -0,0 +1,6 @@ +//go:build !linux +// +build !linux + +package osl + +type nwIface struct{} diff --git a/libnetwork/osl/interface_windows.go b/libnetwork/osl/interface_windows.go deleted file mode 100644 index 9c0141fd9b..0000000000 --- a/libnetwork/osl/interface_windows.go +++ /dev/null @@ -1,4 +0,0 @@ -package osl - -// IfaceOption is a function option type to set interface options -type IfaceOption func() diff --git a/libnetwork/osl/sandbox.go b/libnetwork/osl/sandbox.go index 52117a4c05..f9448212c6 100644 --- a/libnetwork/osl/sandbox.go +++ b/libnetwork/osl/sandbox.go @@ -17,6 +17,9 @@ const ( SandboxTypeLoadBalancer = iota ) +// IfaceOption is a function option type to set interface options. +type IfaceOption func(i *nwIface) + // 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 {