diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 8af91860..f9185d05 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -9,8 +9,6 @@ on: default: false push: branches: [ "main", "testing-*" ] - pull_request: - branches: [ "main" ] jobs: build-linux: @@ -38,7 +36,7 @@ jobs: go test -v ./... continue-on-error: true - - name: Build x64 + - name: Build 64bits run: | set GOARCH=amd64 set GOOS=linux @@ -85,29 +83,29 @@ jobs: - name: Prepare run: | MKDIR build - MKDIR build\x64 - MKDIR build\x86 + MKDIR build\64bits + MKDIR build\32bits COPY /Y windivert\LICENSE build\LICENSE.windivert COPY /Y LICENSE build\LICENSE set GOARCH=amd64 go clean -cache set GOARCH=386 go clean -cache - COPY /Y windivert\x64\* build\x64 + COPY /Y windivert\x64\* build\64bits - - name: Build QPep x64 + - name: Build QPep 64bits run: | set GOARCH=amd64 set CGO_ENABLED=1 - go build -o build\x64\qpep.exe + go build -o build\64bits\qpep.exe - - name: Build QPep Tray x64 + - name: Build QPep Tray 64bits run: | pushd qpep-tray set GOARCH=amd64 set GOOS=windows set CGO_ENABLED=0 - go build -ldflags -H=windowsgui -o ..\build\x86\qpep-tray.exe + go build -ldflags -H=windowsgui -o ..\build\64bits\qpep-tray.exe popd - if: ${{ github.event.inputs.x86_version == true }} @@ -122,7 +120,7 @@ jobs: set GOARCH=386 set GOOS=windows set CGO_ENABLED=1 - go build -o build\x64\qpep.exe + go build -o build\64bits\qpep.exe - if: ${{ github.event.inputs.x86_version == true }} name: Build QPep Tray x86 @@ -131,7 +129,7 @@ jobs: set GOARCH=386 set GOOS=windows set CGO_ENABLED=0 - go build -ldflags -H=windowsgui -o ..\build\x86\qpep-tray.exe + go build -ldflags -H=windowsgui -o ..\build\32bits\qpep-tray.exe popd - name: Build QPep Installer diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 28b7f195..65ca708f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -114,21 +114,21 @@ jobs: - name: Prepare run: | MKDIR build - MKDIR build\x64 - MKDIR build\x86 + MKDIR build\64bits + MKDIR build\32bits COPY /Y windivert\LICENSE build\LICENSE.windivert COPY /Y LICENSE build\LICENSE set GOARCH=amd64 go clean -cache set GOARCH=386 go clean -cache - COPY /Y windivert\x64\* build\x64 + COPY /Y windivert\x64\* build\64bits - name: Build QPep x64 run: | set GOARCH=amd64 set CGO_ENABLED=1 - go build -o build\x64\qpep.exe + go build -o build\64bits\qpep.exe - name: Build QPep Tray x64 run: | @@ -136,7 +136,7 @@ jobs: set GOARCH=amd64 set GOOS=windows set CGO_ENABLED=0 - go build -ldflags -H=windowsgui -o ..\build\x86\qpep-tray.exe + go build -ldflags -H=windowsgui -o ..\build\32bits\qpep-tray.exe popd - if: ${{ github.event.inputs.x86_version == true }} @@ -151,7 +151,7 @@ jobs: set GOARCH=386 set GOOS=windows set CGO_ENABLED=1 - go build -o build\x64\qpep.exe + go build -o build\64bits\qpep.exe - if: ${{ github.event.inputs.x86_version == true }} name: Build QPep Tray x86 @@ -160,7 +160,7 @@ jobs: set GOARCH=386 set GOOS=windows set CGO_ENABLED=0 - go build -ldflags -H=windowsgui -o ..\build\x86\qpep-tray.exe + go build -ldflags -H=windowsgui -o ..\build\32bits\qpep-tray.exe popd - name: Build QPep Installer diff --git a/api/api.go b/api/api.go index bfb984ea..6fc04136 100644 --- a/api/api.go +++ b/api/api.go @@ -12,11 +12,13 @@ import ( "time" "github.com/julienschmidt/httprouter" + "github.com/parvit/qpep/shared" + "github.com/parvit/qpep/version" ) func formatRequest(r *http.Request) string { - data, err := httputil.DumpRequest(r, shared.QuicConfiguration.Verbose) + data, err := httputil.DumpRequest(r, shared.QPepConfig.Verbose) if err != nil { return fmt.Sprintf("REQUEST: %v", err) } @@ -76,7 +78,7 @@ func apiEcho(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { data, err := json.Marshal(EchoResponse{ Address: dataAddr[0], Port: port, - ServerVersion: shared.Version(), + ServerVersion: version.Version(), }) if err != nil { w.WriteHeader(http.StatusInternalServerError) @@ -95,10 +97,10 @@ func apiVersions(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { server := "N/A" client := "N/A" if strings.Contains(r.URL.String(), API_PREFIX_SERVER) { - server = shared.Version() + server = version.Version() } else { server = Statistics.GetState(INFO_OTHER_VERSION) - client = shared.Version() + client = version.Version() } data, err := json.Marshal(VersionsResponse{ @@ -143,7 +145,7 @@ func apiStatisticsInfo(w http.ResponseWriter, r *http.Request, ps httprouter.Par reqAddress := ps.ByName("addr") lastUpdate := "" - address := shared.QuicConfiguration.ListenIP + address := shared.QPepConfig.ListenHost platform := runtime.GOOS if len(reqAddress) > 0 { address = reqAddress diff --git a/api/api_client.go b/api/api_client.go index 6a0f2820..4e0187af 100644 --- a/api/api_client.go +++ b/api/api_client.go @@ -5,7 +5,6 @@ import ( "bytes" "encoding/json" "fmt" - "log" "net" "net/http" "net/url" @@ -13,6 +12,7 @@ import ( "strings" "time" + . "github.com/parvit/qpep/logger" "github.com/parvit/qpep/shared" ) @@ -21,7 +21,7 @@ func getClientForAPI(localAddr net.Addr) *http.Client { Timeout: 30 * time.Second, Transport: &http.Transport{ Proxy: func(*http.Request) (*url.URL, error) { - log.Printf("API Proxy: %v %v\n", shared.UsingProxy, shared.ProxyAddress) + Info("API Proxy: %v %v\n", shared.UsingProxy, shared.ProxyAddress) if shared.UsingProxy { return shared.ProxyAddress, nil } @@ -50,7 +50,7 @@ func RequestEcho(localAddress, address string, port int, toServer bool) *EchoRes resolvedAddr, errAddr := net.ResolveTCPAddr("tcp", localAddress+":0") if errAddr != nil { - log.Printf("ERROR: %v\n", errAddr) + Info("ERROR: %v\n", errAddr) return nil } @@ -58,14 +58,14 @@ func RequestEcho(localAddress, address string, port int, toServer bool) *EchoRes req, err := http.NewRequest("GET", addr, nil) if err != nil { - log.Printf("ERROR: %v\n", err) + Info("1 ERROR: %v\n", err) return nil } req.Header.Set("User-Agent", runtime.GOOS) resp, err := clientInst.Do(req) if err != nil { - log.Printf("ERROR: %v\n", err) + Info("2 ERROR: %v\n", err) return nil } defer func() { @@ -73,7 +73,7 @@ func RequestEcho(localAddress, address string, port int, toServer bool) *EchoRes }() if resp.StatusCode != http.StatusOK { - log.Printf("ERROR: BAD status code %d\n", resp.StatusCode) + Info("ERROR: BAD status code %d\n", resp.StatusCode) return nil } @@ -84,18 +84,18 @@ func RequestEcho(localAddress, address string, port int, toServer bool) *EchoRes } if scanner.Err() != nil { - log.Printf("ERROR: %v\n", scanner.Err()) + Info("3 ERROR: %v\n", scanner.Err()) return nil } - if shared.QuicConfiguration.Verbose { - log.Printf("%s\n", str.String()) + if shared.QPepConfig.Verbose { + Info("%s\n", str.String()) } respData := &EchoResponse{} jsonErr := json.Unmarshal(str.Bytes(), &respData) if jsonErr != nil { - log.Printf("ERROR: %v\n", jsonErr) + Info("4 ERROR: %v\n", jsonErr) return nil } @@ -117,7 +117,7 @@ func RequestStatus(localAddress, gatewayAddress string, apiPort int, publicAddre resp, err := client.Get(addr) if err != nil { - log.Printf("ERROR: %v\n", err) + Info("5 ERROR: %v\n", err) return nil } defer func() { @@ -125,7 +125,7 @@ func RequestStatus(localAddress, gatewayAddress string, apiPort int, publicAddre }() if resp.StatusCode != http.StatusOK { - log.Printf("ERROR: BAD status code %d\n", resp.StatusCode) + Info("ERROR: BAD status code %d\n", resp.StatusCode) return nil } @@ -136,18 +136,18 @@ func RequestStatus(localAddress, gatewayAddress string, apiPort int, publicAddre } if scanner.Err() != nil { - log.Printf("ERROR: %v\n", scanner.Err()) + Info("6 ERROR: %v\n", scanner.Err()) return nil } - if shared.QuicConfiguration.Verbose { - log.Printf("%s\n", str.String()) + if shared.QPepConfig.Verbose { + Info("%s\n", str.String()) } respData := &StatusReponse{} jsonErr := json.Unmarshal(str.Bytes(), &respData) if jsonErr != nil { - log.Printf("ERROR: %v\n", jsonErr) + Info("7 ERROR: %v\n", jsonErr) return nil } @@ -164,7 +164,7 @@ func RequestStatistics(localAddress, gatewayAddress string, apiPort int, publicA resp, err := clientInst.Get(addr) if err != nil { - log.Printf("ERROR: %v\n", err) + Info("8 ERROR: %v\n", err) return nil } defer func() { @@ -172,7 +172,7 @@ func RequestStatistics(localAddress, gatewayAddress string, apiPort int, publicA }() if resp.StatusCode != http.StatusOK { - log.Printf("ERROR: BAD status code %d\n", resp.StatusCode) + Info("ERROR: BAD status code %d\n", resp.StatusCode) return nil } @@ -183,18 +183,18 @@ func RequestStatistics(localAddress, gatewayAddress string, apiPort int, publicA } if scanner.Err() != nil { - log.Printf("ERROR: %v\n", scanner.Err()) + Info("9 ERROR: %v\n", scanner.Err()) return nil } - if shared.QuicConfiguration.Verbose { - log.Printf("%s\n", str.String()) + if shared.QPepConfig.Verbose { + Info("%s\n", str.String()) } respData := &StatsInfoReponse{} jsonErr := json.Unmarshal(str.Bytes(), &respData) if jsonErr != nil { - log.Printf("ERROR: %v\n", jsonErr) + Info("10 ERROR: %v\n", jsonErr) return nil } diff --git a/api/router.go b/api/router.go index 72a4360d..d7c4be91 100644 --- a/api/router.go +++ b/api/router.go @@ -1,215 +1,216 @@ -package api - -import ( - "context" - "fmt" - "log" - "mime" - "net" - "net/http" - "net/textproto" - "path/filepath" - "strings" - - "github.com/julienschmidt/httprouter" - "github.com/parvit/qpep/shared" - "github.com/parvit/qpep/webgui" - "github.com/rs/cors" -) - -const ( - API_PREFIX_SERVER string = "/api/v1/server" - API_PREFIX_CLIENT string = "/api/v1/client" - - API_ECHO_PATH string = "/echo" - API_VERSIONS_PATH string = "/versions" - API_STATUS_PATH string = "/status/:addr" - API_STATS_HOSTS_PATH string = "/statistics/hosts" - API_STATS_INFO_PATH string = "/statistics/info" - API_STATS_DATA_PATH string = "/statistics/data" - API_STATS_INFO_SRV_PATH string = "/statistics/info/:addr" - API_STATS_DATA_SRV_PATH string = "/statistics/data/:addr" -) - -func RunServer(ctx context.Context, cancel context.CancelFunc, localMode bool) { - // update configuration from flags - host := shared.QuicConfiguration.ListenIP - if localMode { - host = "127.0.0.1" - log.Printf("Listening address for local api server set to 127.0.0.1") - } else { - host, _ = shared.GetDefaultLanListeningAddress(host, "") - } - apiPort := shared.QuicConfiguration.GatewayAPIPort - - listenAddr := fmt.Sprintf("%s:%d", host, apiPort) - log.Printf("Opening API Server on: %s", listenAddr) - - rtr := NewRouter() - rtr.clientMode = shared.QuicConfiguration.ClientFlag - rtr.registerHandlers() - if localMode { - rtr.registerStaticFiles() - } - - srv := NewServer(listenAddr, rtr, ctx) - go func() { - <-ctx.Done() - if srv != nil { - srv.Close() - srv = nil - } - cancel() - }() - - if err := srv.ListenAndServe(); err != nil { - log.Printf("Error running API server: %v", err) - } - srv = nil - cancel() - - log.Println("Closed API Server") -} - -func NewServer(addr string, rtr *APIRouter, ctx context.Context) *http.Server { - corsRouterHandler := cors.Default().Handler(rtr.handler) - - return &http.Server{ - Addr: addr, - Handler: corsRouterHandler, - BaseContext: func(l net.Listener) context.Context { - return ctx - }, - } -} - -func NewRouter() *APIRouter { - rtr := httprouter.New() - rtr.RedirectTrailingSlash = true - rtr.RedirectFixedPath = true - - return &APIRouter{ - handler: rtr, - } -} - -func apiFilter(next httprouter.Handle) httprouter.Handle { - return httprouter.Handle(func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { - log.Printf("apiFilter - %s\n", formatRequest(r)) - - // Request API request must accept JSON - accepts := r.Header.Get(textproto.CanonicalMIMEHeaderKey("accept")) - if len(accepts) > 0 { - if !strings.Contains(accepts, "application/json") && - !strings.Contains(accepts, "application/*") && - !strings.Contains(accepts, "*/*") { - - w.WriteHeader(http.StatusBadRequest) - return - } - } - - // Request is found for API request - w.Header().Add("Content-Type", "application/json") - next(w, r, ps) - }) -} - -type notFoundHandler struct{} - -func (n *notFoundHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - log.Printf("notFoundHandler - %s\n", formatRequest(r)) - - // Request not found for API request will accept JSON - accepts := r.Header.Get(textproto.CanonicalMIMEHeaderKey("accept")) - if len(accepts) > 0 && strings.EqualFold(accepts, "application/json") { - w.WriteHeader(http.StatusBadRequest) - return - } - - // Request not found for non-API serves the default page - serveFile(w, r, nil) -} - -type methodsNotAllowedHandler struct{} - -func (n *methodsNotAllowedHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - log.Printf("methodsNotAllowedHandler - %s\n", formatRequest(r)) - w.WriteHeader(http.StatusMethodNotAllowed) -} - -func (r *APIRouter) registerHandlers() { - r.handler.PanicHandler = func(w http.ResponseWriter, r *http.Request, i interface{}) { - log.Printf("PanicHandler - %s\n", formatRequest(r)) - w.WriteHeader(http.StatusInternalServerError) - } - r.handler.NotFound = ¬FoundHandler{} - r.handler.MethodNotAllowed = &methodsNotAllowedHandler{} - r.handler.RedirectTrailingSlash = false - r.handler.HandleMethodNotAllowed = true - - // register apis with respective allowed usage - r.registerAPIMethod("GET", API_ECHO_PATH, apiFilter(apiEcho), true, true) - r.registerAPIMethod("GET", API_VERSIONS_PATH, apiFilter(apiVersions), true, true) - r.registerAPIMethod("GET", API_STATUS_PATH, apiFilter(apiStatus), true, false) - - r.registerAPIMethod("GET", API_STATS_HOSTS_PATH, apiFilter(apiStatisticsHosts), true, false) - r.registerAPIMethod("GET", API_STATS_INFO_PATH, apiFilter(apiStatisticsInfo), false, true) - r.registerAPIMethod("GET", API_STATS_DATA_PATH, apiFilter(apiStatisticsData), true, true) - r.registerAPIMethod("GET", API_STATS_INFO_SRV_PATH, apiFilter(apiStatisticsInfo), true, false) - r.registerAPIMethod("GET", API_STATS_DATA_SRV_PATH, apiFilter(apiStatisticsData), true, false) -} - -func (r *APIRouter) registerAPIMethod(method, path string, handle httprouter.Handle, allowServer, allowClient bool) { - if !allowServer && !allowClient { - panic(fmt.Sprintf("Requested registration of api method %s %s for neither server or client usage!", method, path)) - } - - log.Printf("Register API: %s %s (srv:%v cli:%v cli-mode:%v)\n", method, path, allowServer, allowClient, r.clientMode) - if allowServer && !r.clientMode { - r.handler.Handle(method, API_PREFIX_SERVER+path, handle) - } else { - r.handler.Handle(method, API_PREFIX_SERVER+path, apiForbidden) - } - - if allowClient && r.clientMode { - r.handler.Handle(method, API_PREFIX_CLIENT+path, handle) - } else { - r.handler.Handle(method, API_PREFIX_CLIENT+path, apiForbidden) - } -} - -func apiForbidden(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { - log.Printf("apiForbidden - %s\n", formatRequest(r)) - - w.WriteHeader(http.StatusForbidden) -} - -func (r *APIRouter) registerStaticFiles() { - for path := range webgui.FilesList { - if path == "index.html" { - continue // needs to be handled with a 404 to support the spa push state router - } - r.handler.GET("/"+path, serveFile) - } -} - -func serveFile(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { - log.Printf("serveFile - %s\n", formatRequest(r)) - - urlPath := r.URL.Path[1:] - if _, ok := webgui.FilesList[urlPath]; !ok { - urlPath = "index.html" - } - - var typeFile string - if len(filepath.Ext(urlPath)) == 0 { - typeFile = "text/html" - } else { - typeFile = mime.TypeByExtension(urlPath) - } - - w.Header().Add("Content-Type", typeFile) - - w.Write(webgui.FilesList[urlPath]) -} +package api + +import ( + "context" + "fmt" + "mime" + "net" + "net/http" + "net/textproto" + "path/filepath" + "strings" + + "github.com/julienschmidt/httprouter" + "github.com/parvit/qpep/flags" + . "github.com/parvit/qpep/logger" + "github.com/parvit/qpep/shared" + "github.com/parvit/qpep/webgui" + "github.com/rs/cors" +) + +const ( + API_PREFIX_SERVER string = "/api/v1/server" + API_PREFIX_CLIENT string = "/api/v1/client" + + API_ECHO_PATH string = "/echo" + API_VERSIONS_PATH string = "/versions" + API_STATUS_PATH string = "/status/:addr" + API_STATS_HOSTS_PATH string = "/statistics/hosts" + API_STATS_INFO_PATH string = "/statistics/info" + API_STATS_DATA_PATH string = "/statistics/data" + API_STATS_INFO_SRV_PATH string = "/statistics/info/:addr" + API_STATS_DATA_SRV_PATH string = "/statistics/data/:addr" +) + +func RunServer(ctx context.Context, cancel context.CancelFunc, localMode bool) { + // update configuration from flags + host := shared.QPepConfig.ListenHost + if localMode { + host = "127.0.0.1" + Info("Listening address for local api server set to 127.0.0.1") + } else { + host, _ = shared.GetDefaultLanListeningAddress(host, "") + } + apiPort := shared.QPepConfig.GatewayAPIPort + + listenAddr := fmt.Sprintf("%s:%d", host, apiPort) + Info("Opening API Server on: %s", listenAddr) + + rtr := NewRouter() + rtr.clientMode = flags.Globals.Client + rtr.registerHandlers() + if localMode { + rtr.registerStaticFiles() + } + + srv := NewServer(listenAddr, rtr, ctx) + go func() { + <-ctx.Done() + if srv != nil { + srv.Close() + srv = nil + } + cancel() + }() + + if err := srv.ListenAndServe(); err != nil { + Info("Error running API server: %v", err) + } + srv = nil + cancel() + + Info("Closed API Server") +} + +func NewServer(addr string, rtr *APIRouter, ctx context.Context) *http.Server { + corsRouterHandler := cors.Default().Handler(rtr.handler) + + return &http.Server{ + Addr: addr, + Handler: corsRouterHandler, + BaseContext: func(l net.Listener) context.Context { + return ctx + }, + } +} + +func NewRouter() *APIRouter { + rtr := httprouter.New() + rtr.RedirectTrailingSlash = true + rtr.RedirectFixedPath = true + + return &APIRouter{ + handler: rtr, + } +} + +func apiFilter(next httprouter.Handle) httprouter.Handle { + return httprouter.Handle(func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { + Info("apiFilter - %s\n", formatRequest(r)) + + // Request API request must accept JSON + accepts := r.Header.Get(textproto.CanonicalMIMEHeaderKey("accept")) + if len(accepts) > 0 { + if !strings.Contains(accepts, "application/json") && + !strings.Contains(accepts, "application/*") && + !strings.Contains(accepts, "*/*") { + + w.WriteHeader(http.StatusBadRequest) + return + } + } + + // Request is found for API request + w.Header().Add("Content-Type", "application/json") + next(w, r, ps) + }) +} + +type notFoundHandler struct{} + +func (n *notFoundHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + Info("notFoundHandler - %s\n", formatRequest(r)) + + // Request not found for API request will accept JSON + accepts := r.Header.Get(textproto.CanonicalMIMEHeaderKey("accept")) + if len(accepts) > 0 && strings.EqualFold(accepts, "application/json") { + w.WriteHeader(http.StatusBadRequest) + return + } + + // Request not found for non-API serves the default page + serveFile(w, r, nil) +} + +type methodsNotAllowedHandler struct{} + +func (n *methodsNotAllowedHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + Info("methodsNotAllowedHandler - %s\n", formatRequest(r)) + w.WriteHeader(http.StatusMethodNotAllowed) +} + +func (r *APIRouter) registerHandlers() { + r.handler.PanicHandler = func(w http.ResponseWriter, r *http.Request, i interface{}) { + Info("PanicHandler - %s\n", formatRequest(r)) + w.WriteHeader(http.StatusInternalServerError) + } + r.handler.NotFound = ¬FoundHandler{} + r.handler.MethodNotAllowed = &methodsNotAllowedHandler{} + r.handler.RedirectTrailingSlash = false + r.handler.HandleMethodNotAllowed = true + + // register apis with respective allowed usage + r.registerAPIMethod("GET", API_ECHO_PATH, apiFilter(apiEcho), true, true) + r.registerAPIMethod("GET", API_VERSIONS_PATH, apiFilter(apiVersions), true, true) + r.registerAPIMethod("GET", API_STATUS_PATH, apiFilter(apiStatus), true, false) + + r.registerAPIMethod("GET", API_STATS_HOSTS_PATH, apiFilter(apiStatisticsHosts), true, false) + r.registerAPIMethod("GET", API_STATS_INFO_PATH, apiFilter(apiStatisticsInfo), false, true) + r.registerAPIMethod("GET", API_STATS_DATA_PATH, apiFilter(apiStatisticsData), true, true) + r.registerAPIMethod("GET", API_STATS_INFO_SRV_PATH, apiFilter(apiStatisticsInfo), true, false) + r.registerAPIMethod("GET", API_STATS_DATA_SRV_PATH, apiFilter(apiStatisticsData), true, false) +} + +func (r *APIRouter) registerAPIMethod(method, path string, handle httprouter.Handle, allowServer, allowClient bool) { + if !allowServer && !allowClient { + panic(fmt.Sprintf("Requested registration of api method %s %s for neither server or client usage!", method, path)) + } + + Info("Register API: %s %s (srv:%v cli:%v cli-mode:%v)\n", method, path, allowServer, allowClient, r.clientMode) + if allowServer && !r.clientMode { + r.handler.Handle(method, API_PREFIX_SERVER+path, handle) + } else { + r.handler.Handle(method, API_PREFIX_SERVER+path, apiForbidden) + } + + if allowClient && r.clientMode { + r.handler.Handle(method, API_PREFIX_CLIENT+path, handle) + } else { + r.handler.Handle(method, API_PREFIX_CLIENT+path, apiForbidden) + } +} + +func apiForbidden(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { + Info("apiForbidden - %s\n", formatRequest(r)) + + w.WriteHeader(http.StatusForbidden) +} + +func (r *APIRouter) registerStaticFiles() { + for path := range webgui.FilesList { + if path == "index.html" { + continue // needs to be handled with a 404 to support the spa push state router + } + r.handler.GET("/"+path, serveFile) + } +} + +func serveFile(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { + Info("serveFile - %s\n", formatRequest(r)) + + urlPath := r.URL.Path[1:] + if _, ok := webgui.FilesList[urlPath]; !ok { + urlPath = "index.html" + } + + var typeFile string + if len(filepath.Ext(urlPath)) == 0 { + typeFile = "text/html" + } else { + typeFile = mime.TypeByExtension(urlPath) + } + + w.Header().Add("Content-Type", typeFile) + + w.Write(webgui.FilesList[urlPath]) +} diff --git a/api/statistics.go b/api/statistics.go index 302e14d8..3284cc88 100644 --- a/api/statistics.go +++ b/api/statistics.go @@ -2,9 +2,10 @@ package api import ( "fmt" - "log" "strings" "sync" + + . "github.com/parvit/qpep/logger" ) const ( @@ -41,7 +42,7 @@ func (s *statistics) init() { return } - log.Println("Statistics init.") + Debug("Statistics init.") s.semCounters = &sync.RWMutex{} s.semState = &sync.RWMutex{} s.hosts = make([]string, 0, 32) @@ -52,7 +53,7 @@ func (s *statistics) Reset() { s.semState = nil s.init() - log.Println("Statistics reset.") + Debug("Statistics reset.") s.counters = make(map[string]float64) s.state = make(map[string]string) } @@ -75,7 +76,7 @@ func (s *statistics) GetCounter(prefix string, keyparts ...string) float64 { s.semCounters.RLock() defer s.semCounters.RUnlock() - //log.Printf("GET counter: %s = %.2f\n", key, s.counters[key]) + //Info("GET counter: %s = %.2f\n", key, s.counters[key]) if val, ok := s.counters[key]; ok { return val } @@ -96,7 +97,7 @@ func (s *statistics) SetCounter(value float64, prefix string, keyparts ...string defer s.semCounters.Unlock() s.counters[key] = value - //log.Printf("SET counter: %s = %.2f\n", key, s.counters[key]) + //Info("SET counter: %s = %.2f\n", key, s.counters[key]) return value } @@ -110,7 +111,7 @@ func (s *statistics) GetCounterAndClear(prefix string, keyparts ...string) float s.semCounters.Lock() defer s.semCounters.Unlock() - //log.Printf("GET+CLEAR counter: %s = %.2f\n", key, s.counters[key]) + //Info("GET+CLEAR counter: %s = %.2f\n", key, s.counters[key]) if val, ok := s.counters[key]; ok { s.counters[key] = 0.0 return val @@ -161,7 +162,7 @@ func (s *statistics) DecrementCounter(decr float64, prefix string, keyparts ...s return 0.0 } - //log.Printf("counter: %s = %.2f\n", key, value-decr) + //Info("counter: %s = %.2f\n", key, value-decr) s.counters[key] = value - decr return value - decr } @@ -254,7 +255,7 @@ func (s *statistics) GetHosts() []string { defer s.semState.RUnlock() // for test - //log.Printf("hosts: %v\n", strings.Join(s.hosts, ",")) + //Info("hosts: %v\n", strings.Join(s.hosts, ",")) //v := append([]string{}, "127.0.0.1") v := append([]string{}, s.hosts...) return v diff --git a/client/client.go b/client/client.go index 6b44f7f8..1dc2a8f4 100644 --- a/client/client.go +++ b/client/client.go @@ -10,7 +10,6 @@ import ( "crypto/tls" "io" - "log" "net" "runtime/debug" "strconv" @@ -19,7 +18,9 @@ import ( "time" "github.com/lucas-clemente/quic-go" + "github.com/parvit/qpep/api" + . "github.com/parvit/qpep/logger" "github.com/parvit/qpep/shared" "github.com/parvit/qpep/windivert" "golang.org/x/net/context" @@ -38,13 +39,13 @@ var ( ListenHost: "0.0.0.0", ListenPort: 9443, GatewayHost: "198.56.1.10", GatewayPort: 443, RedirectedInterfaces: []int64{}, - QuicStreamTimeout: 2, MultiStream: shared.QuicConfiguration.MultiStream, + QuicStreamTimeout: 2, MultiStream: shared.QPepConfig.MultiStream, MaxConnectionRetries: shared.DEFAULT_REDIRECT_RETRIES, IdleTimeout: time.Duration(300) * time.Second, WinDivertThreads: 1, Verbose: false, } - quicSession quic.Session + quicSession quic.Connection QuicClientConfiguration = quic.Config{ MaxIncomingStreams: 40000, DisablePathMTUDiscovery: true, @@ -54,7 +55,7 @@ var ( // if err != nil { // log.Fatal(err) // } - // log.Printf("Creating qlog file %s.\n", filename) + // Info("Creating qlog file %s.\n", filename) // return &shared.QLogWriter{Writer: bufio.NewWriter(f)} // }), } @@ -79,7 +80,7 @@ type ClientConfig struct { func RunClient(ctx context.Context, cancel context.CancelFunc) { defer func() { if err := recover(); err != nil { - log.Printf("PANIC: %v", err) + Info("PANIC: %v", err) debug.PrintStack() } if proxyListener != nil { @@ -87,19 +88,19 @@ func RunClient(ctx context.Context, cancel context.CancelFunc) { } cancel() }() - log.Println("Starting TCP-QPEP Tunnel Listener") + Info("Starting TCP-QPEP Tunnel Listener") // update configuration from flags validateConfiguration() - log.Printf("Binding to TCP %s:%d", ClientConfiguration.ListenHost, ClientConfiguration.ListenPort) + Info("Binding to TCP %s:%d", ClientConfiguration.ListenHost, ClientConfiguration.ListenPort) var err error proxyListener, err = NewClientProxyListener("tcp", &net.TCPAddr{ IP: net.ParseIP(ClientConfiguration.ListenHost), Port: ClientConfiguration.ListenPort, }) if err != nil { - log.Printf("Encountered error when binding client proxy listener: %s", err) + Info("Encountered error when binding client proxy listener: %s", err) return } @@ -115,7 +116,7 @@ func RunClient(ctx context.Context, cancel context.CancelFunc) { func handleServices(ctx context.Context, cancel context.CancelFunc, wg *sync.WaitGroup) { defer func() { if err := recover(); err != nil { - log.Printf("PANIC: %v", err) + Info("PANIC: %v", err) debug.PrintStack() } wg.Done() @@ -129,6 +130,7 @@ func handleServices(ctx context.Context, cancel context.CancelFunc, wg *sync.Wai // connection with the server to be on already up initialCheckConnection() + // Update loop for { select { case <-ctx.Done(): @@ -143,7 +145,7 @@ func handleServices(ctx context.Context, cancel context.CancelFunc, wg *sync.Wai if ok, response := gatewayStatusCheck(localAddr, apiAddr, apiPort); ok { publicAddress = response.Address connected = true - log.Printf("Server returned public address %s\n", publicAddress) + Info("Server returned public address %s\n", publicAddress) } else { // if connection is lost then keep the redirection active @@ -158,7 +160,7 @@ func handleServices(ctx context.Context, cancel context.CancelFunc, wg *sync.Wai connected = clientStatisticsUpdate(localAddr, apiAddr, apiPort, publicAddress) if !connected { - log.Printf("Error during statistics update from server\n") + Info("Error during statistics update from server\n") // if connection is lost then keep the redirection active // for a certain number of retries then terminate to not keep @@ -182,7 +184,7 @@ func initialCheckConnection() bool { preferProxy := ClientConfiguration.PreferProxy if preferProxy { - log.Printf("Proxy preference set, trying to connect...\n") + Info("Proxy preference set, trying to connect...\n") initProxy() return false } @@ -199,35 +201,35 @@ func failedCheckConnection() bool { // First half of tries with proxy, then diverter, then stop if shared.UsingProxy && keepRedirectionRetries < maxRetries/2 { stopProxy() - log.Printf("Connection failed and half retries exhausted, trying with diverter\n") + Info("Connection failed and half retries exhausted, trying with diverter\n") return initDiverter() } if keepRedirectionRetries > 0 { - log.Printf("Connection failed, keeping redirection active (retries left: %d)\n", keepRedirectionRetries) + Info("Connection failed, keeping redirection active (retries left: %d)\n", keepRedirectionRetries) stopProxy() initProxy() return false } - log.Printf("Connection failed and retries exhausted, redirection stopped\n") + Info("Connection failed and retries exhausted, redirection stopped\n") stopDiverter() return true } else { // First half of tries with diverter, then proxy, then stop if !shared.UsingProxy && keepRedirectionRetries < maxRetries/2 { stopDiverter() - log.Printf("Connection failed and half retries exhausted, trying with proxy\n") + Info("Connection failed and half retries exhausted, trying with proxy\n") initProxy() return false } if keepRedirectionRetries > 0 { - log.Printf("Connection failed, keeping redirection active (retries left: %d)\n", keepRedirectionRetries) + Info("Connection failed, keeping redirection active (retries left: %d)\n", keepRedirectionRetries) stopDiverter() initDiverter() return false } - log.Printf("Connection failed and retries exhausted, redirection stopped\n") + Info("Connection failed and retries exhausted, redirection stopped\n") stopProxy() return true } @@ -254,11 +256,11 @@ func initDiverter() bool { } } - log.Printf("WinDivert: %v %v %v %v %v %v\n", gatewayHost, listenHost, gatewayPort, listenPort, threads, redirectedInetID) + Info("WinDivert: %v %v %v %v %v %v\n", gatewayHost, listenHost, gatewayPort, listenPort, threads, redirectedInetID) code := windivert.InitializeWinDivertEngine(gatewayHost, listenHost, gatewayPort, listenPort, threads, redirectedInetID) - log.Printf("WinDivert code: %v\n", code) + Info("WinDivert code: %v\n", code) if code != windivert.DIVERT_OK { - log.Printf("ERROR: Could not initialize WinDivert engine, code %d\n", code) + Info("ERROR: Could not initialize WinDivert engine, code %d\n", code) } return code != windivert.DIVERT_OK } @@ -282,7 +284,7 @@ func stopProxy() { func listenTCPConn(wg *sync.WaitGroup) { defer func() { if err := recover(); err != nil { - log.Printf("PANIC: %v", err) + Info("PANIC: %v", err) debug.PrintStack() } wg.Done() @@ -291,9 +293,9 @@ func listenTCPConn(wg *sync.WaitGroup) { conn, err := proxyListener.Accept() if err != nil { if netErr, ok := err.(net.Error); ok && netErr.Temporary() { - log.Printf("Temporary error when accepting connection: %s", netErr) + Info("Temporary error when accepting connection: %s", netErr) } - log.Printf("Unrecoverable error while accepting connection: %s", err) + Info("Unrecoverable error while accepting connection: %s", err) return } @@ -304,11 +306,11 @@ func listenTCPConn(wg *sync.WaitGroup) { func handleTCPConn(tcpConn net.Conn) { defer func() { if err := recover(); err != nil { - log.Printf("PANIC: %v", err) + Info("PANIC: %v", err) debug.PrintStack() } }() - log.Printf("Accepting TCP connection from %s with destination of %s", tcpConn.RemoteAddr().String(), tcpConn.LocalAddr().String()) + Info("Accepting TCP connection from %s with destination of %s", tcpConn.RemoteAddr().String(), tcpConn.LocalAddr().String()) defer tcpConn.Close() var quicStream quic.Stream = nil @@ -317,14 +319,14 @@ func handleTCPConn(tcpConn net.Conn) { //if we have already opened a quic session, lets check if we've expired our stream if quicSession != nil { var err error - log.Printf("Trying to open on existing session") + Info("Trying to open on existing session") quicStream, err = quicSession.OpenStream() // if we weren't able to open a quicStream on that session (usually inactivity timeout), we can try to open a new session if err != nil { - log.Printf("Unable to open new stream on existing QUIC session: %s\n", err) + Info("Unable to open new stream on existing QUIC session: %s\n", err) quicStream = nil } else { - log.Printf("Opened a new stream: %d", quicStream.StreamID()) + Info("Opened a new stream: %d", quicStream.StreamID()) } } } @@ -342,7 +344,7 @@ func handleTCPConn(tcpConn net.Conn) { quicStream, err = quicSession.OpenStreamSync(context.Background()) // if we cannot open a stream on this session, send a TCP RST and let the client decide to try again if err != nil { - log.Printf("Unable to open QUIC stream: %s\n", err) + Info("Unable to open QUIC stream: %s\n", err) return } } @@ -361,7 +363,7 @@ func handleTCPConn(tcpConn net.Conn) { // divert check diverted, srcPort, dstPort, srcAddress, dstAddress := windivert.GetConnectionStateData(sessionHeader.SourceAddr.Port) if diverted == windivert.DIVERT_OK { - log.Printf("Diverted connection: %v:%v %v:%v", srcAddress, srcPort, dstAddress, dstPort) + Info("Diverted connection: %v:%v %v:%v", srcAddress, srcPort, dstAddress, dstPort) sessionHeader.SourceAddr = &net.TCPAddr{ IP: net.ParseIP(srcAddress), @@ -372,10 +374,10 @@ func handleTCPConn(tcpConn net.Conn) { Port: dstPort, } - log.Printf("Sending QUIC header to server, SourceAddr: %v / DestAddr: %v", sessionHeader.SourceAddr, sessionHeader.DestAddr) + Info("Sending QUIC header to server, SourceAddr: %v / DestAddr: %v", sessionHeader.SourceAddr, sessionHeader.DestAddr) _, err := quicStream.Write(sessionHeader.ToBytes()) if err != nil { - log.Printf("Error writing to quic stream: %s", err.Error()) + Info("Error writing to quic stream: %s", err.Error()) } } else { tcpConn.SetReadDeadline(time.Now().Add(1 * time.Second)) @@ -387,7 +389,7 @@ func handleTCPConn(tcpConn net.Conn) { req, err := http.ReadRequest(rd) if err != nil { tcpConn.Close() - log.Printf("Failed to parse request: %v\n", err) + Info("Failed to parse request: %v\n", err) return } @@ -396,7 +398,7 @@ func handleTCPConn(tcpConn net.Conn) { address, port, proxyable := getAddressPortFromHost(req.Host) if !proxyable { tcpConn.Close() - log.Printf("Non proxyable request\n") + Info("Non proxyable request\n") return } @@ -405,17 +407,17 @@ func handleTCPConn(tcpConn net.Conn) { Port: port, } - log.Printf("Proxied connection") - log.Printf("Sending QUIC header to server, SourceAddr: %v / DestAddr: %v", sessionHeader.SourceAddr, sessionHeader.DestAddr) + Info("Proxied connection") + Info("Sending QUIC header to server, SourceAddr: %v / DestAddr: %v", sessionHeader.SourceAddr, sessionHeader.DestAddr) _, err := quicStream.Write(sessionHeader.ToBytes()) if err != nil { - log.Printf("Error writing to quic stream: %s", err.Error()) + Info("Error writing to quic stream: %s", err.Error()) } - log.Printf("Sending captured GET request\n") + Info("Sending captured GET request\n") err = req.Write(quicStream) if err != nil { - log.Printf("Error writing to tcp stream: %s", err.Error()) + Info("Error writing to tcp stream: %s", err.Error()) } break @@ -423,7 +425,7 @@ func handleTCPConn(tcpConn net.Conn) { address, port, proxyable := getAddressPortFromHost(req.Host) if !proxyable { tcpConn.Close() - log.Printf("Non proxyable request\n") + Info("Non proxyable request\n") return } @@ -447,11 +449,11 @@ func handleTCPConn(tcpConn net.Conn) { t.Write(tcpConn) buf.Reset() - log.Printf("Proxied connection") - log.Printf("Sending QUIC header to server, SourceAddr: %v / DestAddr: %v", sessionHeader.SourceAddr, sessionHeader.DestAddr) + Info("Proxied connection") + Info("Sending QUIC header to server, SourceAddr: %v / DestAddr: %v", sessionHeader.SourceAddr, sessionHeader.DestAddr) _, err := quicStream.Write(sessionHeader.ToBytes()) if err != nil { - log.Printf("Error writing to quic stream: %s", err.Error()) + Info("Error writing to quic stream: %s", err.Error()) } break default: @@ -469,7 +471,7 @@ func handleTCPConn(tcpConn net.Conn) { t.Write(tcpConn) tcpConn.Close() - log.Printf("Proxy returns BadGateway\n") + Info("Proxy returns BadGateway\n") return } } @@ -485,7 +487,7 @@ func handleTCPConn(tcpConn net.Conn) { err1 := dst.SetLinger(1) if err1 != nil { - log.Printf("error on setLinger: %s\n", err1) + Info("error on setLinger: %s\n", err1) } var buffSize = INITIAL_BUFF_SIZE @@ -506,7 +508,7 @@ func handleTCPConn(tcpConn net.Conn) { if nErr, ok := err.(net.Error); ok && (nErr.Timeout() || nErr.Temporary()) { continue } - //log.Printf("Error on Copy %s\n", err) + //Info("Error on Copy %s\n", err) break } @@ -515,7 +517,7 @@ func handleTCPConn(tcpConn net.Conn) { buffSize = INITIAL_BUFF_SIZE } } - //log.Printf("Finished Copying Stream ID %d, TCP Conn %s->%s\n", src.StreamID(), dst.LocalAddr().String(), dst.RemoteAddr().String()) + //Info("Finished Copying Stream ID %d, TCP Conn %s->%s\n", src.StreamID(), dst.LocalAddr().String(), dst.RemoteAddr().String()) } streamTCPtoQUIC := func(dst quic.Stream, src *net.TCPConn) { defer func() { @@ -526,7 +528,7 @@ func handleTCPConn(tcpConn net.Conn) { err1 := src.SetLinger(1) if err1 != nil { - log.Printf("error on setLinger: %s\n", err1) + Info("error on setLinger: %s\n", err1) } var buffSize = INITIAL_BUFF_SIZE @@ -547,7 +549,7 @@ func handleTCPConn(tcpConn net.Conn) { if nErr, ok := err.(net.Error); ok && (nErr.Timeout() || nErr.Temporary()) { continue } - //log.Printf("Error on Copy %s\n", err) + //Info("Error on Copy %s\n", err) break } @@ -556,11 +558,11 @@ func handleTCPConn(tcpConn net.Conn) { buffSize = INITIAL_BUFF_SIZE } } - //log.Printf("Finished Copying TCP Conn %s->%s, Stream ID %d\n", src.LocalAddr().String(), src.RemoteAddr().String(), dst.StreamID()) + //Info("Finished Copying TCP Conn %s->%s, Stream ID %d\n", src.LocalAddr().String(), src.RemoteAddr().String(), dst.StreamID()) } //Proxy all stream content from quic to TCP and from TCP to quic - log.Printf("== Stream %d Start ==", quicStream.StreamID()) + Info("== Stream %d Start ==", quicStream.StreamID()) go streamTCPtoQUIC(quicStream, tcpConn.(*net.TCPConn)) go streamQUICtoTCP(tcpConn.(*net.TCPConn), quicStream) @@ -572,7 +574,7 @@ func handleTCPConn(tcpConn net.Conn) { quicStream.CancelWrite(0) quicStream.CancelRead(0) quicStream.Close() - log.Printf("== Stream %d Done ==", quicStream.StreamID()) + Info("== Stream %d Done ==", quicStream.StreamID()) } func getAddressPortFromHost(host string) (net.IP, int, bool) { @@ -597,39 +599,39 @@ func getAddressPortFromHost(host string) (net.IP, int, bool) { return address, int(port), proxyable } -func openQuicSession() (quic.Session, error) { +func openQuicSession() (quic.Connection, error) { var err error - var session quic.Session + var session quic.Connection tlsConf := &tls.Config{InsecureSkipVerify: true, NextProtos: []string{"qpep"}} gatewayPath := ClientConfiguration.GatewayHost + ":" + strconv.Itoa(ClientConfiguration.GatewayPort) quicClientConfig := QuicClientConfiguration - log.Printf("Dialing QUIC Session: %s\n", gatewayPath) + Info("Dialing QUIC Session: %s\n", gatewayPath) for i := 0; i < ClientConfiguration.MaxConnectionRetries; i++ { session, err = quic.DialAddr(gatewayPath, tlsConf, &quicClientConfig) if err == nil { return session, nil } else { - log.Printf("Failed to Open QUIC Session: %s\n Retrying...\n", err) + Info("Failed to Open QUIC Session: %s\n Retrying...\n", err) } } - log.Printf("Max Retries Exceeded. Unable to Open QUIC Session: %s\n", err) + Info("Max Retries Exceeded. Unable to Open QUIC Session: %s\n", err) return nil, err } func gatewayStatusCheck(localAddr, apiAddr string, apiPort int) (bool, *api.EchoResponse) { if response := api.RequestEcho(localAddr, apiAddr, apiPort, true); response != nil { - log.Printf("Gateway Echo OK\n") + Info("Gateway Echo OK\n") return true, response } - log.Printf("Gateway Echo FAILED\n") + Info("Gateway Echo FAILED\n") return false, nil } func clientStatisticsUpdate(localAddr, apiAddr string, apiPort int, publicAddress string) bool { response := api.RequestStatistics(localAddr, apiAddr, apiPort, publicAddress) if response == nil { - log.Printf("Statistics update failed, resetting connection status\n") + Info("Statistics update failed, resetting connection status\n") return false } @@ -645,17 +647,17 @@ func clientStatisticsUpdate(localAddr, apiAddr string, apiPort int, publicAddres func validateConfiguration() { // copy values for client configuration - ClientConfiguration.GatewayHost = shared.QuicConfiguration.GatewayIP - ClientConfiguration.GatewayPort = shared.QuicConfiguration.GatewayPort - ClientConfiguration.APIPort = shared.QuicConfiguration.GatewayAPIPort - ClientConfiguration.ListenHost, ClientConfiguration.RedirectedInterfaces = - shared.GetDefaultLanListeningAddress(shared.QuicConfiguration.ListenIP, ClientConfiguration.GatewayHost) - ClientConfiguration.ListenPort = shared.QuicConfiguration.ListenPort - ClientConfiguration.MaxConnectionRetries = shared.QuicConfiguration.MaxConnectionRetries - ClientConfiguration.MultiStream = shared.QuicConfiguration.MultiStream - ClientConfiguration.WinDivertThreads = shared.QuicConfiguration.WinDivertThreads - ClientConfiguration.PreferProxy = shared.QuicConfiguration.PreferProxy - ClientConfiguration.Verbose = shared.QuicConfiguration.Verbose + ClientConfiguration.GatewayHost = shared.QPepConfig.GatewayHost + ClientConfiguration.GatewayPort = shared.QPepConfig.GatewayPort + ClientConfiguration.APIPort = shared.QPepConfig.GatewayAPIPort + ClientConfiguration.ListenHost, ClientConfiguration.RedirectedInterfaces = shared.GetDefaultLanListeningAddress( + shared.QPepConfig.ListenHost, shared.QPepConfig.GatewayHost) + ClientConfiguration.ListenPort = shared.QPepConfig.ListenPort + ClientConfiguration.MaxConnectionRetries = shared.QPepConfig.MaxConnectionRetries + ClientConfiguration.MultiStream = shared.QPepConfig.MultiStream + ClientConfiguration.WinDivertThreads = shared.QPepConfig.WinDivertThreads + ClientConfiguration.PreferProxy = shared.QPepConfig.PreferProxy + ClientConfiguration.Verbose = shared.QPepConfig.Verbose // panic if configuration is inconsistent shared.AssertParamIP("gateway host", ClientConfiguration.GatewayHost) @@ -674,9 +676,6 @@ func validateConfiguration() { shared.AssertParamNumeric("auto-redirected interfaces", len(ClientConfiguration.RedirectedInterfaces), 1, 256) - // override the configured listening address with the discovered one - // if not set explicitly - shared.QuicConfiguration.ListenIP = ClientConfiguration.ListenHost // validation ok - log.Printf("Client configuration validation OK\n") + Info("Client configuration validation OK\n") } diff --git a/client/client_proxy_listener_darwin.go b/client/client_proxy_listener_darwin.go index a57516d6..38725c7d 100644 --- a/client/client_proxy_listener_darwin.go +++ b/client/client_proxy_listener_darwin.go @@ -1,5 +1,4 @@ //go:build darwin -// +build darwin package client diff --git a/client/client_proxy_listener_linux.go b/client/client_proxy_listener_linux.go index a800997f..b7dce9f8 100644 --- a/client/client_proxy_listener_linux.go +++ b/client/client_proxy_listener_linux.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package client diff --git a/client/client_proxy_listener_windows.go b/client/client_proxy_listener_windows.go index 94912b12..95919be0 100644 --- a/client/client_proxy_listener_windows.go +++ b/client/client_proxy_listener_windows.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows package client diff --git a/flags/flags.go b/flags/flags.go new file mode 100644 index 00000000..91d73aab --- /dev/null +++ b/flags/flags.go @@ -0,0 +1,43 @@ +package flags + +import ( + "github.com/jessevdk/go-flags" + "os" + "strings" +) + +type GlobalFlags struct { + Service string `long:"service" description:"Service command"` + Client bool `long:"client" short:"c" description:"Client mode instead of Server mode"` + Verbose bool `long:"verbose" short:"s" description:"Outputs more log messages"` + + ConfigOverrideCallback func(string) `short:"D" description:"Allow to override configuration values with the format name=value"` + ConfigOverrides map[string]string +} + +var ( + Globals GlobalFlags +) + +func init() { + parseFlags(os.Args) +} + +func parseFlags(args []string) { + Globals.ConfigOverrideCallback = func(s string) { + if Globals.ConfigOverrides == nil { + Globals.ConfigOverrides = make(map[string]string) + } + index := strings.Index(s, "=") + if index == -1 { + return + } + Globals.ConfigOverrides[strings.ToLower(s[:index])] = s[index+1:] + } + + cliparser := flags.NewParser(&Globals, flags.Default) + if _, err := cliparser.ParseArgs(args); err != nil { + cliparser.WriteHelp(os.Stderr) + os.Exit(1) + } +} diff --git a/go.mod b/go.mod index 25caeace..19455f0f 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,51 @@ module github.com/parvit/qpep -go 1.16 +go 1.18 require ( + github.com/davecgh/go-spew v1.1.1 github.com/francoispqt/gojay v1.2.13 // indirect github.com/getlantern/systray v1.2.1 - github.com/jackpal/gateway v1.0.7 // indirect + github.com/jackpal/gateway v1.0.7 github.com/julienschmidt/httprouter v1.3.0 - github.com/lucas-clemente/quic-go v0.20.1 - github.com/rs/cors v1.8.2 // indirect + github.com/kardianos/service v1.2.1 // indirect + github.com/lucas-clemente/quic-go v0.29.0 + github.com/parvit/kardianos-service v0.0.0-20220822101756-89fc969969b8 + github.com/rs/cors v1.8.2 + github.com/rs/zerolog v1.28.0 github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 github.com/sqweek/dialog v0.0.0-20220504154117-be45b268883a - github.com/stretchr/testify v1.4.0 // indirect - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 + golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/yaml.v3 v3.0.1 ) + +require ( + github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf // indirect + github.com/fsnotify/fsnotify v1.4.9 // indirect + github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect + github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 // indirect + github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 // indirect + github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 // indirect + github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 // indirect + github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f // indirect + github.com/go-stack/stack v1.8.0 // indirect + github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect + github.com/golang/mock v1.6.0 // indirect + github.com/jessevdk/go-flags v1.5.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect + github.com/marten-seemann/qtls-go1-19 v0.1.0 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/nxadm/tail v1.4.8 // indirect + github.com/nyaosorg/go-windows-dbg v0.0.0-20210914123807-2acba179a4e5 // indirect + github.com/onsi/ginkgo v1.16.4 // indirect + github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect + golang.org/x/tools v0.1.10 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect +) diff --git a/go.sum b/go.sum index 38dd9990..041a8294 100644 --- a/go.sum +++ b/go.sum @@ -14,10 +14,10 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYU github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/bradfitz/go-smtpd v0.0.0-20170404230938-deb6d6237625/go.mod h1:HYsPBTaaSFSlLx/70C2HPIMNZpVV8+vt/A+FMnYP11g= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= -github.com/cheekybits/genny v1.0.0 h1:uGGa4nei+j20rOSeDeP5Of12XVm7TGUd4dJA9RDitfE= -github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/coreos/go-systemd v0.0.0-20181012123002-c6f51f82210d/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -47,14 +47,16 @@ github.com/gliderlabs/ssh v0.1.1/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aev github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.5.0 h1:jlYHihg//f7RRwuPfptm04yp4s7O6Kw8EZiVYIGcH0g= -github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= +github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= +github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= @@ -62,6 +64,7 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -81,53 +84,74 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/jackpal/gateway v1.0.7 h1:7tIFeCGmpyrMx9qvT0EgYUi7cxVW48a0mMvnIL17bPM= github.com/jackpal/gateway v1.0.7/go.mod h1:aRcO0UFKt+MgIZmRmvOmnejdDT4Y1DNiNOsSd1AcIbA= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= +github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kardianos/service v1.2.1 h1:AYndMsehS+ywIS6RB9KOlcXzteWUzxgMgBymJD7+BYk= +github.com/kardianos/service v1.2.1/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lucas-clemente/quic-go v0.20.1 h1:hb5m76V8QS/8Nw/suHvXqo3BMHAozvIkcnzpJdpanSk= -github.com/lucas-clemente/quic-go v0.20.1/go.mod h1:fZq/HUDIM+mW6X6wtzORjC0E/WDBMKe5Hf9bgjISwLk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/lucas-clemente/quic-go v0.29.0 h1:Vw0mGTfmWqGzh4jx/kMymsIkFK6rErFVmg+t9RLrnZE= +github.com/lucas-clemente/quic-go v0.29.0/go.mod h1:CTcNfLYJS2UuRNB+zcNlgvkjBhxX6Hm3WUxxAQx2mgE= github.com/lunixbochs/vtclean v1.0.0/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/marten-seemann/qpack v0.2.1/go.mod h1:F7Gl5L1jIgN1D11ucXefiuJS9UMVP2opoCp2jDKb7wc= -github.com/marten-seemann/qtls-go1-15 v0.1.4 h1:RehYMOyRW8hPVEja1KBVsFVNSm35Jj9Mvs5yNoZZ28A= -github.com/marten-seemann/qtls-go1-15 v0.1.4/go.mod h1:GyFwywLKkRt+6mfU99csTEY1joMZz5vmB1WNZH3P81I= -github.com/marten-seemann/qtls-go1-16 v0.1.3 h1:XEZ1xGorVy9u+lJq+WXNE+hiqRYLNvJGYmwfwKQN2gU= -github.com/marten-seemann/qtls-go1-16 v0.1.3/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= +github.com/marten-seemann/qtls-go1-18 v0.1.2 h1:JH6jmzbduz0ITVQ7ShevK10Av5+jBEKAHMntXmIV7kM= +github.com/marten-seemann/qtls-go1-18 v0.1.2/go.mod h1:mJttiymBAByA49mhlNZZGrH5u1uXYZJ+RW28Py7f4m4= +github.com/marten-seemann/qtls-go1-19 v0.1.0 h1:rLFKD/9mp/uq1SYGYuVZhm83wkmU95pK5df3GufyYYU= +github.com/marten-seemann/qtls-go1-19 v0.1.0/go.mod h1:5HTDWtVudo/WFsHKRNuOhWlbdjrfs5JHrYb0wIJqGpI= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microcosm-cc/bluemonday v1.0.1/go.mod h1:hsXNsILzKxV+sX77C5b8FSuKF00vh2OMYv+xgHpAMF4= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJEU3ofeGjhHklVoIGuVj85JJwZ6kWPaJwCIxgnFmo= github.com/neelance/sourcemap v0.0.0-20151028013722-8c68805598ab/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/nyaosorg/go-windows-dbg v0.0.0-20210914123807-2acba179a4e5 h1:znLCa6TrPGsRkXPuKVsvc4+2CPP6q/86XONwgAGacMY= +github.com/nyaosorg/go-windows-dbg v0.0.0-20210914123807-2acba179a4e5/go.mod h1:CddPouRgNL7B8Gt+XJ0Ex8F2ABQURTknkq2SUC7tHG8= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.13.0 h1:7lLHu94wT9Ij0o6EWWclhu0aOh32VxhkwEJvzuWPeak= github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= +github.com/parvit/kardianos-service v0.0.0-20220822101756-89fc969969b8 h1:cslMmRUtx18Z3hliDoSw727yxxPEa8+CNdhrhFpxa5Q= +github.com/parvit/kardianos-service v0.0.0-20220822101756-89fc969969b8/go.mod h1:2hdrOLAZgUpNyRF7Qv2WWTrwjB/v4sgEfWx0KE06K80= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/common v0.0.0-20180801064454-c7de2306084e/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/procfs v0.0.0-20180725123919-05ee40e3a273/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= +github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY= @@ -161,11 +185,13 @@ github.com/sqweek/dialog v0.0.0-20220504154117-be45b268883a/go.mod h1:/qNPSY91qT github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU= github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opencensus.io v0.18.0/go.mod h1:vKdFvxhtzZ9onBp9VKHK8z/sRpBMnKAsufL7wlDrCOA= go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw= @@ -173,14 +199,19 @@ golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -188,14 +219,14 @@ golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e h1:TsQ7F31D3bUCLeqPT0u+yjp1guoArKaNKmCr22PYgTQ= +golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -206,7 +237,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -216,21 +248,24 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201231184435-2d18734c6014/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -238,8 +273,11 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20181030000716-a0a13e073c7b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -266,10 +304,10 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= @@ -277,8 +315,8 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= grpc.go4.org v0.0.0-20170609214715-11d0a25b4919/go.mod h1:77eQGdRu53HpSqPFJFmuJdjuHRquDANNeA4x7B8WQ9o= diff --git a/installer/applications-internet.ico b/installer/applications-internet.ico index a136da1b..494dfda0 100644 Binary files a/installer/applications-internet.ico and b/installer/applications-internet.ico differ diff --git a/installer/installer.wixproj b/installer/installer.wixproj index 8a2945e3..57142d76 100644 --- a/installer/installer.wixproj +++ b/installer/installer.wixproj @@ -36,7 +36,7 @@ - heat.exe dir $(ProjectDir)..\build -directoryid BUILDDIR -gg -cg GROUPBIN -indent 3 -nologo -projectname qpep -ke -suid -template fragment -var var.SourceDir -sw -o $(ProjectDir)binaries.wxs + heat.exe dir $(ProjectDir)..\build -directoryid BUILDDIR -srd -gg -cg GROUPBIN -indent 3 -nologo -projectname qpep -ke -suid -template fragment -var var.SourceDir -sw -o $(ProjectDir)binaries.wxs ": "<----") ); - + continue; } @@ -298,14 +298,14 @@ DWORD WINAPI dispatchDivertedOutboundPackets(LPVOID lpParameter) UINT localSrcPort = ntohs(tcp_header->SrcPort); UINT localDstPort = ntohs(tcp_header->DstPort); - + if( !recv_addr.Outbound ) { logNativeMessageToGo(th->threadID, "Dropped..."); continue; } // announce and handle the packet - logNativeMessageToGo(th->threadID, "Received packet: [%d:%d] %s:%d %s %s:%d (%d) [S:%d A:%d F:%d P:%d R:%d]", + logNativeMessageToGo(th->threadID, "Received packet: [%d:%d] %s:%d %s %s:%d (%d) [S:%d A:%d F:%d P:%d R:%d]", recv_addr.Network.IfIdx, recv_addr.Network.SubIfIdx, src_str, ntohs(tcp_header->SrcPort), (recv_addr.Outbound? "---->": "<----"), diff --git a/windivert/windivert.go b/windivert/windivert.go index f61c5432..e294c041 100644 --- a/windivert/windivert.go +++ b/windivert/windivert.go @@ -1,9 +1,9 @@ //go:build !cgo -// +build !cgo package windivert import ( + . "github.com/parvit/qpep/logger" "log" ) @@ -20,16 +20,16 @@ func InitializeWinDivertEngine(gatewayAddr, listenAddr string, gatewayPort, list } func CloseWinDivertEngine() int { - log.Println("WARNING: windivert package compiled without CGO") // message to check for failing CGO + Info("WARNING: windivert package compiled without CGO") // message to check for failing CGO return DIVERT_OK } func GetConnectionStateData(port int) (int, int, int, string, string) { - log.Println("WARNING: windivert package compiled without CGO") // message to check for failing CGO + Info("WARNING: windivert package compiled without CGO") // message to check for failing CGO return DIVERT_OK, -1, -1, "", "" } func EnableDiverterLogging(enable bool) { - log.Println("WARNING: windivert package compiled without CGO") // message to check for failing CGO + Info("WARNING: windivert package compiled without CGO") // message to check for failing CGO return } diff --git a/windivert/windivert_linux.go b/windivert/windivert_linux.go index 00d7a7fa..43b15b05 100644 --- a/windivert/windivert_linux.go +++ b/windivert/windivert_linux.go @@ -1,5 +1,4 @@ //go:build linux && cgo -// +build linux,cgo package windivert diff --git a/windivert/windivert_windows.go b/windivert/windivert_windows.go index f927ba67..9641fba2 100644 --- a/windivert/windivert_windows.go +++ b/windivert/windivert_windows.go @@ -1,5 +1,4 @@ //go:build windows && cgo -// +build windows,cgo package windivert @@ -10,8 +9,9 @@ package windivert import "C" import ( - "log" "unsafe" + + . "github.com/parvit/qpep/logger" ) const ( @@ -68,11 +68,11 @@ func EnableDiverterLogging(enable bool) { val = 1 } - log.Println(msg) + Info(msg) C.EnableMessageOutputToGo(C.int(val)) } //export logMessageToGo func logMessageToGo(msg *C.char) { - log.Println(C.GoString(msg)) + Info(C.GoString(msg)) }