gnutls_transport_set_fastopen(3)

✨ gnutls_transport_set_fastopen ✨

okay bestie so this one is from the gnutls manual, and it's literally an API function, which is the most iconic genre of function there is πŸ’…


🌸 NAME 🌸

gnutls_transport_set_fastopen β€” an API function, periodt.


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <gnutls/socket.h>

void gnutls_transport_set_fastopen(gnutls_session_t session, int fd,
struct sockaddr * connect_addr, socklen_t connect_addrlen, unsigned int
flags);

πŸ’– ARGUMENTS πŸ’–

  • gnutls_session_t session β€” bestie this is a gnutls_session_t type, that's the whole vibe.
  • int fd β€” the session's socket descriptor 🫢
  • struct sockaddr * connect_addr β€” the address we wanna connect to, the destination, the place we're going ✨
  • socklen_t connect_addrlen β€” the length of connect_addr, gotta know how big it is
  • unsigned int flags β€” must be zero. that's it. zero. no notes. 🚫

πŸŽ€ DESCRIPTION πŸŽ€

So this function enables TCP Fast Open (TFO) for the TLS client session you point it at πŸ”₯ and like, what even is TFO? it means the TCP connection establishment and the transmission of the first TLS client hello packet get combined into one glorious moment. two things, one step, slay.

The peer's address has to be specified in connect_addr and connect_addrlen, obvi. and the socket specified by fd should not be connected β€” like, leave it unconnected, that's the point.

TFO only works for TCP sockets of type AF_INET and AF_INET6. that's the whole list, no cap.

And if your OS doesn't support TCP fast open? no biggie, the function will result in gnutls using connect() transparently during the first write. it just handles it for you, lowkey iconic of it honestly.


πŸ’€ NOTE πŸ’€

heads up bestie, this part matters.

This function overrides all the transport callback functions. the way that it just takes over everything 😭 if that's undesirable to you, then TCP Fast Open must be implemented on the user callback functions without calling this function. iykyk.

When using this function, transport callbacks must not be set, and gnutls_transport_set_ptr() or gnutls_transport_set_int() must not be called. do not do it. don't even think about it πŸ™ˆ

On GNU/Linux, TFO has to be enabled at the system layer, that is in /proc/sys/net/ipv4/tcp_fastopen, bit 0 has to be set. so like, go set bit 0 if you want this to actually work πŸ’…

Also: this function has no effect on server sessions. server girlies, this is not for you. sorry not sorry.


⭐ SINCE ⭐

3.5.3 β€” vintage, but make it fast open.


πŸ› REPORTING BUGS πŸ›

Report bugs to <bugs@gnutls.org>. they want to hear from you fr fr.

Home page: https://www.gnutls.org


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. yes bestie, go forth and distribute ✨


🌈 SEE ALSO 🌈

The full documentation for gnutls is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:

https://www.gnutls.org/manual/


and that's the whole page, no crumbs left πŸ“ this was gnutls version 3.8.13, the gnutls_transport_set_fastopen(3) page β€” mwah, take care of her πŸ’œ

πŸ“¦ where this page comes from