36 lines
448 B
Go
36 lines
448 B
Go
package botfilter
|
|
|
|
import (
|
|
"sync"
|
|
"time"
|
|
)
|
|
|
|
type scoreEvent struct {
|
|
at time.Time
|
|
points int
|
|
}
|
|
|
|
type clientState struct {
|
|
banUntil time.Time
|
|
lastSeen time.Time
|
|
requests int
|
|
sawHome bool
|
|
sawStatic bool
|
|
sawFavicon bool
|
|
events []scoreEvent
|
|
}
|
|
|
|
type requestObservation struct {
|
|
at time.Time
|
|
paths []string
|
|
points int
|
|
forceBan bool
|
|
}
|
|
|
|
type cacheResult struct {
|
|
banned bool
|
|
banUntil time.Time
|
|
score int
|
|
}
|
|
|