diff --git a/config/types/categoryLimitConfig.go b/config/types/categoryLimitConfig.go new file mode 100644 index 0000000..3d86946 --- /dev/null +++ b/config/types/categoryLimitConfig.go @@ -0,0 +1,8 @@ +package config + +type CategoryLimitConfig struct { + Regular LimitBurst `yaml:"regular"` + Replaceable LimitBurst `yaml:"replaceable"` + ParameterizedReplaceable LimitBurst `yaml:"parameterized_replaceable"` + Ephemeral LimitBurst `yaml:"ephemeral"` +} \ No newline at end of file diff --git a/config/types/kindLimitConfig.go b/config/types/kindLimitConfig.go new file mode 100644 index 0000000..4a37a3a --- /dev/null +++ b/config/types/kindLimitConfig.go @@ -0,0 +1,7 @@ +package config + +type KindLimitConfig struct { + Kind int `yaml:"kind"` + Limit float64 `yaml:"limit"` + Burst int `yaml:"burst"` +} \ No newline at end of file diff --git a/config/types/kindSizeLimitConfig.go b/config/types/kindSizeLimitConfig.go new file mode 100644 index 0000000..f29203b --- /dev/null +++ b/config/types/kindSizeLimitConfig.go @@ -0,0 +1,6 @@ +package config + +type KindSizeLimitConfig struct { + Kind int `yaml:"kind"` + MaxSize int `yaml:"max_size"` +} \ No newline at end of file diff --git a/config/types/limitBurst.go b/config/types/limitBurst.go new file mode 100644 index 0000000..f3e1f13 --- /dev/null +++ b/config/types/limitBurst.go @@ -0,0 +1,6 @@ +package config + +type LimitBurst struct { + Limit float64 `yaml:"limit"` + Burst int `yaml:"burst"` +} \ No newline at end of file diff --git a/config/types/new.go b/config/types/new.go deleted file mode 100644 index c9c492a..0000000 --- a/config/types/new.go +++ /dev/null @@ -1,48 +0,0 @@ -package config - -type ServerConfig struct { - MongoDB struct { - URI string `yaml:"uri"` - Database string `yaml:"database"` - } `yaml:"mongodb"` - Server struct { - Port string `yaml:"port"` - } `yaml:"server"` - RateLimit RateLimitConfig `yaml:"rate_limit"` -} - -type LimitBurst struct { - Limit float64 `yaml:"limit"` - Burst int `yaml:"burst"` -} - -type KindSizeLimitConfig struct { - Kind int `yaml:"kind"` - MaxSize int `yaml:"max_size"` -} - -type RateLimitConfig struct { - WsLimit float64 `yaml:"ws_limit"` - WsBurst int `yaml:"ws_burst"` - EventLimit float64 `yaml:"event_limit"` - EventBurst int `yaml:"event_burst"` - ReqLimit float64 `yaml:"req_limit"` - ReqBurst int `yaml:"req_burst"` - MaxEventSize int `yaml:"max_event_size"` - KindSizeLimits []KindSizeLimitConfig `yaml:"kind_size_limits"` - CategoryLimits map[string]KindLimitConfig `yaml:"category_limits"` - KindLimits []KindLimitConfig `yaml:"kind_limits"` -} - -type CategoryLimitConfig struct { - Regular LimitBurst `yaml:"regular"` - Replaceable LimitBurst `yaml:"replaceable"` - ParameterizedReplaceable LimitBurst `yaml:"parameterized_replaceable"` - Ephemeral LimitBurst `yaml:"ephemeral"` -} - -type KindLimitConfig struct { - Kind int `yaml:"kind"` - Limit float64 `yaml:"limit"` - Burst int `yaml:"burst"` -} \ No newline at end of file diff --git a/config/types/rateLimitConfig.go b/config/types/rateLimitConfig.go new file mode 100644 index 0000000..8215a97 --- /dev/null +++ b/config/types/rateLimitConfig.go @@ -0,0 +1,14 @@ +package config + +type RateLimitConfig struct { + WsLimit float64 `yaml:"ws_limit"` + WsBurst int `yaml:"ws_burst"` + EventLimit float64 `yaml:"event_limit"` + EventBurst int `yaml:"event_burst"` + ReqLimit float64 `yaml:"req_limit"` + ReqBurst int `yaml:"req_burst"` + MaxEventSize int `yaml:"max_event_size"` + KindSizeLimits []KindSizeLimitConfig `yaml:"kind_size_limits"` + CategoryLimits map[string]KindLimitConfig `yaml:"category_limits"` + KindLimits []KindLimitConfig `yaml:"kind_limits"` +} \ No newline at end of file diff --git a/config/types/serverConfig.go b/config/types/serverConfig.go new file mode 100644 index 0000000..fbb1185 --- /dev/null +++ b/config/types/serverConfig.go @@ -0,0 +1,12 @@ +package config + +type ServerConfig struct { + MongoDB struct { + URI string `yaml:"uri"` + Database string `yaml:"database"` + } `yaml:"mongodb"` + Server struct { + Port string `yaml:"port"` + } `yaml:"server"` + RateLimit RateLimitConfig `yaml:"rate_limit"` +} \ No newline at end of file