diff options
Diffstat (limited to 'src/net/tcpsock.go')
-rw-r--r-- | src/net/tcpsock.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/net/tcpsock.go b/src/net/tcpsock.go index f736f5a878..358e48723b 100644 --- a/src/net/tcpsock.go +++ b/src/net/tcpsock.go @@ -219,6 +219,22 @@ func (c *TCPConn) SetNoDelay(noDelay bool) error { return nil } +// MultipathTCP reports whether the ongoing connection is using MPTCP. +// +// If Multipath TCP is not supported by the host, by the other peer or +// intentionally / accidentally filtered out by a device in between, a +// fallback to TCP will be done. This method does its best to check if +// MPTCP is still being used or not. +// +// On Linux, more conditions are verified on kernels >= v5.16, improving +// the results. +func (c *TCPConn) MultipathTCP() (bool, error) { + if !c.ok() { + return false, syscall.EINVAL + } + return isUsingMultipathTCP(c.fd), nil +} + func newTCPConn(fd *netFD, keepAlive time.Duration, keepAliveHook func(time.Duration)) *TCPConn { setNoDelay(fd, true) if keepAlive == 0 { |