Export RenewFD function for Android

This commit is contained in:
Zoltán Papp
2025-09-23 19:29:50 +02:00
parent 58faa341d2
commit f088b4ae43
6 changed files with 45 additions and 8 deletions
+9 -2
View File
@@ -446,8 +446,6 @@ func (e *Engine) Start(netbirdConfig *mgmProto.NetbirdConfig, mgmtURL *url.URL)
return fmt.Errorf("up wg interface: %w", err)
}
// if inbound conns are blocked there is no need to create the ACL manager
if e.firewall != nil && !e.config.BlockInbound {
e.acl = acl.NewDefaultManager(e.firewall)
@@ -1828,6 +1826,15 @@ func (e *Engine) GetWgAddr() netip.Addr {
return e.wgInterface.Address().IP
}
func (e *Engine) RenewTun(fd int) error {
// todo review the mutex usage here. We must to be sure we do not modify the e.wgInterface when run this function
if e.wgInterface == nil {
return fmt.Errorf("wireguard interface not initialized")
}
return e.wgInterface.RenewTun(fd)
}
// updateDNSForwarder start or stop the DNS forwarder based on the domains and the feature flag
func (e *Engine) updateDNSForwarder(
enabled bool,
+1
View File
@@ -20,6 +20,7 @@ import (
type wgIfaceBase interface {
Create() error
CreateOnAndroid(routeRange []string, ip string, domains []string) error
RenewTun(fd int) error
IsUserspaceBind() bool
Name() string
Address() wgaddr.Address