Documentation ¶
Index ¶
- Variables
- func WireGuardModuleIsLoaded() bool
- type FilteredDevice
- type MobileIFaceArguments
- type PacketFilter
- type TunAdapter
- type TunDevice
- func (t *TunDevice) Close() error
- func (t *TunDevice) Create() (WGConfigurer, error)
- func (t *TunDevice) DeviceName() string
- func (t *TunDevice) FilteredDevice() *FilteredDevice
- func (t *TunDevice) Up() (*bind.UniversalUDPMuxDefault, error)
- func (t *TunDevice) UpdateAddr(address WGAddress) error
- func (t *TunDevice) WgAddress() WGAddress
- type TunNetstackDevice
- func (t *TunNetstackDevice) Close() error
- func (t *TunNetstackDevice) Create() (WGConfigurer, error)
- func (t *TunNetstackDevice) DeviceName() string
- func (t *TunNetstackDevice) FilteredDevice() *FilteredDevice
- func (t *TunNetstackDevice) Up() (*bind.UniversalUDPMuxDefault, error)
- func (t *TunNetstackDevice) UpdateAddr(WGAddress) error
- func (t *TunNetstackDevice) WgAddress() WGAddress
- type WGAddress
- type WGConfigurer
Constants ¶
This section is empty.
Variables ¶
View Source
var CustomWindowsGUIDString string
CustomWindowsGUIDString is a custom GUID string for the interface
Functions ¶
func WireGuardModuleIsLoaded ¶
func WireGuardModuleIsLoaded() bool
WireGuardModuleIsLoaded check if we can load WireGuard mod (linux only)
Types ¶
type FilteredDevice ¶
FilteredDevice to override Read or Write of packets
func (*FilteredDevice) SetFilter ¶
func (d *FilteredDevice) SetFilter(filter PacketFilter)
SetFilter sets packet filter to device
type MobileIFaceArguments ¶
type MobileIFaceArguments struct { TunAdapter TunAdapter // only for Android TunFd int // only for iOS }
type PacketFilter ¶
type PacketFilter interface { // DropOutgoing filter outgoing packets from host to external destinations DropOutgoing(packetData []byte) bool // DropIncoming filter incoming packets from external sources to host DropIncoming(packetData []byte) bool // AddUDPPacketHook calls hook when UDP packet from given direction matched // // Hook function returns flag which indicates should be the matched package dropped or not. // Hook function receives raw network packet data as argument. AddUDPPacketHook(in bool, ip net.IP, dPort uint16, hook func(packet []byte) bool) string // RemovePacketHook removes hook by ID RemovePacketHook(hookID string) error // SetNetwork of the wireguard interface to which filtering applied SetNetwork(*net.IPNet) }
PacketFilter interface for firewall abilities
type TunAdapter ¶
type TunAdapter interface { ConfigureInterface(address string, mtu int, dns string, searchDomains string, routes string) (int, error) UpdateAddr(address string) error ProtectSocket(fd int32) bool }
TunAdapter is an interface for create tun device from external service
type TunDevice ¶
type TunDevice struct {
// contains filtered or unexported fields
}
func NewTunDevice ¶
func (*TunDevice) Create ¶
func (t *TunDevice) Create() (WGConfigurer, error)
func (*TunDevice) DeviceName ¶
func (*TunDevice) FilteredDevice ¶
func (t *TunDevice) FilteredDevice() *FilteredDevice
func (*TunDevice) UpdateAddr ¶
type TunNetstackDevice ¶
type TunNetstackDevice struct {
// contains filtered or unexported fields
}
func NewNetstackDevice ¶
func (*TunNetstackDevice) Close ¶
func (t *TunNetstackDevice) Close() error
func (*TunNetstackDevice) Create ¶
func (t *TunNetstackDevice) Create() (WGConfigurer, error)
func (*TunNetstackDevice) DeviceName ¶
func (t *TunNetstackDevice) DeviceName() string
func (*TunNetstackDevice) FilteredDevice ¶
func (t *TunNetstackDevice) FilteredDevice() *FilteredDevice
func (*TunNetstackDevice) Up ¶
func (t *TunNetstackDevice) Up() (*bind.UniversalUDPMuxDefault, error)
func (*TunNetstackDevice) UpdateAddr ¶
func (t *TunNetstackDevice) UpdateAddr(WGAddress) error
func (*TunNetstackDevice) WgAddress ¶
func (t *TunNetstackDevice) WgAddress() WGAddress
type WGAddress ¶
WGAddress WireGuard parsed address
func ParseWGAddress ¶
ParseWGAddress parse a string ("1.2.3.4/24") address to WG Address
type WGConfigurer ¶
type WGConfigurer interface { ConfigureInterface(privateKey string, port int) 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() GetStats(peerKey string) (configurer.WGStats, error) }
Click to show internal directories.
Click to hide internal directories.