Add PipeCreateErrorCallback to handle pipe creation errors (#290)
* Add PipeCreateErrorCallback to handle pipe creation errors * Add test for FailtobanPipeCreateFail * Fix missing newline at end of file in pluginbase.go
This commit is contained in:
parent
295262fe68
commit
9fee039d93
9 changed files with 499 additions and 117 deletions
|
|
@ -64,7 +64,12 @@ func main() {
|
|||
UpstreamAuthFailureCallback: func(conn libplugin.ConnMetadata, method string, err error, allowmethods []string) {
|
||||
ip, _, _ := net.SplitHostPort(conn.RemoteAddr())
|
||||
failed, _ := cache.IncrementInt(ip, 1)
|
||||
log.Debugf("failtoban: %v auth failed %v times, max allowed %v", ip, failed, maxFailures)
|
||||
log.Debugf("failtoban: %v auth failed. current status: fail %v times, max allowed %v", ip, failed, maxFailures)
|
||||
},
|
||||
PipeCreateErrorCallback: func(remoteAddr string, err error) {
|
||||
ip, _, _ := net.SplitHostPort(remoteAddr)
|
||||
failed, _ := cache.IncrementInt(ip, 1)
|
||||
log.Debugf("failtoban: %v pipe create failed, reason %v. current status: fail %v times, max allowed %v", ip, err, failed, maxFailures)
|
||||
},
|
||||
}, nil
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue