Fix unix socket binding if it already exists.
This commit is contained in:
parent
4cdba58f8e
commit
f955cc04da
1 changed files with 2 additions and 0 deletions
2
main.go
2
main.go
|
@ -8,6 +8,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
"syscall"
|
||||||
|
|
||||||
"github.com/lucas-clemente/quic-go/http3"
|
"github.com/lucas-clemente/quic-go/http3"
|
||||||
)
|
)
|
||||||
|
@ -109,6 +110,7 @@ func main() {
|
||||||
http.HandleFunc("/vi/", genericHTTPProxy)
|
http.HandleFunc("/vi/", genericHTTPProxy)
|
||||||
http.HandleFunc("/a/", genericHTTPProxy)
|
http.HandleFunc("/a/", genericHTTPProxy)
|
||||||
http.HandleFunc("/ggpht/", genericHTTPProxy)
|
http.HandleFunc("/ggpht/", genericHTTPProxy)
|
||||||
|
syscall.Unlink("http-proxy.sock")
|
||||||
listener, err := net.Listen("unix", "http-proxy.sock")
|
listener, err := net.Listen("unix", "http-proxy.sock")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Failed to bind to UDS, falling back to TCP/IP")
|
fmt.Println("Failed to bind to UDS, falling back to TCP/IP")
|
||||||
|
|
Loading…
Add table
Reference in a new issue