]> Cypherpunks repositories - nncp.git/commitdiff
NNCP_PACKET and NNCP_ORIGIN
authorEugene Medvedev <rn3aoh.g@gmail.com>
Sun, 26 Oct 2025 11:07:18 +0000 (14:07 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 26 Oct 2025 11:07:18 +0000 (14:07 +0300)
src/node.go
src/toss.go

index 14ceda2b38267a60e3e72d863a0cde9fa7aad918..fc67390ba1e31ac694187d89bbd97e7e058c7da1 100644 (file)
@@ -57,6 +57,7 @@ type Node struct {
        OnlineDeadline time.Duration
        MaxOnlineTime  time.Duration
        Calls          []*Call
+       Origin         *NodeId
 
        Busy bool
        sync.Mutex
index 4d3ceecd22d7703b7628be7e5be2ff129aa3aa44..e71496c3611b9cc378b31a150e1ba2b3894e1dae 100644 (file)
@@ -185,10 +185,16 @@ func jobProcess(
                }
                if !opts.DryRun {
                        cmd := exec.Command(cmdline[0], append(cmdline[1:], args...)...)
+                       origin := sender.Id.String()
+                       if sender.Origin != nil {
+                               origin = sender.Origin.String()
+                       }
                        cmd.Env = append(
                                cmd.Env,
                                "NNCP_SELF="+ctx.Self.Id.String(),
                                "NNCP_SENDER="+sender.Id.String(),
+                               "NNCP_PACKET="+pktName,
+                               "NNCP_ORIGIN="+origin,
                                "NNCP_NICE="+strconv.Itoa(int(pkt.Nice)),
                        )
                        if pkt.Type == PktTypeExec {
@@ -903,6 +909,7 @@ func jobProcess(
                                Name:     area.Name,
                                Incoming: area.Incoming,
                                Exec:     area.Exec,
+                               Origin:   pktEnc.Sender,
                        }
                        copy(areaNode.Id[:], area.Id[:])
                        pktName := fmt.Sprintf(