Fix unix socket binding if it already exists.

This commit is contained in:
FireMasterK 2020-10-25 12:52:02 +00:00 committed by GitHub
parent 4cdba58f8e
commit f955cc04da
1 changed files with 2 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import (
"net/http"
"net/url"
"strings"
"syscall"
"github.com/lucas-clemente/quic-go/http3"
)
@ -109,6 +110,7 @@ func main() {
http.HandleFunc("/vi/", genericHTTPProxy)
http.HandleFunc("/a/", genericHTTPProxy)
http.HandleFunc("/ggpht/", genericHTTPProxy)
syscall.Unlink("http-proxy.sock")
listener, err := net.Listen("unix", "http-proxy.sock")
if err != nil {
fmt.Println("Failed to bind to UDS, falling back to TCP/IP")