diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-07-05 22:48:28 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-10-19 22:54:24 +0200 |
commit | a4a7fd07616032b112d20f3debf89dfb874f9e6d (patch) | |
tree | 31e24c30bef8c450f54756ebd6156be8e44245a1 /tunnel/tools/libwg-go/service.go | |
parent | e68ddd2bc6f784c9e4985c13d915ed77bfcc6831 (diff) |
WIP: add cap to grpc
Diffstat (limited to 'tunnel/tools/libwg-go/service.go')
-rw-r--r-- | tunnel/tools/libwg-go/service.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tunnel/tools/libwg-go/service.go b/tunnel/tools/libwg-go/service.go index f5460486..41834fe0 100644 --- a/tunnel/tools/libwg-go/service.go +++ b/tunnel/tools/libwg-go/service.go @@ -314,3 +314,29 @@ func (e *LibwgServiceImpl) Dhcp(ctx context.Context, req *gen.DhcpRequest) (*gen } return r, nil } + +func (e *LibwgServiceImpl) CapabilitiesChanged(ctx context.Context, req *gen.CapabilitiesChangedRequest) (*gen.CapabilitiesChangedResponse, error) { + if e.httpProxy == nil { + r := &gen.CapabilitiesChangedResponse{ + Error: &gen.Error{ + Message: fmt.Sprintf("Http Proxy not running"), + }, + } + return r, nil + } + + notMetered := false + + for _, cap := range req.Capabilities { + if cap == gen.CapabilitiesChangedRequest_NOT_METERED { + notMetered = true + } + } + + e.logger.Verbosef("Set not metered %v", notMetered) + e.httpProxy.SetNotMetered(notMetered) + + r := &gen.CapabilitiesChangedResponse{ + } + return r, nil +} |