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>
jknodt/bw_rep2
julianknodt 3 years ago committed by Brad Fitzpatrick
parent 297b3d6fa4
commit 3687e5352b

@ -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 {

Loading…
Cancel
Save