1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2025-04-12 06:58:15 +02:00
imgproxy/main.go

29 lines
515 B
Go
Raw Normal View History

2017-06-20 16:58:55 +03:00
package main
import (
"log"
2017-09-15 13:29:51 +03:00
"net"
2017-06-20 16:58:55 +03:00
"net/http"
"time"
2017-09-15 13:29:51 +03:00
"golang.org/x/net/netutil"
2017-06-20 16:58:55 +03:00
)
func main() {
2017-09-15 13:29:51 +03:00
l, err := net.Listen("tcp", conf.Bind)
if err != nil {
log.Fatal(err)
}
2017-06-20 16:58:55 +03:00
s := &http.Server{
2017-07-04 20:05:53 +06:00
Handler: newHttpHandler(),
2017-06-20 16:58:55 +03:00
ReadTimeout: time.Duration(conf.ReadTimeout) * time.Second,
WriteTimeout: time.Duration(conf.WriteTimeout) * time.Second,
MaxHeaderBytes: 1 << 20,
}
log.Printf("Starting server at %s\n", conf.Bind)
2017-09-15 13:29:51 +03:00
log.Fatal(s.Serve(netutil.LimitListener(l, conf.MaxClients)))
2017-06-20 16:58:55 +03:00
}