-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sqlproxy: add basic login rate limiting using admitter
Let the user of the proxy provide an admitter interface for limiting client connections. If a connection form given succeeds we allow all future connections from client. The successes are cached in memory hence they will not survive across proxy restarts. Release note: none.
- Loading branch information
Spas Bojanov
committed
Nov 9, 2020
1 parent
e8a8982
commit 9f079b2
Showing
7 changed files
with
86 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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 sqlproxyccl | ||
|
||
import ( | ||
"crypto/tls" | ||
"time" | ||
) | ||
|
||
// Admitter provides the interface for performing admission checks before | ||
// allowing requests into sqlproxy. | ||
type Admitter interface { | ||
// LoginCheck determines whether a request should be allowed to proceed. | ||
LoginCheck(ipAddress string, now time.Time) error | ||
} | ||
|
||
// BackendConfig contains the configuration of a backend connection that is | ||
// being proxied. | ||
type BackendConfig struct { | ||
ClientID string | ||
Address string | ||
TLSConf *tls.Config | ||
Admitter Admitter | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters