func NewConfigFromPath(path string) (*NSPConfig, error) {
	cfg := NSPConfig{}
	return parseConfigFromPath(&cfg, path)
}
NewConfigFromPath - Returns a configuration parsed from the provided file
package config
import (
	"flag"
	"os"
	"github.com/sirupsen/logrus"
	"gopkg.in/yaml.v2"
)
var (
	configLogger = logrus.WithField("package", "config")
)
type NSPConfig struct {
	CLI struct {
		Verbose           logrus.Level
		ConfigPath        string
		KubeConfigPath    string
		ProfileOutputPath string
		Pid               uint32
		Netns             uint64
		DDLogURL          string
		ProcessCacheSize  uint32
	}
	EBPF struct {
		PerfMapPageCount  int `yaml:"perf_map_page_count" default:"64"`
		KprobeMaxActive   int `yaml:"kprobe_max_active" default:"-1"`
		MapsChannelLength int `yaml:"maps_chanel_length" default:"1000"`
	} `yaml:"ebpf"`
	MonitoringOptions struct {
		NetworkMonitorTick int `yaml:"network_monitor_tick" default:"0"`
		DNSMonitoring bool `yaml:"dns_monitoring"`
		NetworkInterfacesMonitoring bool `yaml:"network_interfaces_monitoring"`
		ConnectionMonitoring bool `yaml:"connection_monitoring"`
	} `yaml:"monitoring_options"`
	SecurityOptions struct {
		FloodAttacks SecurityAction `yaml:"flood_attacks"`
		ARPSpoofing SecurityAction `yaml:"arp_spoofing"`
		DNSSpoofing SecurityAction `yaml:"dns_spoofing"`
		EgressDomains map[string]SecurityAction `yaml:"egress_domains"`
		EgressDefault SecurityAction `yaml:"egress_default"`
		IngressDomains map[string]SecurityAction `yamls:"ingress_domains"`
		IngressDefault SecurityAction `yaml:"ingress_default"`
		NetworkProtocols map[string]SecurityAction `yaml:"network_protocols"`
		NetworkProtocolDefault SecurityAction `yaml:"network_protocol_default"`
		TransportProtocols map[string]SecurityAction `yaml:"transport_protocols"`
		TransportProtocolDefault SecurityAction `yaml:"transport_protocol_default"`
		ApplicationProtocols map[string]SecurityAction `yaml:"application_protocols"`
		ApplicationProtocolDefault SecurityAction `yaml:"application_protocol_default"`
	} `yaml:"security_options"`
}
type SecurityAction struct {
	Alert bool `yaml:"alert" default:"true"`
	Block bool `yaml:"block" default:"false"`
	Kill  bool `yaml:"kill" default:"false"`
}
func parseConfigFromPath(cfg *NSPConfig, path string) (*NSPConfig, error) {
	if err := ReadConfigFile(path, cfg); err != nil {
		return nil, err
	}
	configLogger.Debugf("configuration file loaded: %s", path)
	return cfg, nil
}
func ReadConfigFile(path string, cfg *NSPConfig) error {
	f, err := os.Open(path)
	if err != nil {
		return err
	}
	defer f.Close()
	decoder := yaml.NewDecoder(f)
	return decoder.Decode(cfg)
}