diff --git a/tunnel/tracker.go b/tunnel/tracker.go index 2be522039..c88716973 100644 --- a/tunnel/tracker.go +++ b/tunnel/tracker.go @@ -21,6 +21,7 @@ type trackerInfo struct { Start time.Time `json:"start"` Chain C.Chain `json:"chains"` Rule string `json:"rule"` + RulePayload string `json:"rulePayload"` } type tcpTracker struct { @@ -56,10 +57,6 @@ func (tt *tcpTracker) Close() error { func newTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.Rule) *tcpTracker { uuid, _ := uuid.NewV4() - ruleType := "" - if rule != nil { - ruleType = rule.RuleType().String() - } t := &tcpTracker{ Conn: conn, @@ -69,10 +66,15 @@ func newTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.R Start: time.Now(), Metadata: metadata, Chain: conn.Chains(), - Rule: ruleType, + Rule: "", }, } + if rule != nil { + t.trackerInfo.Rule = rule.RuleType().String() + t.trackerInfo.RulePayload = rule.Payload() + } + manager.Join(t) return t } @@ -118,10 +120,6 @@ func (ut *udpTracker) Close() error { func newUDPTracker(conn C.PacketConn, manager *Manager, metadata *C.Metadata, rule C.Rule) *udpTracker { uuid, _ := uuid.NewV4() - ruleType := "" - if rule != nil { - ruleType = rule.RuleType().String() - } ut := &udpTracker{ PacketConn: conn, @@ -131,10 +129,15 @@ func newUDPTracker(conn C.PacketConn, manager *Manager, metadata *C.Metadata, ru Start: time.Now(), Metadata: metadata, Chain: conn.Chains(), - Rule: ruleType, + Rule: "", }, } + if rule != nil { + ut.trackerInfo.Rule = rule.RuleType().String() + ut.trackerInfo.RulePayload = rule.Payload() + } + manager.Join(ut) return ut }