Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for getHostIP (0.18 sec)

  1. cmd/net.go

    	ipList = set.NewStringSet()
    	for _, ip := range mustGetLocalIPs() {
    		if ip.To4() == nil {
    			ipList.Add(ip.String())
    		}
    	}
    	return
    }
    
    // getHostIP returns IP address of given host.
    func getHostIP(host string) (ipList set.StringSet, err error) {
    	addrs, err := globalDNSCache.LookupHost(GlobalContext, host)
    	if err != nil {
    		return ipList, err
    	}
    
    	ipList = set.NewStringSet()
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Wed Jun 19 14:34:00 UTC 2024
    - 9.6K bytes
    - Viewed (0)
  2. cmd/net_test.go

    		host           string
    		expectedIPList set.StringSet
    		expectedErr    error
    	}{
    		{"localhost", set.CreateStringSet("127.0.0.1"), nil},
    	}
    
    	for _, testCase := range testCases {
    		ipList, err := getHostIP(testCase.host)
    		switch {
    		case testCase.expectedErr == nil:
    			if err != nil {
    				t.Fatalf("error: expected = <nil>, got = %v", err)
    			}
    		case err == nil:
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri Apr 19 08:43:09 UTC 2024
    - 9.3K bytes
    - Viewed (0)
  3. cmd/endpoint.go

    func (endpoints Endpoints) GetAllStrings() (all []string) {
    	for _, e := range endpoints {
    		all = append(all, e.String())
    	}
    	return
    }
    
    func hostResolveToLocalhost(endpoint Endpoint) bool {
    	hostIPs, err := getHostIP(endpoint.Hostname())
    	if err != nil {
    		return false
    	}
    	var loopback int
    	for _, hostIP := range hostIPs.ToSlice() {
    		if net.ParseIP(hostIP).IsLoopback() {
    			loopback++
    		}
    	}
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Fri Jun 21 22:22:24 UTC 2024
    - 34.2K bytes
    - Viewed (0)
Back to top