Feat linux firewall support (#805)

Update the client's engine to apply firewall rules received from the manager (results of ACL policy).
This commit is contained in:
Givi Khojanashvili
2023-05-29 16:00:18 +02:00
committed by GitHub
parent 2eb9a97fee
commit ba7a39a4fc
51 changed files with 4141 additions and 1011 deletions
+15
View File
@@ -1,6 +1,7 @@
package iface
import (
"fmt"
"net"
"sync"
"time"
@@ -118,3 +119,17 @@ func (w *WGIface) Close() error {
defer w.mu.Unlock()
return w.tun.Close()
}
// SetFiltering sets packet filters for the userspace impelemntation
func (w *WGIface) SetFiltering(filter PacketFilter) error {
w.mu.Lock()
defer w.mu.Unlock()
if w.tun.wrapper == nil {
return fmt.Errorf("userspace packet filtering not handled on this device")
}
filter.SetNetwork(w.tun.address.Network)
w.tun.wrapper.SetFiltering(filter)
return nil
}