ipacl

module
v0.0.0-...-129829b Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT

README

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!")
  }

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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