mirror of https://github.com/libp2p/go-libp2p.git
Marten Seemann
4 years ago
4 changed files with 102 additions and 2 deletions
@ -0,0 +1,15 @@ |
|||
//+build darwin
|
|||
|
|||
package tcp |
|||
|
|||
import "github.com/mikioh/tcpinfo" |
|||
|
|||
const ( |
|||
hasSegmentCounter = true |
|||
hasByteCounter = true |
|||
) |
|||
|
|||
func getSegmentsSent(info *tcpinfo.Info) uint64 { return info.Sys.SegsSent } |
|||
func getSegmentsRcvd(info *tcpinfo.Info) uint64 { return info.Sys.SegsReceived } |
|||
func getBytesSent(info *tcpinfo.Info) uint64 { return info.Sys.BytesSent } |
|||
func getBytesRcvd(info *tcpinfo.Info) uint64 { return info.Sys.BytesReceived } |
@ -0,0 +1,15 @@ |
|||
//+build !linux,!darwin
|
|||
|
|||
package tcp |
|||
|
|||
import "github.com/mikioh/tcpinfo" |
|||
|
|||
const ( |
|||
hasSegmentCounter = false |
|||
hasByteCounter = false |
|||
) |
|||
|
|||
func getSegmentsSent(info *tcpinfo.Info) uint64 { return 0 } |
|||
func getSegmentsRcvd(info *tcpinfo.Info) uint64 { return 0 } |
|||
func getBytesSent(info *tcpinfo.Info) uint64 { return 0 } |
|||
func getBytesRcvd(info *tcpinfo.Info) uint64 { return 0 } |
@ -0,0 +1,15 @@ |
|||
//+build linux
|
|||
|
|||
package tcp |
|||
|
|||
import "github.com/mikioh/tcpinfo" |
|||
|
|||
const ( |
|||
hasSegmentCounter = true |
|||
hasByteCounter = false |
|||
) |
|||
|
|||
func getSegmentsSent(info *tcpinfo.Info) uint64 { return uint64(info.Sys.SegsOut) } |
|||
func getSegmentsRcvd(info *tcpinfo.Info) uint64 { return uint64(info.Sys.SegsIn) } |
|||
func getBytesSent(info *tcpinfo.Info) uint64 { return 0 } |
|||
func getBytesRcvd(info *tcpinfo.Info) uint64 { return 0 } |
Loading…
Reference in new issue