diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-02-24 23:55:03 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-02-24 23:55:03 +0100 |
commit | 35c5cb00d6af97dfd917ba7f051a8a6ba85180b8 (patch) | |
tree | dab1ae75b24b26df80f88f035a01803f6e9bb2c0 /tunnel/tools/libwg-go/service.go | |
parent | 1dbe14aefa8afd7513f6ae3b12e13044d48c684a (diff) |
WIP: experimental pac content
Diffstat (limited to 'tunnel/tools/libwg-go/service.go')
-rw-r--r-- | tunnel/tools/libwg-go/service.go | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/tunnel/tools/libwg-go/service.go b/tunnel/tools/libwg-go/service.go index 66bdd5ef..2c688e26 100644 --- a/tunnel/tools/libwg-go/service.go +++ b/tunnel/tools/libwg-go/service.go @@ -5,7 +5,7 @@ import ( "fmt" "io" "net" - "net/url" +// "net/url" "os" "google.golang.org/grpc" @@ -106,33 +106,43 @@ func buildStartHttpProxyError(message string) (*gen.StartHttpProxyResponse, erro } func (e *LibwgServiceImpl) StartHttpProxy(ctx context.Context, req *gen.StartHttpProxyRequest) (*gen.StartHttpProxyResponse, error) { + e.logger.Verbosef("StartHttpProxy 1") var listenPort uint16 if e.httpProxy == nil { + e.logger.Verbosef("StartHttpProxy 2") e.httpProxy = NewHttpProxy(e.uidRequest, e.logger) + e.logger.Verbosef("StartHttpProxy 3") var err error listenPort, err = e.httpProxy.Start() + e.logger.Verbosef("StartHttpProxy 4") if err != nil { e.httpProxy = nil + e.logger.Verbosef("StartHttpProxy 5") return buildStartHttpProxyError(fmt.Sprintf("Http proxy start failed: %v", err)) } } else { listenPort = e.httpProxy.GetAddrPort().Port() } - pacFileUrl, err := url.Parse(req.PacFileUrl) - if err != nil { - return buildStartHttpProxyError(fmt.Sprintf("Bad pacFileUrl: %v (%s)", err, req.PacFileUrl)) - } + e.logger.Verbosef("StartHttpProxy 6") + // pacFileUrl, err := url.Parse(req.PacFileUrl) + // if err != nil { + // e.logger.Verbosef("StartHttpProxy 7") + // return buildStartHttpProxyError(fmt.Sprintf("Bad pacFileUrl: %v (%s)", err, req.PacFileUrl)) + // } - err = e.httpProxy.SetPacFileUrl(pacFileUrl) + e.logger.Verbosef("StartHttpProxy 8") + err := e.httpProxy.SetPacFileContent(req.GetPacFileContent()) if err != nil { - return buildStartHttpProxyError(fmt.Sprintf("Bad pacFileUrl: %v (%s)", req.PacFileUrl)) + e.logger.Verbosef("StartHttpProxy 9") + return buildStartHttpProxyError(fmt.Sprintf("Bad pacFile: %v (%s)", req.GetPacFileContent())) } r := &gen.StartHttpProxyResponse{ ListenPort: uint32(listenPort), } + e.logger.Verbosef("StartHttpProxy 10") return r, nil } |