@@ -14,6 +14,33 @@ import (
1414 "github.com/rootless-containers/rootlesskit/v3/pkg/network"
1515)
1616
17+ // Features is defined to satisfy references from cmd when the slirp4netns
18+ // network driver is disabled via the no_slirp4netns build tag.
19+ // It mirrors the shape of the real Features struct.
20+ type Features struct {
21+ // SupportsEnableIPv6 --enable-ipv6 (v0.2.0)
22+ SupportsEnableIPv6 bool
23+ // SupportsCIDR --cidr (v0.3.0)
24+ SupportsCIDR bool
25+ // SupportsDisableHostLoopback --disable-host-loopback (v0.3.0)
26+ SupportsDisableHostLoopback bool
27+ // SupportsAPISocket --api-socket (v0.3.0)
28+ SupportsAPISocket bool
29+ // SupportsEnableSandbox --enable-sandbox (v0.4.0)
30+ SupportsEnableSandbox bool
31+ // SupportsEnableSeccomp --enable-seccomp (v0.4.0)
32+ SupportsEnableSeccomp bool
33+ // KernelSupportsEnableSeccomp whether the kernel supports slirp4netns --enable-seccomp
34+ KernelSupportsEnableSeccomp bool
35+ }
36+
37+ // DetectFeatures is a stub used when the slirp4netns network driver is
38+ // disabled via the no_slirp4netns build tag. It always returns an error so
39+ // callers can gracefully handle the lack of support at runtime.
40+ func DetectFeatures (binary string ) (* Features , error ) {
41+ return nil , errors .New ("slirp4netns network driver disabled by build tag no_slirp4netns" )
42+ }
43+
1744// NewParentDriver returns a stub when built with the no_slirp4netns tag.
1845func NewParentDriver (logWriter io.Writer , binary string , mtu int , ipnet * net.IPNet , ifname string , disableHostLoopback bool , apiSocketPath string , enableSandbox bool , enableSeccomp bool , enableIPv6 bool ) (network.ParentDriver , error ) {
1946 return & disabledParent {}, errors .New ("slirp4netns network driver disabled by build tag no_slirp4netns" )
0 commit comments