derp: fix traffic handler peer addresses

Before it was using the local address and port, so fix that.
The fields in the response from `ss` are:

State, Recv-Q, Send-Q, Local Address:Port, Peer Address:Port, Process

Signed-off-by: julianknodt <julianknodt@gmail.com>
This commit is contained in:
julianknodt 2021-06-18 16:02:41 -07:00 committed by Brad Fitzpatrick
parent 297b3d6fa4
commit 3687e5352b

View File

@ -1435,17 +1435,10 @@ func parseSSOutput(raw string) map[netaddr.IPPort]BytesSentRecv {
if len(ipInfo) < 5 { if len(ipInfo) < 5 {
continue continue
} }
src, err := netaddr.ParseIPPort(ipInfo[3]) src, err := netaddr.ParseIPPort(ipInfo[4])
if err != nil { if err != nil {
continue continue
} }
/*
TODO(jknodt) do we care about the full route or just the src?
dst, err := netaddr.ParseIPPort(string(ipInfo[4]))
if err != nil {
continue
}
*/
stats := strings.Fields(strings.TrimSpace(lines[i+1])) stats := strings.Fields(strings.TrimSpace(lines[i+1]))
stat := BytesSentRecv{} stat := BytesSentRecv{}
for _, s := range stats { for _, s := range stats {