2024-08-29 21:31:19 +02:00
|
|
|
//go:build !windows
|
|
|
|
|
|
|
|
package iface
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
|
|
|
|
2024-10-02 18:24:22 +02:00
|
|
|
"github.com/netbirdio/netbird/client/iface/bind"
|
|
|
|
"github.com/netbirdio/netbird/client/iface/configurer"
|
|
|
|
"github.com/netbirdio/netbird/client/iface/device"
|
2024-10-22 20:53:14 +02:00
|
|
|
"github.com/netbirdio/netbird/client/iface/wgproxy"
|
2024-08-29 21:31:19 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
type IWGIface interface {
|
|
|
|
Create() error
|
|
|
|
CreateOnAndroid(routeRange []string, ip string, domains []string) error
|
|
|
|
IsUserspaceBind() bool
|
|
|
|
Name() string
|
2024-10-02 18:24:22 +02:00
|
|
|
Address() device.WGAddress
|
2024-08-29 21:31:19 +02:00
|
|
|
ToInterface() *net.Interface
|
|
|
|
Up() (*bind.UniversalUDPMuxDefault, error)
|
|
|
|
UpdateAddr(newAddr string) error
|
2024-10-22 20:53:14 +02:00
|
|
|
GetProxy() wgproxy.Proxy
|
2024-08-29 21:31:19 +02:00
|
|
|
UpdatePeer(peerKey string, allowedIps string, keepAlive time.Duration, endpoint *net.UDPAddr, preSharedKey *wgtypes.Key) error
|
|
|
|
RemovePeer(peerKey string) error
|
|
|
|
AddAllowedIP(peerKey string, allowedIP string) error
|
|
|
|
RemoveAllowedIP(peerKey string, allowedIP string) error
|
|
|
|
Close() error
|
2024-10-02 18:24:22 +02:00
|
|
|
SetFilter(filter device.PacketFilter) error
|
|
|
|
GetFilter() device.PacketFilter
|
|
|
|
GetDevice() *device.FilteredDevice
|
|
|
|
GetStats(peerKey string) (configurer.WGStats, error)
|
2024-08-29 21:31:19 +02:00
|
|
|
}
|