MCPcopy
hub / github.com/perkeep/perkeep / TestParseLinuxTCPStat4

Function TestParseLinuxTCPStat4

internal/netutil/ident_test.go:179–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

177}
178
179func TestParseLinuxTCPStat4(t *testing.T) {
180 lip, lport := net.ParseIP("67.218.110.129"), 43436
181 rip, rport := net.ParseIP("207.7.148.195"), 80
182
183 // 816EDA43:A9AC C39407CF:0050
184 // 43436 80
185 uid, err := uidFromProcReader(lip, lport, rip, rport, strings.NewReader(tcpstat4))
186 if err != nil {
187 t.Error(err)
188 }
189 if e, g := 61652, uid; e != g {
190 t.Errorf("expected uid %d, got %d", e, g)
191 }
192}
193
194var tcpstat4 = ` sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
1950: 0100007F:C204 00000000:0000 0A 00000000:00000000 00:00000000 00000000 61652 0 8722922 1 ffff880036b36180 300 0 0 2 -1

Callers

nothing calls this directly

Calls 2

uidFromProcReaderFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected