add port filter for matcher
This commit is contained in:
1 parent
a697bf2e35
commit
3eca21104a
3 files changed
+152
-30
No files matched your search
+10
-1
@@ -113,8 +113,13 @@ func (p *localAdmission) Admit(ctx context.Context, addr string, opts ...admissi
|
||||
|
||||
matched := p.matched(addr)
|
||||
|
||||
return !p.options.whitelist && !matched ||
|
||||
b := !p.options.whitelist && !matched ||
|
||||
p.options.whitelist && matched
|
||||
|
||||
if !b {
|
||||
p.options.logger.Debugf("%s is denied", addr)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *localAdmission) periodReload(ctx context.Context) error {
|
||||
@@ -156,6 +161,10 @@ func (p *localAdmission) reload(ctx context.Context) error {
|
||||
inets = append(inets, inet)
|
||||
continue
|
||||
}
|
||||
if ipAddr, _ := net.ResolveIPAddr("ip", pattern); ipAddr != nil {
|
||||
p.options.logger.Debugf("resolve IP: %s -> %s", pattern, ipAddr)
|
||||
ips = append(ips, ipAddr.IP)
|
||||
}
|
||||
}
|
||||
|
||||
p.mu.Lock()
|
||||
|
||||
Reference in new issue
Block a user