1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 10:27:06 +00:00

improve remote addr parsing as requested at: https://github.com/kataras/iris/issues/1453

Former-commit-id: e5fde988eda9bf582b04285a1c77ba123910a699
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-04-20 10:43:45 +03:00
parent c5392ede6a
commit 6c6de6b85d
8 changed files with 297 additions and 50 deletions

View File

@@ -1,5 +1,9 @@
package context
import (
"github.com/kataras/iris/v12/core/netutil"
)
// ConfigurationReadOnly can be implemented
// by Configuration, it's being used inside the Context.
// All methods that it contains should be "safe" to be called by the context
@@ -91,7 +95,19 @@ type ConfigurationReadOnly interface {
//
// Look `context.RemoteAddr()` for more.
GetRemoteAddrHeaders() map[string]bool
// GetRemoteAddrPrivateSubnets returns the configuration's private sub-networks.
// They are used to be compared against
// IP Addresses fetched through `RemoteAddrHeaders` or `Request.RemoteAddr`.
// For details please navigate through: https://github.com/kataras/iris/issues/1453
// Defaults to an empty slice, usage:
//
// RemoteAddrPrivateSubnets {
// {Start: "10.0.0.0", End: "10.255.255.255"},
// {Start: "100.64.0.0", End: "100.127.255.255"},
// }
//
// Look `context.RemoteAddr()` for more.
GetRemoteAddrPrivateSubnets() []netutil.IPRange
// GetOther returns the configuration.Other map.
GetOther() map[string]interface{}
}