@@ -23,7 +23,7 @@ import (
2323 containerd "github.com/containerd/containerd/v2/client"
2424 "github.com/containerd/containerd/v2/pkg/netns"
2525 "github.com/containerd/containerd/v2/pkg/oci"
26- gocni "github.com/containerd/go-cni"
26+ "github.com/containerd/go-cni"
2727
2828 "github.com/containerd/nerdctl/v2/pkg/api/types"
2929 "github.com/containerd/nerdctl/v2/pkg/netutil"
@@ -66,26 +66,26 @@ func (m *cniNetworkManager) VerifyNetworkOptions(_ context.Context) error {
6666 return nil
6767}
6868
69- func (m * cniNetworkManager ) getCNI () (gocni .CNI , error ) {
69+ func (m * cniNetworkManager ) getCNI () (cni .CNI , error ) {
7070 e , err := netutil .NewCNIEnv (m .globalOptions .CNIPath , m .globalOptions .CNINetConfPath , netutil .WithNamespace (m .globalOptions .Namespace ), netutil .WithDefaultNetwork (m .globalOptions .BridgeIP ))
7171 if err != nil {
7272 return nil , fmt .Errorf ("failed to instantiate CNI env: %s" , err )
7373 }
7474
75- cniOpts := []gocni .Opt {
76- gocni .WithPluginDir ([]string {m .globalOptions .CNIPath }),
77- gocni .WithPluginConfDir (m .globalOptions .CNINetConfPath ),
75+ cniOpts := []cni .Opt {
76+ cni .WithPluginDir ([]string {m .globalOptions .CNIPath }),
77+ cni .WithPluginConfDir (m .globalOptions .CNINetConfPath ),
7878 }
7979
8080 if netMap , err := verifyNetworkTypes (e , m .netOpts .NetworkSlice , nil ); err == nil {
8181 for _ , netConf := range netMap {
82- cniOpts = append (cniOpts , gocni .WithConfListBytes (netConf .Bytes ))
82+ cniOpts = append (cniOpts , cni .WithConfListBytes (netConf .Bytes ))
8383 }
8484 } else {
8585 return nil , err
8686 }
8787
88- return gocni .New (cniOpts ... )
88+ return cni .New (cniOpts ... )
8989}
9090
9191// Performs setup actions required for the container with the given ID.
@@ -171,26 +171,26 @@ func (m *cniNetworkManager) setupNetNs() (*netns.NetNS, error) {
171171 return ns , err
172172}
173173
174- // Returns the []gocni .NamespaceOpts to be used for CNI setup/teardown.
175- func (m * cniNetworkManager ) getCNINamespaceOpts () []gocni .NamespaceOpts {
176- opts := []gocni .NamespaceOpts {
177- gocni .WithLabels (map [string ]string {
174+ // Returns the []cni .NamespaceOpts to be used for CNI setup/teardown.
175+ func (m * cniNetworkManager ) getCNINamespaceOpts () []cni .NamespaceOpts {
176+ opts := []cni .NamespaceOpts {
177+ cni .WithLabels (map [string ]string {
178178 // allow loose CNI argument verification
179179 // FYI: https://github.com/containernetworking/cni/issues/560
180180 "IgnoreUnknown" : "1" ,
181181 }),
182182 }
183183
184184 if m .netOpts .MACAddress != "" {
185- opts = append (opts , gocni .WithArgs ("MAC" , m .netOpts .MACAddress ))
185+ opts = append (opts , cni .WithArgs ("MAC" , m .netOpts .MACAddress ))
186186 }
187187
188188 if m .netOpts .IPAddress != "" {
189- opts = append (opts , gocni .WithArgs ("IP" , m .netOpts .IPAddress ))
189+ opts = append (opts , cni .WithArgs ("IP" , m .netOpts .IPAddress ))
190190 }
191191
192192 if m .netOpts .PortMappings != nil {
193- opts = append (opts , gocni .WithCapabilityPortMap (m .netOpts .PortMappings ))
193+ opts = append (opts , cni .WithCapabilityPortMap (m .netOpts .PortMappings ))
194194 }
195195
196196 return opts
0 commit comments