github.com/lmars/docker@v1.6.0-rc2/pkg/urlutil/url.go (about)

     1  package urlutil
     2  
     3  import "strings"
     4  
     5  var validUrlPrefixes = []string{
     6  	"http://",
     7  	"https://",
     8  }
     9  
    10  // IsURL returns true if the provided str is a valid URL by doing
    11  // a simple change for the transport of the url.
    12  func IsURL(str string) bool {
    13  	for _, prefix := range validUrlPrefixes {
    14  		if strings.HasPrefix(str, prefix) {
    15  			return true
    16  		}
    17  	}
    18  	return false
    19  }