summaryrefslogtreecommitdiffhomepage
path: root/tunnel/tools/libwg-go/service.go
diff options
context:
space:
mode:
Diffstat (limited to 'tunnel/tools/libwg-go/service.go')
-rw-r--r--tunnel/tools/libwg-go/service.go24
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
}