Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWireguardClient ¶
func NewWireguardClient() (*client, error)
NewWireguardClient creates new wireguard user space client.
func ParseDevicePeerStats ¶
func ParseDevicePeerStats(d *UserspaceDevice) (wgcfg.Stats, error)
ParseDevicePeerStats parses current active consumer stats.
Types ¶
type UserspaceDevice ¶
type UserspaceDevice struct { // ListenPort is the device's network listening port. ListenPort int // FirewallMark is the device's current firewall mark. // // The firewall mark can be used in conjunction with firewall software to // take action on outgoing WireGuard packets. FirewallMark int // Peers is the list of network peers associated with this device. Peers []UserspaceDevicePeer }
UserspaceDevice is a WireGuard device.
func ParseUserspaceDevice ¶
func ParseUserspaceDevice(ipcGetOp func(w io.Writer) error) (*UserspaceDevice, error)
ParseUserspaceDevice parses WireGuard device state buffer.
type UserspaceDevicePeer ¶
type UserspaceDevicePeer struct { // PublicKey is the public key of a peer, computed from its private key. // // PublicKey is always present in a Peer. PublicKey string // Endpoint is the most recent source address used for communication by // this Peer. Endpoint *net.UDPAddr // PersistentKeepaliveInterval specifies how often an "empty" packet is sent // to a peer to keep a connection alive. // // A value of 0 indicates that persistent keepalives are disabled. PersistentKeepaliveInterval time.Duration // LastHandshakeTime indicates the most recent time a handshake was performed // with this peer. // // A zero-value time.Time indicates that no handshake has taken place with // this peer. LastHandshakeTime time.Time // ReceiveBytes indicates the number of bytes received from this peer. ReceiveBytes int64 // TransmitBytes indicates the number of bytes transmitted to this peer. TransmitBytes int64 // AllowedIPs specifies which IPv4 and IPv6 addresses this peer is allowed // to communicate on. // // 0.0.0.0/0 indicates that all IPv4 addresses are allowed, and ::/0 // indicates that all IPv6 addresses are allowed. AllowedIPs []net.IPNet // ProtocolVersion specifies which version of the WireGuard protocol is used // for this Peer. // // A value of 0 indicates that the most recent protocol version will be used. ProtocolVersion int }
UserspaceDevicePeer is a WireGuard peer to a Device.
Click to show internal directories.
Click to hide internal directories.