func (c *DNSConfig) Validate() error {
	if c == nil {
		return errors.New(DNSConfigShouldNotBeNil)
	}
	if len(c.DnsServerIps) == 0 {
		return errors.New(DNSServerIpsShouldHaveRecords)
	}
	return nil
}
Validate - checks DNSConfig and returns error if DNSConfig is not valid
package connectioncontext
import (
	"net"
	"github.com/pkg/errors"
)
func (c *ConnectionContext) IsEthernetContextEmtpy() bool {
	return c.EthernetContext == nil || (c.EthernetContext.SrcMac == "" && c.EthernetContext.DstMac == "")
}
func (c *ConnectionContext) IsValid() error {
	if c == nil {
		return errors.New("ConnectionContext should not be nil")
	}
	ip := c.GetIpContext()
	for _, route := range append(ip.GetSrcRoutes(), ip.GetDstRoutes()...) {
		if route.GetPrefix() == "" {
			return errors.Errorf("ConnectionContext.Route.Prefix is required and cannot be empty/nil: %v", ip)
		}
		_, _, err := net.ParseCIDR(route.GetPrefix())
		if err != nil {
			return errors.Errorf("ConnectionContext.Route.Prefix should be a valid CIDR address: %v", ip)
		}
	}
	for _, neighbor := range ip.GetIpNeighbors() {
		if neighbor.GetIp() == "" {
			return errors.Errorf("ConnectionContext.IpNeighbors.Ip is required and cannot be empty/nil: %v", ip)
		}
		if neighbor.GetHardwareAddress() == "" {
			return errors.Errorf("ConnectionContext.IpNeighbors.HardwareAddress is required and cannot be empty/nil: %v", ip)
		}
	}
	return nil
}
func (c *ConnectionContext) MeetsRequirements(original *ConnectionContext) error {
	if c == nil {
		return errors.New("ConnectionContext should not be nil")
	}
	err := c.IsValid()
	if err != nil {
		return err
	}
	if original.GetIpContext().GetDstIpRequired() && c.GetIpContext().GetDstIpAddr() == "" {
		return errors.Errorf("ConnectionContext.DestIp is required and cannot be empty/nil: %v", c)
	}
	if original.GetIpContext().GetSrcIpRequired() && c.GetIpContext().GetSrcIpAddr() == "" {
		return errors.Errorf("ConnectionContext.SrcIp is required cannot be empty/nil: %v", c)
	}
	return nil
}