TCP max segment size

323 views
Skip to first unread message

Brieuc Jeunhomme

unread,
Oct 8, 2021, 1:05:40 PM10/8/21
to golang-nuts
Hi,

looking at the net package of the standard library, I don't see a way to set the tcp max segment size.  Surely, one can create a tcp connection manually and set the segment size by using the syscall package, but that approach prevents them from reusing higher level packages that want a net.Dialer, for example crypto/tls.  So in short, to create a tls connection in golang and set its TCP MSS, one has to reimplement tls, unless I missed something.

Would it make sense to have a dialer field for the MSS?

Sean Liao

unread,
Oct 8, 2021, 2:07:22 PM10/8/21
to golang-nuts
net.TCPConn.SyscallConn exposes the fd which you can use with sycalls

Brieuc Jeunhomme

unread,
Jan 4, 2022, 12:30:09 PM1/4/22
to golang-nuts
Thank you for your answer.  In case someone else is interested, the answer I was looking for was: the Dialer struct has an optional Control member, that the user can set.  It's a a function that will be called before the connect() syscall is issued, allowing to set whatever socket options before issuing the tcp connection.
Reply all
Reply to author
Forward
0 new messages