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
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425
  1. //+build !windows
  2. package rlimit
  3. import (
  4. "github.com/juju/errors"
  5. "golang.org/x/sys/unix"
  6. )
  7. func Set() (err error) {
  8. rLimit := unix.RLimit{}
  9. err = unix.Getrlimit(unix.RLIMIT_NOFILE, &rLimit)
  10. if err != nil {
  11. err = errors.Annotate(err, "Cannot get rlimit")
  12. return
  13. }
  14. rLimit.Cur = rLimit.Max
  15. err = unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit)
  16. if err != nil {
  17. err = errors.Annotate(err, "Cannot set rlimit")
  18. }
  19. return
  20. }