func (c *libcni) createResult(results []*types100.Result) (*Result, error) {
	c.RLock()
	defer c.RUnlock()
	r := &Result{
		Interfaces: make(map[string]*Config),
		raw:        results,
	}
	r.Interfaces[defaultInterface(c.prefix)] = &Config{}
	for _, result := range results {
		for _, intf := range result.Interfaces {
			r.Interfaces[intf.Name] = &Config{
				Mac:     intf.Mac,
				Sandbox: intf.Sandbox,
			}
		}
		for _, ipConf := range result.IPs {
			if err := validateInterfaceConfig(ipConf, len(result.Interfaces)); err != nil {
				return nil, fmt.Errorf("invalid interface config: %v: %w", err, ErrInvalidResult)
			}
			name := c.getInterfaceName(result.Interfaces, ipConf)
			r.Interfaces[name].IPConfigs = append(r.Interfaces[name].IPConfigs,
				&IPConfig{IP: ipConf.Address.IP, Gateway: ipConf.Gateway})
		}
		r.DNS = append(r.DNS, result.DNS)
		r.Routes = append(r.Routes, result.Routes...)
	}
	if _, ok := r.Interfaces[defaultInterface(c.prefix)]; !ok {
		return nil, fmt.Errorf("default network not found for: %s: %w", defaultInterface(c.prefix), ErrNotFound)
	}
	return r, nil
}
createResult creates a Result from the given slice of types100.Result, adding
structured data containing the interface configuration for each of the
interfaces created in the namespace. It returns an error if validation of
results fails, or if a network could not be found.
package cni
import (
	"fmt"
	"net"
	"github.com/containernetworking/cni/pkg/types"
	types100 "github.com/containernetworking/cni/pkg/types/100"
)
type IPConfig struct {
	IP      net.IP
	Gateway net.IP
}
type Result struct {
	Interfaces map[string]*Config
	DNS        []types.DNS
	Routes     []*types.Route
	raw        []*types100.Result
}
func (r *Result) Raw() []*types100.Result {
	return r.raw
}
type Config struct {
	IPConfigs []*IPConfig
	Mac       string
	Sandbox   string
}