Documentation ¶
Index ¶
- Constants
- type IWGIface
- type MockWGIface
- func (m *MockWGIface) AddAllowedIP(peerKey string, allowedIP string) error
- func (m *MockWGIface) Address() device.WGAddress
- func (m *MockWGIface) Close() error
- func (m *MockWGIface) Create() error
- func (m *MockWGIface) CreateOnAndroid(routeRange []string, ip string, domains []string) error
- func (m *MockWGIface) GetDevice() *device.FilteredDevice
- func (m *MockWGIface) GetFilter() device.PacketFilter
- func (m *MockWGIface) GetInterfaceGUIDString() (string, error)
- func (m *MockWGIface) GetStats(peerKey string) (configurer.WGStats, error)
- func (m *MockWGIface) IsUserspaceBind() bool
- func (m *MockWGIface) Name() string
- func (m *MockWGIface) RemoveAllowedIP(peerKey string, allowedIP string) error
- func (m *MockWGIface) RemovePeer(peerKey string) error
- func (m *MockWGIface) SetFilter(filter device.PacketFilter) error
- func (m *MockWGIface) ToInterface() *net.Interface
- func (m *MockWGIface) Up() (*bind.UniversalUDPMuxDefault, error)
- func (m *MockWGIface) UpdateAddr(newAddr string) error
- func (m *MockWGIface) UpdatePeer(peerKey string, allowedIps string, keepAlive time.Duration, ...) error
- type WGAddress
- type WGIface
- func (w *WGIface) AddAllowedIP(peerKey string, allowedIP string) error
- func (w *WGIface) Address() device.WGAddress
- func (w *WGIface) Close() error
- func (w *WGIface) Create() error
- func (w *WGIface) CreateOnAndroid([]string, string, []string) error
- func (w *WGIface) Destroy() error
- func (w *WGIface) GetDevice() *device.FilteredDevice
- func (w *WGIface) GetFilter() device.PacketFilter
- func (w *WGIface) GetStats(peerKey string) (configurer.WGStats, error)
- func (w *WGIface) IsUserspaceBind() bool
- func (w *WGIface) Name() string
- func (w *WGIface) RemoveAllowedIP(peerKey string, allowedIP string) error
- func (w *WGIface) RemovePeer(peerKey string) error
- func (w *WGIface) SetFilter(filter device.PacketFilter) error
- func (r *WGIface) ToInterface() *net.Interface
- func (w *WGIface) Up() (*bind.UniversalUDPMuxDefault, error)
- func (w *WGIface) UpdateAddr(newAddr string) error
- func (w *WGIface) UpdatePeer(peerKey string, allowedIps string, keepAlive time.Duration, ...) error
- type WGTunDevice
Constants ¶
const ( DefaultMTU = 1280 DefaultWgPort = 51820 WgInterfaceDefault = configurer.WgInterfaceDefault )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IWGIface ¶
type IWGIface 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 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 GetStats(peerKey string) (configurer.WGStats, error) }
type MockWGIface ¶
type MockWGIface struct { CreateFunc func() error CreateOnAndroidFunc func(routeRange []string, ip string, domains []string) error IsUserspaceBindFunc func() bool NameFunc func() string AddressFunc func() device.WGAddress ToInterfaceFunc func() *net.Interface UpFunc func() (*bind.UniversalUDPMuxDefault, error) UpdateAddrFunc func(newAddr string) error UpdatePeerFunc func(peerKey string, allowedIps string, keepAlive time.Duration, endpoint *net.UDPAddr, preSharedKey *wgtypes.Key) error RemovePeerFunc func(peerKey string) error AddAllowedIPFunc func(peerKey string, allowedIP string) error RemoveAllowedIPFunc func(peerKey string, allowedIP string) error CloseFunc func() error SetFilterFunc func(filter device.PacketFilter) error GetFilterFunc func() device.PacketFilter GetDeviceFunc func() *device.FilteredDevice GetStatsFunc func(peerKey string) (configurer.WGStats, error) GetInterfaceGUIDStringFunc func() (string, error) }
func (*MockWGIface) AddAllowedIP ¶
func (m *MockWGIface) AddAllowedIP(peerKey string, allowedIP string) error
func (*MockWGIface) Address ¶
func (m *MockWGIface) Address() device.WGAddress
func (*MockWGIface) Close ¶
func (m *MockWGIface) Close() error
func (*MockWGIface) Create ¶
func (m *MockWGIface) Create() error
func (*MockWGIface) CreateOnAndroid ¶
func (m *MockWGIface) CreateOnAndroid(routeRange []string, ip string, domains []string) error
func (*MockWGIface) GetDevice ¶
func (m *MockWGIface) GetDevice() *device.FilteredDevice
func (*MockWGIface) GetFilter ¶
func (m *MockWGIface) GetFilter() device.PacketFilter
func (*MockWGIface) GetInterfaceGUIDString ¶
func (m *MockWGIface) GetInterfaceGUIDString() (string, error)
func (*MockWGIface) GetStats ¶
func (m *MockWGIface) GetStats(peerKey string) (configurer.WGStats, error)
func (*MockWGIface) IsUserspaceBind ¶
func (m *MockWGIface) IsUserspaceBind() bool
func (*MockWGIface) Name ¶
func (m *MockWGIface) Name() string
func (*MockWGIface) RemoveAllowedIP ¶
func (m *MockWGIface) RemoveAllowedIP(peerKey string, allowedIP string) error
func (*MockWGIface) RemovePeer ¶
func (m *MockWGIface) RemovePeer(peerKey string) error
func (*MockWGIface) SetFilter ¶
func (m *MockWGIface) SetFilter(filter device.PacketFilter) error
func (*MockWGIface) ToInterface ¶
func (m *MockWGIface) ToInterface() *net.Interface
func (*MockWGIface) Up ¶
func (m *MockWGIface) Up() (*bind.UniversalUDPMuxDefault, error)
func (*MockWGIface) UpdateAddr ¶
func (m *MockWGIface) UpdateAddr(newAddr string) error
type WGIface ¶
type WGIface struct {
// contains filtered or unexported fields
}
WGIface represents an interface instance
func NewWGIFace ¶
func NewWGIFace(iFaceName string, address string, wgPort int, wgPrivKey string, mtu int, transportNet transport.Net, args *device.MobileIFaceArguments, filterFn bind.FilterFn) (*WGIface, error)
NewWGIFace Creates a new WireGuard interface instance
func (*WGIface) AddAllowedIP ¶
AddAllowedIP adds a prefix to the allowed IPs list of peer
func (*WGIface) Create ¶
Create creates a new Wireguard interface, sets a given IP and brings it up. Will reuse an existing one. this function is different on Android
func (*WGIface) CreateOnAndroid ¶
CreateOnAndroid this function make sense on mobile only
func (*WGIface) GetDevice ¶
func (w *WGIface) GetDevice() *device.FilteredDevice
GetDevice to interact with raw device (with filtering)
func (*WGIface) GetFilter ¶
func (w *WGIface) GetFilter() device.PacketFilter
GetFilter returns packet filter used by interface if it uses userspace device implementation
func (*WGIface) GetStats ¶
func (w *WGIface) GetStats(peerKey string) (configurer.WGStats, error)
GetStats returns the last handshake time, rx and tx bytes for the given peer
func (*WGIface) IsUserspaceBind ¶
IsUserspaceBind indicates whether this interfaces is userspace with bind.ICEBind
func (*WGIface) RemoveAllowedIP ¶
RemoveAllowedIP removes a prefix from the allowed IPs list of peer
func (*WGIface) RemovePeer ¶
RemovePeer removes a Wireguard Peer from the interface iface
func (*WGIface) SetFilter ¶
func (w *WGIface) SetFilter(filter device.PacketFilter) error
SetFilter sets packet filters for the userspace implementation
func (*WGIface) ToInterface ¶
ToInterface returns the net.Interface for the Wireguard interface
func (*WGIface) Up ¶
func (w *WGIface) Up() (*bind.UniversalUDPMuxDefault, error)
Up configures a Wireguard interface The interface must exist before calling this method (e.g. call interface.Create() before)
func (*WGIface) UpdateAddr ¶
UpdateAddr updates address of the interface
type WGTunDevice ¶
type WGTunDevice interface { Create() (device.WGConfigurer, error) Up() (*bind.UniversalUDPMuxDefault, error) UpdateAddr(address WGAddress) error WgAddress() WGAddress DeviceName() string Close() error FilteredDevice() *device.FilteredDevice }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package iface provides wireguard network interface creation and management
|
Package iface provides wireguard network interface creation and management |
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
iface/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |