Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for extractHostPort (0.21 sec)

  1. cmd/net.go

    	if i := strings.Index(host, "%"); i > -1 {
    		host = host[:i]
    	}
    	return net.ParseIP(host) != nil
    }
    
    // extractHostPort - extracts host/port from many address formats
    // such as, ":9000", "localhost:9000", "http://localhost:9000/"
    func extractHostPort(hostAddr string) (string, string, error) {
    	var addr, scheme string
    
    	if hostAddr == "" {
    Go
    - Registered: Sun Apr 21 19:28:08 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/", "8.8.8.8", "9000", nil},
    		{"https://facebook.com:9000/", "facebook.com", "9000", nil},
    	}
    
    	for i, testCase := range testCases {
    		host, port, err := extractHostPort(testCase.addr)
    		if testCase.expectedErr == nil && err != nil {
    			t.Fatalf("Test %d: should succeed but failed with err: %v", i+1, err)
    		}
    		if testCase.expectedErr != nil && err == nil {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Apr 19 08:43:09 GMT 2024
    - 9.3K bytes
    - Viewed (0)
Back to top