filter

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 1 Imported by: 62 modules, 89 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

⚠️ DEPRECATED: Filters have been migrated to multiformats/go-multiaddr.

go-maddr-filter

Coverage Status Travis CI Discourse posts

A library to perform filtering of multiaddrs.

Table of Contents

Install

make install

Examples

// make a new filterset
f := NewFilters()

// filter out addresses on the 192.168 subnet
_, ipnet, _ := net.ParseCIDR("192.168.0.0/16")
f.AddFilter(ipnet, ActionDeny)

// check if an address is blocked
lanaddr, _ := ma.NewMultiaddr("/ip4/192.168.0.17/tcp/4050")
fmt.Println(f.AddrBlocked(lanaddr))

// the default for a filter is accept, but we can change that
f.RemoveLiteral(ipnet)
f.DefaultAction = ActionDeny
fmt.Println(f.AddrBlocked(lanaddr))

// we can now allow the local LAN, denying everything else
f.AddFilter(ipnet, ActionAccept)
fmt.Println(f.AddrBlocked(lanaddr))

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Jeromy Johnson


The last gx published version of this module was: 1.1.13: QmT6C5ebDy92zyRzdmSNyda5q7zkNXy68X47RDJiHpvaxd

Documentation

Index

Constants

View Source
const (
	// Deprecated. Use "github.com/multiformats/go-multiaddr".ActionNone instead.
	ActionNone = multiaddr.ActionNone
	// Deprecated. Use "github.com/multiformats/go-multiaddr".ActionAccept instead.
	ActionAccept = multiaddr.ActionAccept
	// Deprecated. Use "github.com/multiformats/go-multiaddr".ActionDeny instead.
	ActionDeny = multiaddr.ActionDeny
)

Variables

This section is empty.

Functions

func NewFilters

func NewFilters() *multiaddr.Filters

Deprecated. Use "github.com/multiformats/go-multiaddr".NewFilters instead.

Types

type Action added in v0.0.2

type Action = multiaddr.Action

Deprecated. Use "github.com/multiformats/go-multiaddr".Action instead.

type Filters

type Filters = multiaddr.Filters

Deprecated. Use "github.com/multiformats/go-multiaddr".Filters instead.

Jump to

Keyboard shortcuts

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