mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 01:54:02 +03:00
FILE / ScuroNeko/mtg
stats/stream_info.go
Исходный файл и его история в репозитории.
32 lines
536 B
Go
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
|
|
}
|