Compare commits
1 Commits
d3502e5f9b
...
6aa35ffc4f
| Author | SHA1 | Date | |
|---|---|---|---|
| 6aa35ffc4f |
@ -430,23 +430,6 @@ func whitelistKey(email string) string {
|
||||
|
||||
return email
|
||||
}
|
||||
func isPrivateIP(ip net.IP) bool {
|
||||
if ip[0] == 10 {
|
||||
return true
|
||||
}
|
||||
|
||||
if ip[0] == 172 {
|
||||
if ip[1] >= 16 && ip[1] < 32 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
if ip[0] == 192 && ip[1] == 168 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (mg *Maingate) RegisterHandlers(ctx context.Context, serveMux *http.ServeMux, prefix string) error {
|
||||
var allServices []*serviceDescription
|
||||
@ -460,7 +443,7 @@ func (mg *Maingate) RegisterHandlers(ctx context.Context, serveMux *http.ServeMu
|
||||
ipaddr := "127.0.0.1"
|
||||
for _, addr := range addrs {
|
||||
if ipnet, ok := addr.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
|
||||
if ipnet.IP.To4() != nil && ipnet.IP.IsPrivate() {
|
||||
if ipnet.IP.To4() != nil {
|
||||
ipaddr = ipnet.IP.String()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user