mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 05:31:18 +08:00
Fix: new tracker crash when rule is nil
This commit is contained in:
parent
82a8c03953
commit
6d375ac37e
@ -56,6 +56,11 @@ func (tt *tcpTracker) Close() error {
|
|||||||
|
|
||||||
func newTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.Rule) *tcpTracker {
|
func newTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.Rule) *tcpTracker {
|
||||||
uuid, _ := uuid.NewV4()
|
uuid, _ := uuid.NewV4()
|
||||||
|
ruleType := ""
|
||||||
|
if rule != nil {
|
||||||
|
ruleType = rule.RuleType().String()
|
||||||
|
}
|
||||||
|
|
||||||
t := &tcpTracker{
|
t := &tcpTracker{
|
||||||
Conn: conn,
|
Conn: conn,
|
||||||
manager: manager,
|
manager: manager,
|
||||||
@ -64,7 +69,7 @@ func newTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.R
|
|||||||
Start: time.Now(),
|
Start: time.Now(),
|
||||||
Metadata: metadata,
|
Metadata: metadata,
|
||||||
Chain: conn.Chains(),
|
Chain: conn.Chains(),
|
||||||
Rule: rule.RuleType().String(),
|
Rule: ruleType,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +110,11 @@ func (ut *udpTracker) Close() error {
|
|||||||
|
|
||||||
func newUDPTracker(conn C.PacketConn, manager *Manager, metadata *C.Metadata, rule C.Rule) *udpTracker {
|
func newUDPTracker(conn C.PacketConn, manager *Manager, metadata *C.Metadata, rule C.Rule) *udpTracker {
|
||||||
uuid, _ := uuid.NewV4()
|
uuid, _ := uuid.NewV4()
|
||||||
|
ruleType := ""
|
||||||
|
if rule != nil {
|
||||||
|
ruleType = rule.RuleType().String()
|
||||||
|
}
|
||||||
|
|
||||||
ut := &udpTracker{
|
ut := &udpTracker{
|
||||||
PacketConn: conn,
|
PacketConn: conn,
|
||||||
manager: manager,
|
manager: manager,
|
||||||
@ -113,7 +123,7 @@ func newUDPTracker(conn C.PacketConn, manager *Manager, metadata *C.Metadata, ru
|
|||||||
Start: time.Now(),
|
Start: time.Now(),
|
||||||
Metadata: metadata,
|
Metadata: metadata,
|
||||||
Chain: conn.Chains(),
|
Chain: conn.Chains(),
|
||||||
Rule: rule.RuleType().String(),
|
Rule: ruleType,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user