// NewInstancer returns a DNS SRV instancer.
324394
func NewInstancer(
	name string,
	ttl time.Duration,
	logger log.Logger,
) *Instancer {
	return NewInstancerDetailed(name, time.NewTicker(ttl), net.LookupSRV, logger)
}
404222
func NewDNSProvider() (*DNSProvider, error) {
	config := NewDefaultConfig()
	config.AccessToken = env.GetOrFile("DNSIMPLE_OAUTH_TOKEN")
	config.BaseURL = env.GetOrFile("DNSIMPLE_BASE_URL")

	return NewDNSProviderConfig(config)
}
350727
func NewInstanceCache(fs fs.FileSystem) *InstanceCache {
	return &InstanceCache{
		fs:      fs,
		maxSize: instanceCacheMaxSize,
		maxAge:  instanceCacheMaxAge,
	}
}
1360374
func NewResponseReverter(w dns.ResponseWriter, r *dns.Msg) *ResponseReverter {
	return &ResponseReverter{
		ResponseWriter:   w,
		originalQuestion: r.Question[0],
	}
}
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
}
644411
func NewProfiler() (prof *Profiler, err error) {
	p, err := basic.NewProfiler()
	if err != nil {
		return nil, err
	}
	return &Profiler{Profiler: p}, nil
}
497092
func newImporter(ns Namespace) importer {
	return importer{
		ns:      ns,
		imports: make(map[string]*ast.ImportSpec),
	}
}
687862
func newErr(code errorCode, a interface{}) *routerError {
	return &routerError{
		code: code,
		err:  errors.New(a),
	}
}
744527
func NewInstancer(c Client, path string, logger log.Logger) (*Instancer, error) {
	s := &Instancer{
		cache:  instance.NewCache(),
		client: c,
		path:   path,
		logger: logger,
		quitc:  make(chan struct{}),
	}

	err := s.client.CreateParentNodes(s.path)
	if err != nil {
		return nil, err
	}

	instances, eventc, err := s.client.GetEntries(s.path)
	if err != nil {
		logger.Log("path", s.path, "msg", "failed to retrieve entries", "err", err)
		// other implementations continue here, but we exit because we don't know if eventc is valid
		return nil, err
	}
	logger.Log("path", s.path, "instances", len(instances))
	s.cache.Update(sd.Event{Instances: instances})

	go s.loop(eventc)

	return s, nil
}
13036
func NewInstance(fw *choria.Framework) (i *Instance, err error) {
	i = &Instance{
		fw:               fw,
		cfg:              fw.Config,
		requests:         make(chan *choria.ConnectorMessage),
		mu:               &sync.Mutex{},
		startTime:        time.Now(),
		lastMsgProcessed: time.Unix(0, 0),
		agentDenyList:    []string{},
	}

	i.log = log.WithFields(log.Fields{"identity": fw.Config.Identity, "component": "server"})
	i.discovery = discovery.New(fw, i.log)

	return i, nil
}
230893
func NewDNSProvider() (*DNSProvider, error) {
	_, err := env.Get("OS_AUTH_URL", "OS_USERNAME", "OS_PASSWORD", "OS_TENANT_NAME", "OS_REGION_NAME")
	if err != nil {
		return nil, fmt.Errorf("designate: %v", err)
	}

	opts, err := openstack.AuthOptionsFromEnv()
	if err != nil {
		return nil, fmt.Errorf("designate: %v", err)
	}

	config := NewDefaultConfig()
	config.opts = opts

	return NewDNSProviderConfig(config)
}
1357973
func NewRouter(rootLogger *logrus.Logger, cfg config.Config, bridgeMap map[string]bridge.Factory) (*Router, error) {
	logger := rootLogger.WithFields(logrus.Fields{"prefix": "router"})

	r := &Router{
		Config:           cfg,
		BridgeMap:        bridgeMap,
		Message:          make(chan config.Message),
		MattermostPlugin: make(chan config.Message),
		Gateways:         make(map[string]*Gateway),
		logger:           logger,
	}
	sgw := samechannel.New(cfg)
	gwconfigs := append(sgw.GetConfig(), cfg.BridgeValues().Gateway...)

	for idx := range gwconfigs {
		entry := &gwconfigs[idx]
		if !entry.Enable {
			continue
		}
		if entry.Name == "" {
			return nil, fmt.Errorf("%s", "Gateway without name found")
		}
		if _, ok := r.Gateways[entry.Name]; ok {
			return nil, fmt.Errorf("Gateway with name %s already exists", entry.Name)
		}
		r.Gateways[entry.Name] = New(rootLogger, entry, r)
	}
	return r, nil
}
1096633
func (c *Characteristic) NewDescriptor(u UUID) *Descriptor {
	return c.AddDescriptor(&Descriptor{UUID: u})
}
374933
func (client *Client) CreateInstance(args *CreateInstanceArgs) (instanceId string, err error) {
	if args.UserData != "" {
		// Encode to base64 string
		args.UserData = base64.StdEncoding.EncodeToString([]byte(args.UserData))
	}
	response := CreateInstanceResponse{}
	err = client.Invoke("CreateInstance", args, &response)
	if err != nil {
		return "", err
	}
	return response.InstanceId, err
}
1340885
func NewInstanceMetadataService(metadataURL string) (*InstanceMetadataService, error) {
	ims := &InstanceMetadataService{
		metadataURL: metadataURL,
	}

	imsCache, err := newTimedcache(metadataCacheTTL, ims.getInstanceMetadata)
	if err != nil {
		return nil, err
	}

	ims.imsCache = imsCache
	return ims, nil
}
917666
func CreateInstance(clsid *GUID, iid *GUID) (unk *IUnknown, err error) {
	if iid == nil {
		iid = IID_IUnknown
	}
	hr, _, _ := procCoCreateInstance.Call(
		uintptr(unsafe.Pointer(clsid)),
		0,
		CLSCTX_SERVER,
		uintptr(unsafe.Pointer(iid)),
		uintptr(unsafe.Pointer(&unk)))
	if hr != 0 {
		err = NewError(hr)
	}
	return
}
695959
func NewIntErr(f func(string) (int, error), s string) *IntErr {
	this := &IntErr{}
	this.I, this.E = f(s)
	return this
}