func (i *Iterator) Remaining() int {
	return i.total - i.position
}
Remaining returns the amount of requests left for the generator.
package generators
import "github.com/pkg/errors"
type Generator struct {
	Type     Type
	payloads map[string][]string
}
type Type int
const (
	BatteringRam Type = iota + 1
	PitchFork
	ClusterBomb
)
var StringToType = map[string]Type{
	"batteringram": BatteringRam,
	"pitchfork":    PitchFork,
	"clusterbomb":  ClusterBomb,
}
func New(payloads map[string]interface{}, payloadType Type, templatePath string) (*Generator, error) {
	generator := &Generator{}
	if err := generator.validate(payloads, templatePath); err != nil {
		return nil, err
	}
	compiled, err := loadPayloads(payloads)
	if err != nil {
		return nil, err
	}
	generator.Type = payloadType
	generator.payloads = compiled
	if payloadType == BatteringRam {
		if len(payloads) != 1 {
			return nil, errors.New("batteringram must have single payload set")
		}
	}
	return generator, nil
}
type Iterator struct {
	Type        Type
	position    int
	msbIterator int
	total       int
	payloads    []*payloadIterator
}
func (g *Generator) NewIterator() *Iterator {
	var payloads []*payloadIterator
	for name, values := range g.payloads {
		payloads = append(payloads, &payloadIterator{name: name, values: values})
	}
	iterator := &Iterator{
		Type:     g.Type,
		payloads: payloads,
	}
	iterator.total = iterator.Total()
	return iterator
}
func (i *Iterator) Reset() {
	i.position = 0
	i.msbIterator = 0
	for _, payload := range i.payloads {
		payload.resetPosition()
	}
}