Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 958 Bytes

File metadata and controls

27 lines (17 loc) · 958 Bytes

IP Filter

Build Status

Tiny Golang lib for IP filtering.

This is helpful to restrict access to some endpoints on public service (e.g debug endpoints)

Well, why not just use proper auth (e.g basic, oidc, oauth2)?

Because some endpoints are problematic to hide using auth, like debug or metrics endpoints.

Usage

Filters are in a form of Bool conditions that takes IP in a form of net.IP

type Condition func(net.IP) bool

You can chain multiple conditions with some logic using ipfilter.OR(...) ipfilter.AND(...)

This package also contain useful HTTP middleware integration.