Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for sameLocalAddrs (0.22 sec)

  1. cmd/net.go

    		return (isLocalv4 || isLocalv6) && (port == localPort), nil
    	}
    	return isLocalv4 || isLocalv6, nil
    }
    
    // sameLocalAddrs - returns true if two addresses, even with different
    // formats, point to the same machine, e.g:
    //
    //	':9000' and 'http://localhost:9000/' will return true
    func sameLocalAddrs(addr1, addr2 string) (bool, error) {
    	// Extract host & port from given parameters
    	host1, port1, err := extractHostPort(addr1)
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Tue Mar 26 15:00:38 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  2. cmd/net_test.go

    		{"http://8.8.8.8:9000", "http://localhost:9000", false, nil},
    	}
    
    	for _, testCase := range testCases {
    		testCase := testCase
    		t.Run("", func(t *testing.T) {
    			sameAddr, err := sameLocalAddrs(testCase.addr1, testCase.addr2)
    			if testCase.expectedErr != nil && err == nil {
    				t.Errorf("should fail but succeeded")
    			}
    			if testCase.expectedErr == nil && err != nil {
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 19 08:43:09 GMT 2024
    - 9.3K bytes
    - Viewed (0)
Back to top