Documentation ¶
Index ¶
- Variables
- func BaseURL(r *http.Request) (baseUrl string)
- func CheckRequestIpWithList(req *http.Request, list []string) bool
- func Download(url, path string) (err error)
- func Get(url string) (content string, err error)
- func GetIpFromRequest(r *http.Request) (ip string, err error)
- func GetProxyIpFromRequest(r *http.Request) (ip string, err error)
- func GetRemoteAddr(r *http.Request) (ip string)
- func Hostname() string
- func IsIpInRange(ip string, cidr string) bool
- func IsNetIpInRange(ip net.IP, cidr string) bool
- func IsNetIpPrivate(ip net.IP) (private bool)
- func MakeUrl(path string, r *http.Request) (url string)
- func MustParseCIDR(s string) net.IPNet
- func ParseCIDR(input ...string) (cidrs []*net.IPNet, err error)
- func ParseIP(input ...string) (ips []net.IP, err error)
- func ParseIpFromRequest(r *http.Request) (ip net.IP, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var PrivateNetworks = []net.IPNet{ MustParseCIDR("10.0.0.0/8"), MustParseCIDR("172.16.0.0/12"), MustParseCIDR("192.168.0.0/16"), MustParseCIDR("127.0.0.0/8"), MustParseCIDR("0.0.0.0/8"), MustParseCIDR("169.254.0.0/16"), MustParseCIDR("192.0.0.0/24"), MustParseCIDR("192.0.2.0/24"), MustParseCIDR("198.51.100.0/24"), MustParseCIDR("203.0.113.0/24"), MustParseCIDR("192.88.99.0/24"), MustParseCIDR("192.18.0.0/15"), MustParseCIDR("224.0.0.0/4"), MustParseCIDR("240.0.0.0/4"), MustParseCIDR("255.255.255.255/32"), MustParseCIDR("100.64.0.0/10"), MustParseCIDR("::/128"), MustParseCIDR("::1/128"), MustParseCIDR("100::/64"), MustParseCIDR("2001::/23"), MustParseCIDR("2001:2::/48"), MustParseCIDR("2001:db8::/32"), MustParseCIDR("2001::/32"), MustParseCIDR("fc00::/7"), MustParseCIDR("fe80::/10"), MustParseCIDR("ff00::/8"), MustParseCIDR("2002::/16"), }
PrivateNetworks net.IPNets that are loopback, private, link local, default unicast based on https://github.com/letsencrypt/boulder/blob/master/bdns/dns.go
Functions ¶
func CheckRequestIpWithList ¶
CheckRequestIpWithList returns TRUE if the remote IP in an http.Request is from an IP in the given list of CIDR ranges
func GetRemoteAddr ¶
func IsIpInRange ¶
func IsNetIpPrivate ¶
IsNetIpPrivate returns true if the IP address given is within any of the local or private network CIDR ranges (not public IP address space)
func MustParseCIDR ¶
MustParseCIDR parses string into net.IPNet
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.