style: gofmt config.go after rebase
This commit is contained in:
parent
e23a3cab59
commit
f2b929dfbc
2 changed files with 26 additions and 25 deletions
|
|
@ -17,9 +17,9 @@ type Config struct {
|
|||
LogLevel string // debug | info | warn | error
|
||||
|
||||
// Per-IP fixed-window rate limits.
|
||||
PutLimit int // POST /v1/objects requests per window
|
||||
PutWindow time.Duration // window for PutLimit
|
||||
ChallengeLimit int // POST /v1/auth/challenge requests per window
|
||||
PutLimit int // POST /v1/objects requests per window
|
||||
PutWindow time.Duration // window for PutLimit
|
||||
ChallengeLimit int // POST /v1/auth/challenge requests per window
|
||||
ChallengeWindow time.Duration // window for ChallengeLimit
|
||||
|
||||
MaxPerSubject int // max claims stored per subject address
|
||||
|
|
@ -33,35 +33,35 @@ type Config struct {
|
|||
// configFile mirrors Config but keeps durations as strings so they can be
|
||||
// written as "5m" / "1m" in YAML (yaml.v3 does not parse time.Duration).
|
||||
type configFile struct {
|
||||
ListenAddr string `yaml:"listen_addr"`
|
||||
Audience string `yaml:"audience"`
|
||||
DataDir string `yaml:"data_dir"`
|
||||
LogLevel string `yaml:"log_level"`
|
||||
PutLimit int `yaml:"put_limit"`
|
||||
PutWindow string `yaml:"put_window"`
|
||||
ChallengeLimit int `yaml:"challenge_limit"`
|
||||
ListenAddr string `yaml:"listen_addr"`
|
||||
Audience string `yaml:"audience"`
|
||||
DataDir string `yaml:"data_dir"`
|
||||
LogLevel string `yaml:"log_level"`
|
||||
PutLimit int `yaml:"put_limit"`
|
||||
PutWindow string `yaml:"put_window"`
|
||||
ChallengeLimit int `yaml:"challenge_limit"`
|
||||
ChallengeWindow string `yaml:"challenge_window"`
|
||||
MaxPerSubject int `yaml:"max_per_subject"`
|
||||
ChallengeTTL string `yaml:"challenge_ttl"`
|
||||
SessionTTL string `yaml:"session_ttl"`
|
||||
MaxBodyBytes int64 `yaml:"max_body_bytes"`
|
||||
MaxPerSubject int `yaml:"max_per_subject"`
|
||||
ChallengeTTL string `yaml:"challenge_ttl"`
|
||||
SessionTTL string `yaml:"session_ttl"`
|
||||
MaxBodyBytes int64 `yaml:"max_body_bytes"`
|
||||
}
|
||||
|
||||
// DefaultConfig returns the built-in defaults.
|
||||
func DefaultConfig() Config {
|
||||
return Config{
|
||||
ListenAddr: ":8080",
|
||||
Audience: "trust.n1ko.dev",
|
||||
DataDir: "data", // persist objects; "" would be in-memory only
|
||||
LogLevel: "info",
|
||||
PutLimit: 60,
|
||||
PutWindow: time.Minute,
|
||||
ChallengeLimit: 30,
|
||||
ListenAddr: ":8080",
|
||||
Audience: "trust.n1ko.dev",
|
||||
DataDir: "data", // persist objects; "" would be in-memory only
|
||||
LogLevel: "info",
|
||||
PutLimit: 60,
|
||||
PutWindow: time.Minute,
|
||||
ChallengeLimit: 30,
|
||||
ChallengeWindow: time.Minute,
|
||||
MaxPerSubject: 1000,
|
||||
ChallengeTTL: 5 * time.Minute,
|
||||
SessionTTL: 30 * time.Minute,
|
||||
MaxBodyBytes: tce.MaxClaimTCE*2 + 1024,
|
||||
MaxPerSubject: 1000,
|
||||
ChallengeTTL: 5 * time.Minute,
|
||||
SessionTTL: 30 * time.Minute,
|
||||
MaxBodyBytes: tce.MaxClaimTCE*2 + 1024,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -380,6 +380,7 @@ func (s *Server) handleConfig(w http.ResponseWriter, r *http.Request) {
|
|||
writeJSON(w, http.StatusOK, map[string]string{"audience": s.audience})
|
||||
}
|
||||
|
||||
func (s *Server) handleChallenge(w http.ResponseWriter, r *http.Request) {
|
||||
ch := make([]byte, tce.ChallengeSize)
|
||||
if _, err := rand.Read(ch); err != nil {
|
||||
writeErr(w, http.StatusInternalServerError, "challenge")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue