// NsLookup returns name record,called from ofnet agent
420214
func (ens *NetpluginNameServer) NsLookup(nsq []byte, vrfPtr *string) ([]byte, error) {
	tenant := *vrfPtr
	req := new(dns.Msg)
	err := req.Unpack(nsq)
	if err != nil {
		ens.incTenantStats(tenant, "invalidQuery")
		return nil, err
	}

	// no fancy requests
	if req.Response {
		ens.incTenantStats(tenant, "invalidQuery")
		return nil, errors.New("")
	}

	if req.IsTsig() != nil {
		ens.incTenantStats(tenant, "invalidQuery")
		return nil, errors.New("")
	}

	d, err := ens.serveNameRecord(tenant, req)
	if err != nil {
		logrus.Infof("no name record: %s", err)
		ens.incTenantStats(tenant, "noNameRecord")
		return nil, err
	}

	ens.incTenantStats(tenant, "foundNameRecord")
	return d, err

}
1059840
func (u Util) userLookup(name string) (*user.User, error) {
	res := &C.lookup_res_t{}

	if ret, err := C.user_lookup(C.CString(u.DestDir),
		C.CString(name), res); ret < 0 {
		return nil, fmt.Errorf("lookup failed: %v", err)
	}

	if res.name == nil {
		return nil, fmt.Errorf("user %q not found", name)
	}

	homedir, err := u.JoinPath(C.GoString(res.home))
	if err != nil {
		return nil, err
	}

	usr := &user.User{
		Name:    C.GoString(res.name),
		Uid:     fmt.Sprintf("%d", int(res.uid)),
		Gid:     fmt.Sprintf("%d", int(res.gid)),
		HomeDir: homedir,
	}

	C.user_lookup_res_free(res)

	return usr, nil
}
522255
func (e *Etcd) Lookup(ctx context.Context, state request.Request, name string, typ uint16) (*dns.Msg, error) {
	return e.Upstream.Lookup(ctx, state, name, typ)
}
184917
func (v *Vars) lookup(id ID) *varValue {
	for idx := len(v.scopes) - 1; idx >= 0; idx-- {
		if val, ok := v.scopes[idx].values[id]; ok {
			return &val
		}
	}
	return nil
}
417210
func (c *Connect) LookupNetworkByUUIDString(uuid string) (*Network, error) {
	cUuid := C.CString(uuid)
	defer C.free(unsafe.Pointer(cUuid))
	var err C.virError
	ptr := C.virNetworkLookupByUUIDStringWrapper(c.ptr, cUuid, &err)
	if ptr == nil {
		return nil, makeError(&err)
	}
	return &Network{ptr: ptr}, nil
}
1162440
func (k *Kubernetes) Lookup(ctx context.Context, state request.Request, name string, typ uint16) (*dns.Msg, error) {
	return k.Upstream.Lookup(ctx, state, name, typ)
}
1050456
func Lookup(rblList string, targetHost string) (r RBLResults) {
	r.List = rblList
	r.Host = targetHost

	if ip, err := net.LookupIP(targetHost); err == nil {
		for _, addr := range ip {
			if addr.To4() != nil {
				res := Result{}
				res.Address = addr.String()

				addr := Reverse(addr)

				query(rblList, addr, &res)

				r.Results = append(r.Results, res)

			}
		}
	}
	return
}
686746
func lookup(
	first func(i int) net.IP,
	full func(i int) Range,
	n int,
	ip net.IP,
) (
	r Range, ok bool,
) {
	// Find the index of the first range for which the following range exceeds
	// it.
	i := sort.Search(n, func(i int) bool {
		if i+1 >= n {
			return true
		}
		return bytes.Compare(ip, first(i+1)) < 0
	})
	if i == n {
		return
	}
	r = full(i)
	ok = bytes.Compare(r.First, ip) <= 0 && bytes.Compare(ip, r.Last) <= 0
	return
}
326308
func (q *TermsQuery) TermsLookup(lookup *TermsLookup) *TermsQuery {
	q.termsLookup = lookup
	return q
}
295572
func (cbc ConnByCertMap) Lookup(cert []byte) (*grpc.ClientConn, bool) {
	conn, ok := cbc[string(cert)]
	return conn, ok
}
773875
func (s *Sandbox) NetNsJoin(nspath, name string) error {
	if s.netns != nil {
		return fmt.Errorf("sandbox already has a network namespace, cannot join another")
	}

	netNS, err := s.NetNsGet(nspath, name)
	if err != nil {
		return err
	}

	s.netns = netNS

	return nil
}
90699
func (c *Connect) LookupInterfaceByMACString(mac string) (*Interface, error) {
	cName := C.CString(mac)
	defer C.free(unsafe.Pointer(cName))
	var err C.virError
	ptr := C.virInterfaceLookupByMACStringWrapper(c.ptr, cName, &err)
	if ptr == nil {
		return nil, makeError(&err)
	}
	return &Interface{ptr: ptr}, nil
}
389095
func (l *localIdentityCache) lookup(lbls labels.Labels) *identity.Identity {
	l.mutex.RLock()
	defer l.mutex.RUnlock()

	stringRepresentation := string(lbls.SortedList())
	if id, ok := l.identitiesByLabels[stringRepresentation]; ok {
		return id
	}

	return nil
}
238789
func WithLookupEnv(ctx context.Context, f lookupEnvFunc) context.Context {
	return context.WithValue(ctx, ctxOSLookupEnvKey, f)
}
472048
func (r Account_Address) GetNetworkAddress(name *string) (resp []datatypes.Account_Address, err error) {
	params := []interface{}{
		name,
	}
	err = r.Session.DoRequest("SoftLayer_Account_Address", "getNetworkAddress", params, &r.Options, &resp)
	return
}
560528
func (ipl *IPList) lookup(ip net.IP) (Range, bool) {
	return lookup(func(i int) net.IP {
		return ipl.ranges[i].First
	}, func(i int) Range {
		return ipl.ranges[i]
	}, len(ipl.ranges), ip)
}
774062
func (dns *dnsControl) GetNamespaceByName(name string) (*api.Namespace, error) {
	os := dns.nsLister.List()
	for _, o := range os {
		ns, ok := o.(*api.Namespace)
		if !ok {
			continue
		}
		if name == ns.ObjectMeta.Name {
			return ns, nil
		}
	}
	return nil, fmt.Errorf("namespace not found")
}