-
-
Notifications
You must be signed in to change notification settings - Fork 587
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
70 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package internal | ||
|
||
import ( | ||
"net" | ||
"time" | ||
|
||
wgdevice "golang.zx2c4.com/wireguard/device" | ||
"golang.zx2c4.com/wireguard/tun/netstack" | ||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes" | ||
|
||
"github.com/netbirdio/netbird/client/iface/bind" | ||
"github.com/netbirdio/netbird/client/iface/configurer" | ||
"github.com/netbirdio/netbird/client/iface/device" | ||
"github.com/netbirdio/netbird/client/iface/wgproxy" | ||
) | ||
|
||
type wgIfaceBase interface { | ||
Create() error | ||
CreateOnAndroid(routeRange []string, ip string, domains []string) error | ||
IsUserspaceBind() bool | ||
Name() string | ||
Address() device.WGAddress | ||
ToInterface() *net.Interface | ||
Up() (*bind.UniversalUDPMuxDefault, error) | ||
UpdateAddr(newAddr string) error | ||
GetProxy() wgproxy.Proxy | ||
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 | ||
SetFilter(filter device.PacketFilter) error | ||
GetFilter() device.PacketFilter | ||
GetDevice() *device.FilteredDevice | ||
GetWGDevice() *wgdevice.Device | ||
GetStats(peerKey string) (configurer.WGStats, error) | ||
GetNet() *netstack.Net | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,6 @@ | ||
package internal | ||
|
||
import ( | ||
"net" | ||
"time" | ||
|
||
wgdevice "golang.zx2c4.com/wireguard/device" | ||
"golang.zx2c4.com/wireguard/tun/netstack" | ||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes" | ||
|
||
"github.com/netbirdio/netbird/client/iface/bind" | ||
"github.com/netbirdio/netbird/client/iface/configurer" | ||
"github.com/netbirdio/netbird/client/iface/device" | ||
"github.com/netbirdio/netbird/client/iface/wgproxy" | ||
) | ||
|
||
type WGIface interface { | ||
Create() error | ||
CreateOnAndroid(routeRange []string, ip string, domains []string) error | ||
IsUserspaceBind() bool | ||
Name() string | ||
Address() device.WGAddress | ||
ToInterface() *net.Interface | ||
Up() (*bind.UniversalUDPMuxDefault, error) | ||
UpdateAddr(newAddr string) error | ||
GetProxy() wgproxy.Proxy | ||
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 | ||
SetFilter(filter device.PacketFilter) error | ||
GetFilter() device.PacketFilter | ||
GetDevice() *device.FilteredDevice | ||
GetWGDevice() *wgdevice.Device | ||
GetStats(peerKey string) (configurer.WGStats, error) | ||
|
||
wgIfaceBase | ||
GetInterfaceGUIDString() (string, error) | ||
GetNet() *netstack.Net | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package iface | ||
|
||
import ( | ||
"net" | ||
|
||
"github.com/netbirdio/netbird/client/iface" | ||
"github.com/netbirdio/netbird/client/iface/configurer" | ||
"github.com/netbirdio/netbird/client/iface/device" | ||
) | ||
|
||
type wgIfaceBase interface { | ||
AddAllowedIP(peerKey string, allowedIP string) error | ||
RemoveAllowedIP(peerKey string, allowedIP string) error | ||
|
||
Name() string | ||
Address() iface.WGAddress | ||
ToInterface() *net.Interface | ||
IsUserspaceBind() bool | ||
GetFilter() device.PacketFilter | ||
GetDevice() *device.FilteredDevice | ||
GetStats(peerKey string) (configurer.WGStats, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,7 @@ | ||
package iface | ||
|
||
import ( | ||
"net" | ||
|
||
"github.com/netbirdio/netbird/client/iface" | ||
"github.com/netbirdio/netbird/client/iface/configurer" | ||
"github.com/netbirdio/netbird/client/iface/device" | ||
) | ||
|
||
// WGIface defines subset methods of interface required for router | ||
type WGIface interface { | ||
AddAllowedIP(peerKey string, allowedIP string) error | ||
RemoveAllowedIP(peerKey string, allowedIP string) error | ||
|
||
Name() string | ||
Address() iface.WGAddress | ||
ToInterface() *net.Interface | ||
IsUserspaceBind() bool | ||
GetFilter() device.PacketFilter | ||
GetDevice() *device.FilteredDevice | ||
GetStats(peerKey string) (configurer.WGStats, error) | ||
|
||
wgIfaceBase | ||
GetInterfaceGUIDString() (string, error) | ||
} |