golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
121.22k stars 17.37k forks source link

net: add func (*TCPConn) MultipathTCP() (bool, error) #59166

Closed matttbe closed 1 year ago

matttbe commented 1 year ago

Hello,

While working on #56539, I noticed I misunderstood the use of MultipathTCP() when it was discussed.

Despite the fact Apple and others have been pushing to avoid that, it can happen some middleboxes explicitly or accidentally block MPTCP, e.g. transparent proxy, some firewalls blocking all TCP extensions, etc. When this happens, MPTCP connections will fallback to TCP and continue to work with only one path.

App developers explicitly requiring MPTCP might want to know if a fallback to TCP has been done. The idea would then be to add a method to check such a thing, e.g.

pkg net, method (*TCPConn) MultipathTCP() (bool, error)

Similar to other TCPConn methods (KeepAlive, No Delay, Linger, etc.), an error can be emitted if the connection is not OK.

The Linux kernel can tell us that: example.

A draft implementation has been shared on Gerrit.

gopherbot commented 1 year ago

Change https://go.dev/cl/471140 mentions this issue: net: mptcp: add UsingMultipathTCP checker

gopherbot commented 1 year ago

Change https://go.dev/cl/471139 mentions this issue: internal/poll: add GetsockoptInt

rsc commented 1 year ago

Given that the getter method on Listener and Dialer is just MultipathTCP, it seems like the TCPConn method should be that too (not Using...). Otherwise sounds good.

rsc commented 1 year ago

This proposal has been added to the active column of the proposals project and will now be reviewed at the weekly proposal review meetings. — rsc for the proposal review group

matttbe commented 1 year ago

Given that the getter method on Listener and Dialer is just MultipathTCP, it seems like the TCPConn method should be that too (not Using...). Otherwise sounds good.

@rsc: Thank you for having looked!

I'm fine with the shorter version (MultipathTCP).

@ianlancetaylor: you suggested adding this Using prefix. Is it OK for you without it?

ianlancetaylor commented 1 year ago

@matttbe MultipathTCP is fine with me. Thanks.

rsc commented 1 year ago

Based on the discussion above, this proposal seems like a likely accept. — rsc for the proposal review group

rsc commented 1 year ago

No change in consensus, so accepted. 🎉 This issue now tracks the work of implementing the proposal. — rsc for the proposal review group

gopherbot commented 1 year ago

Change https://go.dev/cl/498601 mentions this issue: doc/go1.21: mention multipath TCP support