Documentation ¶
Overview ¶
Package iface provides wireguard network interface creation and management
Index ¶
- Constants
- Variables
- func WireGuardModuleIsLoaded() bool
- type NetInterface
- type TunAdapter
- type WGAddress
- type WGIface
- func (w *WGIface) AddAllowedIP(peerKey string, allowedIP string) error
- func (w *WGIface) Address() WGAddress
- func (w *WGIface) Close() error
- func (w *WGIface) Configure(privateKey string, port int) error
- func (w *WGIface) Create() error
- func (w *WGIface) GetBind() *bind.ICEBind
- 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) UpdateAddr(newAddr string) error
- func (w *WGIface) UpdatePeer(peerKey string, allowedIps string, keepAlive time.Duration, ...) error
Constants ¶
const ( DefaultMTU = 1280 DefaultWgPort = 51820 )
const WgInterfaceDefault = "wt0"
WgInterfaceDefault is a default interface name of Wiretrustee
Variables ¶
var ( // ErrModuleNotFound is the error resulting if a module can't be found. ErrModuleNotFound = errors.New("module not found") )
Functions ¶
func WireGuardModuleIsLoaded ¶ added in v0.16.0
func WireGuardModuleIsLoaded() bool
WireGuardModuleIsLoaded check if we can load WireGuard mod (linux only)
Types ¶
type NetInterface ¶
type NetInterface interface {
Close() error
}
NetInterface represents a generic network tunnel interface
type TunAdapter ¶ added in v0.14.5
type TunAdapter interface { ConfigureInterface(address string, mtu int, routes string) (int, error) UpdateAddr(address string) error }
TunAdapter is an interface for create tun device from externel service
type WGIface ¶
type WGIface struct {
// contains filtered or unexported fields
}
WGIface represents a interface instance
func NewWGIFace ¶ added in v0.6.3
func NewWGIFace(iFaceName string, address string, mtu int, routes []string, tunAdapter TunAdapter, transportNet transport.Net) (*WGIface, error)
NewWGIFace Creates a new WireGuard interface instance
func (*WGIface) AddAllowedIP ¶ added in v0.9.0
AddAllowedIP adds a prefix to the allowed IPs list of peer
func (*WGIface) Configure ¶
Configure configures a Wireguard interface The interface must exist before calling this method (e.g. call interface.Create() before)
func (*WGIface) Create ¶
Create creates a new Wireguard interface, sets a given IP and brings it up. Will reuse an existing one.
func (*WGIface) GetBind ¶ added in v0.16.0
GetBind returns a userspace implementation of WireGuard Bind interface
func (*WGIface) IsUserspaceBind ¶ added in v0.16.0
IsUserspaceBind indicates whether this interfaces is userspace with bind.ICEBind
func (*WGIface) RemoveAllowedIP ¶ added in v0.9.0
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) UpdateAddr ¶ added in v0.6.3
UpdateAddr updates address of the interface