Documentation
¶
Index ¶
- func AllowRequest(req *http.Request, cfg *Config, db *geoip2.Reader) bool
- func IsGeoAllowed(remoteAddr string, allowedCountries []string, db *geoip2.Reader) bool
- func IsIPAllowed(remoteAddr string, allowedRanges []string) bool
- func IsTimeAllowed(window *TimeWindow) bool
- func New(_ context.Context, next http.Handler, config *Config, name string) (http.Handler, error)
- type AccessFence
- type Config
- type TimeWindow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGeoAllowed ¶
func IsIPAllowed ¶
func IsTimeAllowed ¶
func IsTimeAllowed(window *TimeWindow) bool
Types ¶
type AccessFence ¶
type AccessFence struct {
// contains filtered or unexported fields
}
func (*AccessFence) ServeHTTP ¶
func (a *AccessFence) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type Config ¶
type Config struct { IPRanges []string `json:"ipRanges,omitempty"` // e.g., ["10.0.0.0/8"] GeoZones []string `json:"geoZones,omitempty"` // e.g., ["PL", "US"] TimeWindow *TimeWindow `json:"timeWindow,omitempty"` // optional time limits }
func CreateConfig ¶
func CreateConfig() *Config
type TimeWindow ¶
Click to show internal directories.
Click to hide internal directories.