Skip to content

Commit

Permalink
use direct connection if wpad.dat is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
darren committed Jul 1, 2020
1 parent 272ef61 commit dfe01cb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"log"
"net"
"net/http"
"os"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -245,7 +246,16 @@ func (s *Server) Start() error {
// New create the proxy server
func New(addr string, pacf string, rintval time.Duration) (*Server, error) {
pac, err := gpac.From(pacf)
if err != nil {
if os.IsNotExist(err) {
log.Print("Warn: using direct connection")
pac, _ = gpac.New(
`
function FindProxyForURL(url, host) {
return "DIRECT";
}
`,
)
} else if err != nil {
return nil, err
}

Expand Down

0 comments on commit dfe01cb

Please sign in to comment.