// NewDeclChecker creates a DeclChecker.
198724
func NewDeclChecker(bi, ai *types.Info) *DeclChecker {
	return &DeclChecker{binfo: bi, ainfo: ai}
}
635237
func NewDNSChecker(ip net.IP, port int) *DNSChecker {
	return &DNSChecker{
		Target: Target{
			IP:    ip,
			Port:  port,
			Proto: seesaw.IPProtoUDP,
		},
		Question: dns.Question{
			Qclass: dns.ClassINET,
			Qtype:  dns.TypeA,
		},
	}
}
240809
func NewCloner() *Cloner {
	c := &Cloner{
		deepCopyFuncs:          map[reflect.Type]reflect.Value{},
		generatedDeepCopyFuncs: map[reflect.Type]reflect.Value{},
	}
	if err := c.RegisterDeepCopyFunc(byteSliceDeepCopy); err != nil {
		// If one of the deep-copy functions is malformed, detect it immediately.
		panic(err)
	}
	return c
}
1349116
func NewDeclare(Consts []node.Node, Stmt node.Node, alt bool) *Declare {
	return &Declare{
		FreeFloating: nil,
		Consts:       Consts,
		Stmt:         Stmt,
		Alt:          alt,
	}
}
1043024
func NewMockCompiler(ctrl *gomock.Controller) *MockCompiler {
	mock := &MockCompiler{ctrl: ctrl}
	mock.recorder = &MockCompilerMockRecorder{mock}
	return mock
}
714854
func NewDecoder(opts *DecoderOptions) *Decoder {
	dec := &Decoder{opts: opts}
	if dec.opts == nil {
		dec.opts = &DecoderOptions{}
	}
	if dec.opts.TagName == "" {
		dec.opts.TagName = tagName
	}
	return dec
}
212061
func newDelRangeManager(store kv.Storage, sessPool *sessionPool) delRangeManager {
	dr := &delRange{
		store:        store,
		sessPool:     sessPool,
		storeSupport: store.SupportDeleteRange(),
		quitCh:       make(chan struct{}),
	}
	if !dr.storeSupport {
		dr.emulatorCh = make(chan struct{}, delBackLog)
		dr.keys = make([]kv.Key, 0, delBatchSize)
	}
	return dr
}
715720
func NewChecker(trustedIPs []string) (*Checker, error) {
	if len(trustedIPs) == 0 {
		return nil, errors.New("no trusted IPs provided")
	}

	checker := &Checker{}

	for _, ipMask := range trustedIPs {
		if ipAddr := net.ParseIP(ipMask); ipAddr != nil {
			checker.authorizedIPs = append(checker.authorizedIPs, &ipAddr)
		} else {
			_, ipAddr, err := net.ParseCIDR(ipMask)
			if err != nil {
				return nil, fmt.Errorf("parsing CIDR trusted IPs %s: %v", ipAddr, err)
			}
			checker.authorizedIPsNet = append(checker.authorizedIPsNet, ipAddr)
		}
	}

	return checker, nil
}
864139
func newHealthcheckManager(e *Engine) *healthcheckManager {
	return &healthcheckManager{
		engine:        e,
		marks:         make(map[seesaw.IP]uint32),
		markAlloc:     newMarkAllocator(dsrMarkBase, dsrMarkSize),
		ncc:           ncclient.NewNCC(e.config.NCCSocket),
		next:          healthcheck.Id((uint64(os.Getpid()) & 0xFFFF) << 48),
		vserverChecks: make(map[string]map[checkKey]*check),
		quit:          make(chan bool),
		stopped:       make(chan bool),
		vcc:           make(chan vserverChecks, 100),
	}
}
132225
func (cfg *Config) NewDecoder(r io.Reader) *Decoder {
	return &Decoder{r, cfg}
}
622017
func newCheckWatcher(logger log.Logger, consul ChecksAPI) *checkWatcher {
	return &checkWatcher{
		consul:        consul,
		pollFreq:      defaultPollFreq,
		checkUpdateCh: make(chan checkWatchUpdate, 8),
		done:          make(chan struct{}),
		logger:        logger.ResetNamed("consul.health"),
	}
}
1032365
func (s *Server) newCheckServiceNodeSorter(cs lib.CoordinateSet, nodes structs.CheckServiceNodes) (sort.Interface, error) {
	state := s.fsm.State()
	vec := make([]float64, len(nodes))
	for i, node := range nodes {
		_, other, err := state.Coordinate(node.Node.Node, nil)
		if err != nil {
			return nil, err
		}
		c1, c2 := cs.Intersect(other)
		vec[i] = lib.ComputeDistance(c1, c2)
	}
	return &checkServiceNodeSorter{nodes, vec}, nil
}
1124620
func newChecker(o *storage.LookupOptions, op *predicate.Predicate) *checker {
	var ta *time.Time
	if op != nil {
		if t, err := op.TimeAnchor(); err == nil {
			ta = t
		}
	}
	return &checker{
		max: o.MaxElements > 0,
		c:   o.MaxElements,
		o:   o,
		op:  op,
		ota: ta,
	}
}
1342314
func NewDec(unscaled int64, scale Scale) *Dec {
	return new(Dec).SetUnscaled(unscaled).SetScale(scale)
}
484535
func NewCheckSup(s string) (checkSup, error) {
	var e checkSup
	err := e.FromString(s)
	if err != nil {
		return 0, err
	}
	return e, nil
}
1124030
func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder {
	return json.NewDecoder(r)
}
956188
func NewPingChecker(ip net.IP) *PingChecker {
	proto := seesaw.IPProtoICMP
	if ip.To4() == nil {
		proto = seesaw.IPProtoICMPv6
	}
	id := nextPingCheckerID
	nextPingCheckerID++
	return &PingChecker{
		Target: Target{
			IP:    ip,
			Proto: proto,
		},
		ID: id,
	}
}