MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / isValidAddr

Function isValidAddr

proxy_handler.go:45–56  ·  view source on GitHub ↗

isValidAddr checks if the Addr is a valid IP or IP:port.

(addr string)

Source from the content-addressed store, hash-verified

43
44// isValidAddr checks if the Addr is a valid IP or IP:port.
45func isValidAddr(addr string) bool {
46 if addr == "" {
47 return false
48 }
49
50 ip, _, err := net.SplitHostPort(addr)
51 if err != nil {
52 return net.ParseIP(addr) != nil
53 }
54
55 return net.ParseIP(ip) != nil
56}
57
58func parseDefaultProxyHeaders(r *http.Request) string {
59 var addr string

Callers 1

GetRemoteAddrMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected