1
1
mirror of https://git.sr.ht/~emersion/tlstunnel synced 2024-09-14 22:00:37 +02: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

View File

@ -51,27 +51,11 @@ func newServer() (*tlstunnel.Server, error) {
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() {
flag.StringVar(&configPath, "config", configPath, "path to configuration file")
flag.BoolVar(&debug, "debug", false, "enable debug logging")
flag.Parse()
if err := bumpOpenedFileLimit(); err != nil {
log.Printf("failed to bump max number of opened files: %v", err)
}
srv, err := newServer()
if err != nil {
log.Fatalf("failed to create server: %v", err)