-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
service.go
25 lines (20 loc) · 941 Bytes
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2020 The Cockroach Authors.
//
// Licensed as a CockroachDB Enterprise file under the Cockroach Community
// License (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// https://github.com/cockroachdb/cockroach/blob/master/licenses/CCL.txt
package admitter
import "time"
// Service provides the interface for performing admission checks before
// allowing requests into sqlproxy.
type Service interface {
// AllowRequest determines whether a request should be allowed to proceed. It
// rate limits requests from IP addresses regardless of tenant id.
AllowRequest(ipAddress string, now time.Time) error
// RequestSuccess records the result of a successful request.
RequestSuccess(ipAddress string, tenID uint64)
// KnownClient checks if this client has connected successfully before.
KnownClient(ipAddress string, tenID uint64) bool
}