FILE / ScuroNeko/mtg

stats/stream_info.go

Исходный файл и его история в репозитории.
FILE e3b7472239e5e9eadc447e66db5b02c8d944c3fc
Files
mtg/stats/stream_info.go
T
2021-03-22 17:54:46 +03:00

32 lines
536 B
Go

package stats
import (
"net"
"time"
)
type streamInfo struct {
createdAt time.Time
clientIP net.IP
remoteIP net.IP
dc int
bytesSentToTelegram uint
bytesRecvFromTelegram uint
}
func (s *streamInfo) GetClientIPType() string {
return s.getIPType(s.clientIP)
}
func (s *streamInfo) GetRemoteIPType() string {
return s.getIPType(s.remoteIP)
}
func (s *streamInfo) getIPType(ip net.IP) string {
if ip.To4() == nil {
return TagIPTypeIPv6
}
return TagIPTypeIPv4
}