Skip to content
This repository was archived by the owner on May 14, 2020. It is now read-only.
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: libp2p/go-maddr-filter
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2a8da796f6ccc708ff3c073d7a4b7bd42c35df50
Choose a base ref
..
head repository: libp2p/go-maddr-filter
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0bf6dc037c7468ae965aea9b2e9703f6ffd64540
Choose a head ref
Showing with 4 additions and 4 deletions.
  1. +4 −4 filter.go
8 changes: 4 additions & 4 deletions filter.go
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import (

type FilterEntry struct {
f *net.IPNet
accept bool
reject bool
}

type Filters struct {
@@ -29,13 +29,13 @@ func NewFilters() *Filters {
func (fs *Filters) AddDialFilter(f *net.IPNet) {
fs.mu.Lock()
defer fs.mu.Unlock()
fs.filters[f.String()] = &FilterEntry{f: f, accept: true}
fs.filters[f.String()] = &FilterEntry{f: f, reject: true}
}

func (fs *Filters) AddAllowFilter(f *net.IPNet) {
fs.mu.Lock()
defer fs.mu.Unlock()
fs.filters[f.String()] = &FilterEntry{f: f, accept: false}
fs.filters[f.String()] = &FilterEntry{f: f, reject: false}
}

func (f *Filters) AddrBlocked(a ma.Multiaddr) bool {
@@ -60,7 +60,7 @@ func (f *Filters) AddrBlocked(a ma.Multiaddr) bool {

for _, ft := range f.filters {
if ft.f.Contains(netip) {
flag = ft.accept
flag = ft.reject
}
}