From c7553c3ba4c6718ad6c626ede9085bae51dfc5bf Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Wed, 5 Jul 2023 22:48:28 +0200 Subject: WIP: add cap to grpc --- tunnel/tools/libwg-go/http-proxy.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tunnel/tools/libwg-go/http-proxy.go') diff --git a/tunnel/tools/libwg-go/http-proxy.go b/tunnel/tools/libwg-go/http-proxy.go index 9c457286..241c7f7d 100644 --- a/tunnel/tools/libwg-go/http-proxy.go +++ b/tunnel/tools/libwg-go/http-proxy.go @@ -451,6 +451,8 @@ func (p *HttpProxy) SetPacFileUrl(pacFileUrl *url.URL) error { p.ctx.Destroy() } p.ctx = ctx + p.logger.Verbosef("SetNotMetered(false) from SetPacFileUrl") + p.SetNotMetered(false) return nil } @@ -465,6 +467,23 @@ func (p *HttpProxy) SetPacFileContent(pacFile string) error { p.ctx.Destroy() } p.ctx = ctx + p.logger.Verbosef("SetNotMetered(false) from SetPacFileContent") + p.SetNotMetered(false) + return nil +} + +func (p *HttpProxy) SetNotMetered(notMetered bool) error { + p.logger.Verbosef("SetNotMetered: %v", notMetered) + + if p.ctx == nil { + return fmt.Errorf("No ductape context") + } + + p.ctx.PushGlobalObject() + p.ctx.PushBoolean(notMetered) + p.ctx.PutPropString(-2, "notMetered") + p.ctx.Pop() + return nil } -- cgit v1.2.3