1
1
mirror of https://git.sr.ht/~emersion/tlstunnel synced 2024-11-19 15:53:50 +01:00

Remove file limit bump

Starting with Go 1.19 [0] the file limit is increased by default.

[0]: 8427429c59
This commit is contained in:
Tom Lebreux 2024-05-08 20:55:52 -04:00 committed by Simon Ser
parent 109d44b113
commit c888547e5b

@ -51,27 +51,11 @@ func newServer() (*tlstunnel.Server, error) {
return srv, nil return srv, nil
} }
func bumpOpenedFileLimit() error {
var rlimit syscall.Rlimit
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit); err != nil {
return fmt.Errorf("failed to get RLIMIT_NOFILE: %v", err)
}
rlimit.Cur = rlimit.Max
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit); err != nil {
return fmt.Errorf("failed to set RLIMIT_NOFILE: %v", err)
}
return nil
}
func main() { func main() {
flag.StringVar(&configPath, "config", configPath, "path to configuration file") flag.StringVar(&configPath, "config", configPath, "path to configuration file")
flag.BoolVar(&debug, "debug", false, "enable debug logging") flag.BoolVar(&debug, "debug", false, "enable debug logging")
flag.Parse() flag.Parse()
if err := bumpOpenedFileLimit(); err != nil {
log.Printf("failed to bump max number of opened files: %v", err)
}
srv, err := newServer() srv, err := newServer()
if err != nil { if err != nil {
log.Fatalf("failed to create server: %v", err) log.Fatalf("failed to create server: %v", err)