func ParseConfigFile(f *os.File) (config GeneratorConfig, err error) {
	r := bufio.NewReader(f)
	var in GeneratorConfig
	err = json.NewDecoder(r).Decode(&in)
	if err != nil {
		return nil, err
	}
	return in, nil
}
ParseConfigFile parses json config file and returns GeneratorConfig.
package generator
import (
	"bufio"
	"encoding/json"
	"fmt"
	"math/rand"
	"net"
	"os"
	"regexp"
	"strings"
	"github.com/intel-go/nff-go/types"
)
var mixPattern = regexp.MustCompile(`^mix[0-9]*$`)
var pcapPattern = regexp.MustCompile(`^.*\.pcap$`)
type AddrRange struct {
	Min     uint64
	Max     uint64
	Current uint64
	Inc     uint64
}
type SequenceType uint
const (
	RANDOM SequenceType = iota
	INCREASING
)
type Sequence struct {
	Type    SequenceType
	Current uint32
}
type DataType int
const (
	NULL = iota
	ETHERHDR
	IPv4HDR
	IPv6HDR
	TCPHDR
	UDPHDR
	ICMPHDR
	ARPHDR
	DATA
	PDISTDATA
	RANDDATA
	RAWDATA
	NONE
	PCAP
)
type PacketConfig struct {
	DType DataType
	Ether EtherConfig
	Pcap  PcapConfig
}
type MixConfig struct {
	Config   PacketConfig
	Quantity uint32
}
func (mc *MixConfig) String() string {
	return fmt.Sprintf("config: %v; quantity: %v\n", mc.Config, mc.Quantity)
}
type PcapConfig struct {
	Path       string
	FileReader *os.File
	InMemory   bool
	ReachedEOF bool
	Packets    [][]byte
	NextPacket int
}
type EtherConfig struct {
	DAddr AddrRange
	SAddr AddrRange
	VLAN  *VlanTagConfig
	DType DataType
	IPv4  IPv4Config
	IPv6  IPv6Config
	ARP   ARPConfig
	Bytes RawBytes
}
type VlanTagConfig struct {
	TCI uint16
}
type IPv4Config struct {
	SAddr AddrRange  
	DAddr AddrRange  
	DType DataType
	TCP   TCPConfig
	UDP   UDPConfig
	ICMP  ICMPConfig
	Bytes RawBytes
}
type TCPConfig struct {
	SPort AddrRange
	DPort AddrRange
	Seq   Sequence
	Flags types.TCPFlags
	DType DataType
	Bytes RawBytes
}
type UDPConfig struct {
	SPort AddrRange
	DPort AddrRange
	DType DataType
	Bytes RawBytes
}
type ICMPConfig struct {
	Type       uint8
	Code       uint8
	Identifier uint16
	Seq        Sequence
	DType      DataType
	Bytes      RawBytes
}
type ARPConfig struct {
	Operation  uint16
	Gratuitous bool
	SHA        AddrRange
	SPA        AddrRange
	THA        AddrRange
	TPA        AddrRange
}
type PDistEntry struct {
	Probability float64
	DType       DataType
	Data        string
	Rand        RandBytes
}
type RandBytes struct {
	Size      uint32
	Deviation uint32
}
type RawBytes struct {
	Data  string
	Rand  RandBytes
	Dist  []PDistEntry
	DType DataType
}
type GeneratorConfig []MixConfig