From 39b95cc365a36b82aaaf75c96bc6c9e08adf3468 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Tue, 30 Oct 2018 07:38:04 -0700 Subject: [PATCH] virtcontainers: Create a new package "types" Instead of relying on the kata agent to define generic structures, the logic is to define those as virtcontainers "types" package. This way, all consumers of those structures, such as kata-runtime, kata-netmon, and kata-containerd-shim, don't have to import some dependency from the kata-agent. Fixes #876 Signed-off-by: Sebastien Boeuf --- virtcontainers/pkg/types/types.go | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 virtcontainers/pkg/types/types.go diff --git a/virtcontainers/pkg/types/types.go b/virtcontainers/pkg/types/types.go new file mode 100644 index 0000000000..9fd0b201a4 --- /dev/null +++ b/virtcontainers/pkg/types/types.go @@ -0,0 +1,40 @@ +// Copyright 2018 Intel Corporation. +// +// SPDX-License-Identifier: Apache-2.0 +// + +package types + +// IPAddress describes an IP address. +type IPAddress struct { + Family int + Address string + Mask string +} + +// Interface describes a network interface. +type Interface struct { + Device string + Name string + IPAddresses []*IPAddress + Mtu uint64 + HwAddr string + // pciAddr is the PCI address in the format "bridgeAddr/deviceAddr". + // Here, bridgeAddr is the address at which the bridge is attached on the root bus, + // while deviceAddr is the address at which the network device is attached on the bridge. + PciAddr string + // LinkType defines the type of interface described by this structure. + // The expected values are the one that are defined by the netlink + // library, regarding each type of link. Here is a non exhaustive + // list: "veth", "macvtap", "vlan", "macvlan", "tap", ... + LinkType string +} + +// Route describes a network route. +type Route struct { + Dest string + Gateway string + Device string + Source string + Scope uint32 +}