Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ripexz committed Jun 16, 2020
1 parent a46e64c commit f235d7f
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ Based on [https://github.com/tomasen/realip](https://github.com/tomasen/realip).

### Features

- Follows the rule of X-Real-IP
- Follows the rule of X-Forwarded-For
- Exclude local or private address
- Parses IPs from `X-Real-IP`
- Parses IPs from `X-Forwarded-For`
- Excludes local/private address by default
- Custom filtering options for `X-Forwarded-For` IPs

## Example
## Examples

### Basic usage

```go
package main
Expand All @@ -24,6 +27,21 @@ func (h *Handler) ServeIndexPage(w http.ResponseWriter, r *http.Request, ps http
}
```

### AWS ELB

```go
clientIP := rip.FromRequest(r, rip.FilterAWS)
```

### Custom Filtering

```go
clientIP := rip.FromRequest(r, func(ips []string) (string, bool) {
// your custom logic here
return "127.0.0.1", true
})
```

## Contributing

Please make sure your code:
Expand Down

0 comments on commit f235d7f

Please sign in to comment.