From: Shengjing Zhu Date: Sun, 10 Oct 2021 22:06:27 +0800 Subject: Add old interfaces Forwarded: not-needed --- pkg/types/020/deprecated.go | 3 +++ pkg/types/current/types.go | 31 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 pkg/types/020/deprecated.go create mode 100644 pkg/types/current/types.go diff --git a/pkg/types/020/deprecated.go b/pkg/types/020/deprecated.go new file mode 100644 index 0000000..642b57b --- /dev/null +++ b/pkg/types/020/deprecated.go @@ -0,0 +1,3 @@ +package types020 + +var SupportedVersions = supportedVersions diff --git a/pkg/types/current/types.go b/pkg/types/current/types.go new file mode 100644 index 0000000..0611e3a --- /dev/null +++ b/pkg/types/current/types.go @@ -0,0 +1,31 @@ +package current + +import ( + "github.com/containernetworking/cni/pkg/types" + types020 "github.com/containernetworking/cni/pkg/types/020" + types040 "github.com/containernetworking/cni/pkg/types/040" +) + +const ImplementedSpecVersion = types040.ImplementedSpecVersion + +var ( + NewResult = types040.NewResult + GetResult = types040.GetResult + Int = types040.Int +) + +type ( + Result = types040.Result + Interface = types040.Interface + IPConfig = types040.IPConfig +) + +func NewResultFromResult(result types.Result) (*Result, error) { + if result.Version() == "" { + switch r := result.(type) { + case *types020.Result: + r.CNIVersion = "0.1.0" + } + } + return types040.NewResultFromResult(result) +}