func NewMasqDaemon(c *MasqConfig) *MasqDaemon {
	execer := utilexec.New()
	dbus := utildbus.New()
	protocolv4 := utiliptables.ProtocolIpv4
	protocolv6 := utiliptables.ProtocolIpv6
	iptables := utiliptables.New(execer, dbus, protocolv4)
	ip6tables := utiliptables.New(execer, dbus, protocolv6)
	return &MasqDaemon{
		config:    c,
		iptables:  iptables,
		ip6tables: ip6tables,
	}
}
NewMasqDaemon returns a MasqDaemon with default values, including an initialized utiliptables.Interface
package main
import (
	"bytes"
	utiljson "encoding/json"
	"flag"
	"fmt"
	"net"
	"os"
	"strings"
	"time"
	utilyaml "k8s.io/apimachinery/pkg/util/yaml"
	"k8s.io/apiserver/pkg/util/logs"
	"k8s.io/ip-masq-agent/cmd/ip-masq-agent/testing/fakefs"
	utildbus "k8s.io/kubernetes/pkg/util/dbus"
	utiliptables "k8s.io/kubernetes/pkg/util/iptables"
	"k8s.io/kubernetes/pkg/version/verflag"
	utilexec "k8s.io/utils/exec"
	"github.com/golang/glog"
)
const (
	linkLocalCIDR = "169.254.0.0/16"
	linkLocalCIDRIPv6 = "fe80::/10"
	configPath = "/etc/config/ip-masq-agent"
)
var (
	masqChain                         utiliptables.Chain
	masqChainFlag                     = flag.String("masq-chain", "IP-MASQ-AGENT", `Name of nat chain for iptables masquerade rules.`)
	noMasqueradeAllReservedRangesFlag = flag.Bool("nomasq-all-reserved-ranges", false, "Whether to disable masquerade for all IPv4 ranges reserved by RFCs.")
	enableIPv6                        = flag.Bool("enable-ipv6", false, "Whether to enable IPv6.")
)
type MasqConfig struct {
	NonMasqueradeCIDRs []string `json:"nonMasqueradeCIDRs"`
	MasqLinkLocal      bool     `json:"masqLinkLocal"`
	MasqLinkLocalIPv6  bool     `json:"masqLinkLocalIPv6"`
	ResyncInterval     Duration `json:"resyncInterval"`
}
type Duration time.Duration
func (d *Duration) UnmarshalJSON(json []byte) error {
	if json[0] == '"' {
		s := string(json[1 : len(json)-1])
		t, err := time.ParseDuration(s)
		if err != nil {
			return err
		}
		*d = Duration(t)
		return nil
	}
	s := string(json)
	return fmt.Errorf("expected string value for unmarshal to field of type Duration, got %q", s)
}
func NewMasqConfig(masqAllReservedRanges bool) *MasqConfig {
	nonMasq := []string{"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"}
	if masqAllReservedRanges {
		nonMasq = append(nonMasq,
			"100.64.0.0/10",    
			"192.0.0.0/24",     
			"192.0.2.0/24",     
			"192.88.99.0/24",   
			"198.18.0.0/15",    
			"198.51.100.0/24",  
			"203.0.113.0/24",   
			"240.0.0.0/4")      
	}
	return &MasqConfig{
		NonMasqueradeCIDRs: nonMasq,
		MasqLinkLocal:      false,
		MasqLinkLocalIPv6:  false,
		ResyncInterval:     Duration(60 * time.Second),
	}
}
type MasqDaemon struct {
	config    *MasqConfig
	iptables  utiliptables.Interface
	ip6tables utiliptables.Interface
}