Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for sortIPs (0.8 sec)

  1. cmd/net.go

    	}
    
    	return ipList, err
    }
    
    // sortIPs - sort ips based on higher octets.
    // The logic to sort by last octet is implemented to
    // prefer CIDRs with higher octets, this in-turn skips the
    // localhost/loopback address to be not preferred as the
    // first ip on the list. Subsequently this list helps us print
    // a user friendly message with appropriate values.
    func sortIPs(ipList []string) []string {
    	if len(ipList) == 1 {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Tue Mar 26 15:00:38 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  2. cmd/net_test.go

    		{
    			ipList:       []string{"127.0.0.1", "10.0.0.1", "192.168.0.1"},
    			sortedIPList: []string{"10.0.0.1", "192.168.0.1", "127.0.0.1"},
    		},
    	}
    	for i, testCase := range testCases {
    		gotIPList := sortIPs(testCase.ipList)
    		if !reflect.DeepEqual(testCase.sortedIPList, gotIPList) {
    			t.Errorf("Test %d: Expected %s, got %s", i+1, testCase.sortedIPList, gotIPList)
    		}
    	}
    }
    
    func TestMustGetLocalIP4(t *testing.T) {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Fri Apr 19 08:43:09 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  3. internal/kms/context.go

    // generated DEK such that the same context must be
    // provided when decrypting an encrypted DEK.
    type Context map[string]string
    
    // MarshalText returns a canonical text representation of
    // the Context.
    
    // MarshalText sorts the context keys and writes the sorted
    // key-value pairs as canonical JSON object. The sort order
    // is based on the un-escaped keys. It never returns an error.
    func (c Context) MarshalText() ([]byte, error) {
    	if len(c) == 0 {
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Sun Jan 02 17:15:06 GMT 2022
    - 6K bytes
    - Viewed (0)
Back to top