Add EventTraffic

This commit is contained in:
9seconds
2021-03-22 17:54:46 +03:00
parent 925a02dac3
commit 42160a08fe
18 changed files with 569 additions and 55 deletions
+16 -4
View File
@@ -6,12 +6,24 @@ import (
)
type streamInfo struct {
createdAt time.Time
clientIP net.IP
createdAt time.Time
clientIP net.IP
remoteIP net.IP
dc int
bytesSentToTelegram uint
bytesRecvFromTelegram uint
}
func (s *streamInfo) IPType() string {
if s.clientIP.To4() == nil {
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
}