okay idk why i did that, revert the names
This commit is contained in:
+2
-2
@@ -40,12 +40,12 @@ func main() {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
tracker := uploads.New()
|
tracker := uploads.NewAccessTracker()
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
go tracker.Run(ctx, db)
|
go tracker.Run(ctx, db)
|
||||||
|
|
||||||
challengeStore := reports.New(3 * time.Minute)
|
challengeStore := reports.NewChallengeStore(3 * time.Minute)
|
||||||
|
|
||||||
log.Println("listening on", config.Addr)
|
log.Println("listening on", config.Addr)
|
||||||
router := server.NewRouter(db, config, pages, tracker, challengeStore)
|
router := server.NewRouter(db, config, pages, tracker, challengeStore)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type ChallengeStore struct {
|
|||||||
|
|
||||||
const MaxChallenges = 10000
|
const MaxChallenges = 10000
|
||||||
|
|
||||||
func New(ttl time.Duration) *ChallengeStore {
|
func NewChallengeStore(ttl time.Duration) *ChallengeStore {
|
||||||
if ttl <= 0 || ttl > 10*time.Minute {
|
if ttl <= 0 || ttl > 10*time.Minute {
|
||||||
panic("invalid challenge ttl")
|
panic("invalid challenge ttl")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ type AccessTracker struct {
|
|||||||
pending map[string]int64
|
pending map[string]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func New() *AccessTracker {
|
func NewAccessTracker() *AccessTracker {
|
||||||
return &AccessTracker{
|
return &AccessTracker{
|
||||||
pending: make(map[string]int64),
|
pending: make(map[string]int64),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user