Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: common/lhttp/utils.go

Issue 2227113002: Update bulidbucket client (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: add readme Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: common/lhttp/utils.go
diff --git a/common/lhttp/utils.go b/common/lhttp/utils.go
index e2823be2a25a865607eef7f21b5f8768110cba58..f7d5181addd022c1d01cf7c690bfeab0c03f4d0d 100644
--- a/common/lhttp/utils.go
+++ b/common/lhttp/utils.go
@@ -39,3 +39,17 @@ func CheckURL(s string) (string, error) {
}
return s, nil
}
+
+// IsLocalHost returns true if host is local.
+func IsLocalHost(host string) bool {
+ switch {
+ case host == "localhost", strings.HasPrefix(host, "localhost:"):
+ case host == "127.0.0.1", strings.HasPrefix(host, "127.0.0.1:"):
+ case host == "[::1]", strings.HasPrefix(host, "[::1]:"):
Vadim Sh. 2016/08/09 19:09:24 strictly speaking 0:0:0:0:0:0:0:1 is also localhos
nodir 2016/08/09 22:56:31 Done.
+ case strings.HasPrefix(host, ":"):
+
+ default:
+ return false
+ }
+ return true
+}

Powered by Google App Engine
This is Rietveld 408576698