mirror of
https://github.com/openziti/zrok.git
synced 2025-08-17 19:31:12 +02:00
roughed in limits model that incorporates bandwidth limit specs (#235)
This commit is contained in:
51
controller/limits/model.go
Normal file
51
controller/limits/model.go
Normal file
@ -0,0 +1,51 @@
|
||||
package limits
|
||||
|
||||
import "time"
|
||||
|
||||
const Unlimited = -1
|
||||
|
||||
type Config struct {
|
||||
Environments int
|
||||
Shares int
|
||||
Bandwidth *BandwidthConfig
|
||||
}
|
||||
|
||||
type BandwidthConfig struct {
|
||||
PerAccount *BandwidthPerPeriod
|
||||
PerEnvironment *BandwidthPerPeriod
|
||||
PerShare *BandwidthPerPeriod
|
||||
}
|
||||
|
||||
type BandwidthPerPeriod struct {
|
||||
Period time.Duration
|
||||
Rx int64
|
||||
Tx int64
|
||||
Total int64
|
||||
}
|
||||
|
||||
func DefaultConfig() *Config {
|
||||
return &Config{
|
||||
Environments: Unlimited,
|
||||
Shares: Unlimited,
|
||||
Bandwidth: &BandwidthConfig{
|
||||
PerAccount: &BandwidthPerPeriod{
|
||||
Period: 365 * (24 * time.Hour),
|
||||
Rx: Unlimited,
|
||||
Tx: Unlimited,
|
||||
Total: Unlimited,
|
||||
},
|
||||
PerEnvironment: &BandwidthPerPeriod{
|
||||
Period: 365 * (24 * time.Hour),
|
||||
Rx: Unlimited,
|
||||
Tx: Unlimited,
|
||||
Total: Unlimited,
|
||||
},
|
||||
PerShare: &BandwidthPerPeriod{
|
||||
Period: 365 * (24 * time.Hour),
|
||||
Rx: Unlimited,
|
||||
Tx: Unlimited,
|
||||
Total: Unlimited,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user