runtime: consolidate types definition

We do not need the vc types translation for network data structures.
Just use the protocol buffer definitions.

Fixes: #415
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao
2020-07-15 14:46:36 +08:00
parent b0e5e12a08
commit 5b15e9ef4f
18 changed files with 171 additions and 362 deletions

View File

@@ -13,6 +13,10 @@ import (
"os"
"os/exec"
"path/filepath"
"github.com/vishvananda/netlink"
pbTypes "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols"
)
const cpBinaryName = "cp"
@@ -318,3 +322,14 @@ func (p *ProgramLogger) StartLogger(output io.ReadCloser) error {
func (p ProgramLogger) String() string {
return p.cmd.Path
}
func ConvertNetlinkFamily(netlinkFamily int32) pbTypes.IPFamily {
switch netlinkFamily {
case netlink.FAMILY_V6:
return pbTypes.IPFamily_v6
case netlink.FAMILY_V4:
fallthrough
default:
return pbTypes.IPFamily_v4
}
}