|
|
@ -30,7 +30,7 @@ type tcpTracker struct { |
|
|
|
manager *Manager |
|
|
|
} |
|
|
|
|
|
|
|
func NewTCPTracker(conn net.Conn, metadata *M.Metadata, manager *Manager) *tcpTracker { |
|
|
|
func NewTCPTracker(conn net.Conn, metadata *M.Metadata, manager *Manager) net.Conn { |
|
|
|
id, _ := uuid.NewRandom() |
|
|
|
|
|
|
|
tt := &tcpTracker{ |
|
|
@ -49,6 +49,11 @@ func NewTCPTracker(conn net.Conn, metadata *M.Metadata, manager *Manager) *tcpTr |
|
|
|
return tt |
|
|
|
} |
|
|
|
|
|
|
|
// DefaultTCPTracker returns a new net.Conn(*tcpTacker) with default manager.
|
|
|
|
func DefaultTCPTracker(conn net.Conn, metadata *M.Metadata) net.Conn { |
|
|
|
return NewTCPTracker(conn, metadata, DefaultManager) |
|
|
|
} |
|
|
|
|
|
|
|
func (tt *tcpTracker) ID() string { |
|
|
|
return tt.UUID.String() |
|
|
|
} |
|
|
@ -81,7 +86,7 @@ type udpTracker struct { |
|
|
|
manager *Manager |
|
|
|
} |
|
|
|
|
|
|
|
func NewUDPTracker(conn net.PacketConn, metadata *M.Metadata, manager *Manager) *udpTracker { |
|
|
|
func NewUDPTracker(conn net.PacketConn, metadata *M.Metadata, manager *Manager) net.PacketConn { |
|
|
|
id, _ := uuid.NewRandom() |
|
|
|
|
|
|
|
ut := &udpTracker{ |
|
|
@ -100,6 +105,11 @@ func NewUDPTracker(conn net.PacketConn, metadata *M.Metadata, manager *Manager) |
|
|
|
return ut |
|
|
|
} |
|
|
|
|
|
|
|
// DefaultUDPTracker returns a new net.PacketConn(*udpTacker) with default manager.
|
|
|
|
func DefaultUDPTracker(conn net.PacketConn, metadata *M.Metadata) net.PacketConn { |
|
|
|
return NewUDPTracker(conn, metadata, DefaultManager) |
|
|
|
} |
|
|
|
|
|
|
|
func (ut *udpTracker) ID() string { |
|
|
|
return ut.UUID.String() |
|
|
|
} |
|
|
|