Skip to content

Commit cf8b322

Browse files
committed
stat: args, env, executable
1 parent 910da8e commit cf8b322

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

intra/backend/netstat.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ type GoStat struct {
228228
NumGoroutine int64 // number of goroutines
229229
NumCgo int64 // number of cgo calls
230230
NumCPU int64 // number of CPUs
231+
232+
Pers string // personality
233+
Args string // command line arguments
234+
Env string // environment variables
231235
}
232236

233237
// NetStat is a collection of network engine statistics.

intra/tunnel.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"errors"
2929
"fmt"
3030
"net/netip"
31+
"os"
3132
"runtime"
3233
"strconv"
3334
"strings"
@@ -517,6 +518,10 @@ func (t *rtunnel) stat() (*x.NetStat, error) {
517518
out.GOSt.NumCgo = int64(runtime.NumCgoCall())
518519
out.GOSt.NumCPU = int64(runtime.NumCPU())
519520

521+
out.GOSt.Args = strings.Join(os.Args, ";")
522+
out.GOSt.Env = strings.Join(os.Environ(), ";")
523+
out.GOSt.Pers, _ = os.Executable()
524+
520525
if r := t.resolver; r != nil {
521526
out.RDNSIn.DNSPreferred = fetchDNSInfo(r, x.Preferred)
522527
out.RDNSIn.DNSDefault = fetchDNSInfo(r, x.Default)

0 commit comments

Comments
 (0)