mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 23:04:02 +03:00
FILE / ScuroNeko/mtg
stats/stream_info.go
Исходный файл и его история в репозитории.
29 lines
483 B
Go
29 lines
483 B
Go
package stats
|
|
|
|
import statsd "github.com/smira/go-statsd"
|
|
|
|
type streamInfo struct {
|
|
isDomainFronted bool
|
|
tags map[string]string
|
|
}
|
|
|
|
func (s streamInfo) T(key string) statsd.Tag {
|
|
return statsd.StringTag(key, s.tags[key])
|
|
}
|
|
|
|
func (s *streamInfo) Reset() {
|
|
s.isDomainFronted = false
|
|
|
|
for k := range s.tags {
|
|
delete(s.tags, k)
|
|
}
|
|
}
|
|
|
|
func getDirection(isRead bool) string {
|
|
if isRead { // for telegram
|
|
return TagDirectionToClient
|
|
}
|
|
|
|
return TagDirectionFromClient
|
|
}
|