v0.0.0-...-0fb52df Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2022 License: MPL-2.0 Imports: 6 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Firewall

type Firewall struct {
	// [required] url of the iprepd instance to use
	IPrepdURL string

	// [required] auth string to authenticate against iprepd
	IPrepdAuthStr string

	// [required] reject any ip with reputation below this score
	RejectBelowScore int

	// optionally add IPs you wish to unconditionally allow
	Whitelist []net.IP

	// optionally log all dropped http requests
	LogBlocked bool

	// optionally allow any request if there was a problem reaching iprepd
	FailOpen bool

	// optionally use non-default http client settings
	HTTPClient *http.Client

Firewall is a software defined firewall for HTTP servers. It uses Reputation entries from a trusted iprepd instance and built-in configuration parameters in order to determine whether an HTTP request should be served or not given the request's source ip address

func (*Firewall) Wrap

func (fw *Firewall) Wrap(h http.Handler) http.Handler

Wrap the firewall around an HTTP handler. The returned http.Handler will only serve requests from IPs which satisfy one or more of the following:

  • the IP is included in the Firewall's whitelist
  • the IP does not have an entry in iprepd (implying no violations)
  • the IP has an entry in iprepd with a score above RejectBelowScore

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL