filter

package
v0.0.0-...-ce94876 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2019 License: MIT, MIT Imports: 4 Imported by: 0

README

go-maddr-filter

Coverage Status Travis CI

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.AddDialFilter(ipnet)


// check if an address is blocked
lanaddr, _ := ma.NewMultiaddr("/ip4/192.168.0.17/tcp/4050")
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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filters

type Filters struct {
	// contains filtered or unexported fields
}

func NewFilters

func NewFilters() *Filters

func (*Filters) AddDialFilter

func (fs *Filters) AddDialFilter(f *net.IPNet)

func (*Filters) AddrBlocked

func (f *Filters) AddrBlocked(a ma.Multiaddr) bool

func (*Filters) Filters

func (f *Filters) Filters() []*net.IPNet

func (*Filters) Remove

func (f *Filters) Remove(ff *net.IPNet)

Jump to

Keyboard shortcuts

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