func NewDuplicateCommand(client container.Client,
	names []string,  
	pattern string,  
	labels []string,  
	iface string,  
	ipsList []string,  
	sportsList,  
	dportsList,  
	durationStr,  
	intervalStr string,  
	percent,  
	correlation float64,  
	image string,  
	pull bool,  
	limit int,  
	dryRun bool,  
) (chaos.Command, error) {
	interval, err := util.GetIntervalValue(intervalStr)
	if err != nil {
		return nil, err
	}
	duration, err := util.GetDurationValue(durationStr, interval)
	if err != nil {
		return nil, err
	}
	reInterface := regexp.MustCompile("[a-zA-Z][a-zA-Z0-9\\.:_-]*")
	validIface := reInterface.FindString(iface)
	if iface != validIface {
		err = errors.Errorf("bad network interface name: must match '%s'", reInterface.String())
		return nil, err
	}
	var ips []*net.IPNet
	for _, str := range ipsList {
		ip, e := util.ParseCIDR(str)
		if e != nil {
			return nil, e
		}
		ips = append(ips, ip)
	}
	sports, err := util.GetPorts(sportsList)
	if err != nil {
		return nil, err
	}
	dports, err := util.GetPorts(dportsList)
	if err != nil {
		return nil, err
	}
	if percent < 0.0 || percent > 100.0 {
		return nil, errors.New("invalid duplicate percent: must be between 0.0 and 100.0")
	}
	if correlation < 0.0 || correlation > 100.0 {
		return nil, errors.New("invalid duplicate correlation: must be between 0.0 and 100.0")
	}
	return &DuplicateCommand{
		client:      client,
		names:       names,
		pattern:     pattern,
		labels:      labels,
		iface:       iface,
		ips:         ips,
		sports:      sports,
		dports:      dports,
		duration:    duration,
		percent:     percent,
		correlation: correlation,
		image:       image,
		limit:       limit,
		pull:        pull,
		dryRun:      dryRun,
	}, nil
}
NewDuplicateCommand create new netem duplicate command
package netem
import (
	"context"
	"net"
	"regexp"
	"strconv"
	"sync"
	"time"
	"github.com/alexei-led/pumba/pkg/chaos"
	"github.com/alexei-led/pumba/pkg/container"
	"github.com/alexei-led/pumba/pkg/util"
	"github.com/pkg/errors"
	log "github.com/sirupsen/logrus"
)
type DuplicateCommand struct {
	client      container.Client
	names       []string
	pattern     string
	labels      []string
	iface       string
	ips         []*net.IPNet
	sports      []string
	dports      []string
	duration    time.Duration
	percent     float64
	correlation float64
	image       string
	pull        bool
	limit       int
	dryRun      bool
}