Improve logging, improve rate limit, add running main Router

This commit is contained in:
Pablu23
2024-09-20 12:45:51 +02:00
parent 1dd90bbe88
commit c3066da440
6 changed files with 176 additions and 45 deletions

17
util/constmap.go Normal file
View File

@@ -0,0 +1,17 @@
package util
// ImmutableMap for disallowing change of elements during runtime, for threadsafty
type ImmutableMap[K comparable, V any] struct {
dirty map[K]V
}
func NewImmutableMap[K comparable, V any](m map[K]V) *ImmutableMap[K, V] {
return &ImmutableMap[K, V]{
dirty: m,
}
}
func (m *ImmutableMap[K, V]) Get(key K) (value V, ok bool) {
value, ok = m.dirty[key]
return value, ok
}