What is IPACL?
ipacl is a very simple library to control access based on DNS entries.
If you want real security, this library is not for you: I'm mostly using it to keep bots out of my personal stuff.
Using IPACL
cmd/ipacl.go
is an example program which uses the library.
Creating a new 'acl object'
// Create a new ACL object, allowing access for IPs listed in A and AAAA records for the given hosts.
acl := ipacl.New(ipacl.AclHost("example.com"), ipacl.AclHost("google.com"))
Check access
// Check if '1.2.3.4' is in any record of the configured hosts.
// Note that results are cached in the library for up to 3 seconds (obviously, DNS caches also apply).
if ok := acl.CheckIP(ctx, net.ParseIP("1.2.3.4")); ok {
fmt.Printf("Access granted!")
}