Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

sockopts_keepalive_openbsd.go 901B

1234567891011121314151617181920
  1. package network
  2. import "net"
  3. // applyKeepAlive enables (or disables) TCP keepalive on conn.
  4. //
  5. // OpenBSD has no user-settable per-socket TCP keepalive options: TCP_KEEPIDLE,
  6. // TCP_KEEPINTVL and TCP_KEEPCNT do not exist on OpenBSD, and Go's
  7. // (*TCPConn).SetKeepAliveConfig therefore returns ENOPROTOOPT ("protocol not
  8. // available") for any non-negative Idle/Interval/Count value (see
  9. // src/net/tcpsockopt_openbsd.go in the Go source tree). Calling
  10. // SetKeepAliveConfig with mtg's defaults (zero values) breaks every accepted
  11. // listener connection and every outbound dial on OpenBSD.
  12. //
  13. // On OpenBSD we only flip SO_KEEPALIVE on or off; the keepalive timing is
  14. // controlled system-wide via the sysctl knobs net.inet.tcp.keepidle and
  15. // net.inet.tcp.keepintvl.
  16. func applyKeepAlive(conn *net.TCPConn, cfg net.KeepAliveConfig) error {
  17. return conn.SetKeepAlive(cfg.Enable) //nolint: wrapcheck
  18. }