Skip to content

Commit

Permalink
update docs (close jpillora#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpillora authored Jan 28, 2021
1 parent 26d6eb5 commit 839c262
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ http.ListenAndServe(":8080", myProtectedHandler)
**Country-block stand-alone**

```go
f, err := ipfilter.New(ipfilter.Options{
f := ipfilter.New(ipfilter.Options{
BlockedCountries: []string{"CN"},
})

Expand All @@ -46,7 +46,7 @@ f.Allowed("216.58.199.67") //=> true (US)
**Async allow LAN hosts middleware**

```go
f, err := ipfilter.New(ipfilter.Options{
f := ipfilter.New(ipfilter.Options{
BlockByDefault: true,
})

Expand All @@ -64,7 +64,7 @@ http.ListenAndServe(":8080", myProtectedHandler)
**Allow your entire LAN only**

```go
f, err := ipfilter.New(ipfilter.Options{
f := ipfilter.New(ipfilter.Options{
AllowedIPs: []string{"192.168.0.0/24"},
BlockByDefault: true,
})
Expand Down Expand Up @@ -121,8 +121,6 @@ func (m *myMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
* Due to the nature of IP address allocation, determining location based of a
single IP address is quite difficult (if you're not Google) and is therefore
not very reliable. For this reason `BlockByDefault` is off by default.
* IP DB lookups take on the order of `5µs` to perform, though the initial load from disk
into memory takes takes about `350ms` so be wary of excessive `ipfilter.New` use.

#### Todo

Expand All @@ -138,4 +136,4 @@ func (m *myMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) {
#### Change log

* v1.0.0 Use MaxMindDB IP data
* v1.1.0 Use IP2Location LITE IP data
* v1.1.0 Use IP2Location LITE IP data

0 comments on commit 839c262

Please sign in to comment.