utils

package
v0.0.0-...-be9b5ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNetworkInterfaceByName

func GetNetworkInterfaceByName(name string)

GetNetworkInterfaceByName returns details about a single user provided interface

func MaybeSendDiscoveryPacket

func MaybeSendDiscoveryPacket(co ConfigOptions, p vrt.VRT)

MaybeSendDiscoveryPacket regenerates and sends the Discovery Packet if EnableBroadcast is true

func PrintVrtPacket

func PrintVrtPacket(vrt_packet vrt.VRT)

Types

type ConfigOptions

type ConfigOptions struct {
	Mode                 string
	PcapFile             string
	NetworkInteface      NetInteface
	Clients              []net.IP
	EnableBroadcast      bool
	EnableDebug          bool
	EnableDeleteUsers    bool
	BPFFilter            string
	NetbirdApiConnection NetbirdApi
	BroadcastPort        int
}

type NetInteface

type NetInteface struct {
	Name       string
	IPAddress  net.IP
	MACAddress net.HardwareAddr
}

func ValidateNetworkInterfaceByName

func ValidateNetworkInterfaceByName(name string) (NetInteface, error)

ValidateNetworkInterfaceByName returns details about a single user provided interface

type NetbirdApi

type NetbirdApi struct {
	Password string
	Url      string
}

type Users

type Users struct {
	// contains filtered or unexported fields
}

func UsersDb

func UsersDb() (*Users, error)

UsersDb creates a sqlite database with a clients table and schema if the file does not already exist

func (*Users) DeleteAllUsers

func (c *Users) DeleteAllUsers() error

DeleteAllUsers removes all user records from the db

func (*Users) GetUserIpAddresses

func (c *Users) GetUserIpAddresses() ([]string, error)

GetUserIpAddresses returns the ip address of every user record in the db

func (*Users) Insert

func (c *Users) Insert(activity VpnRouteRow) (int, error)

Insert adds a user record to the db

type VpnRouteRow

type VpnRouteRow struct {
	AccessiblePeersCount int    `json:"accessible_peers_count"`
	ApprovalRequired     bool   `json:"approval_required"`
	CityName             string `json:"city_name"`
	Connected            bool   `json:"connected"`
	ConnectionIP         string `json:"connection_ip"`
	CountryCode          string `json:"country_code"`
	DNSLabel             string `json:"dns_label"`
	GeoNameID            int    `json:"geoname_id"`
	Groups               []struct {
		ID         string `json:"id"`
		Name       string `json:"name"`
		PeersCount int    `json:"peers_count"`
	} `json:"groups"`
	Hostname                    string `json:"hostname"`
	ID                          string `json:"id"`
	InactivityExpirationEnabled bool   `json:"inactivity_expiration_enabled"`
	IP                          string `json:"ip"`
	KernelVersion               string `json:"kernel_version"`
	LastLogin                   string `json:"last_login"`
	LastSeen                    string `json:"last_seen"`
	LoginExpirationEnabled      bool   `json:"login_expiration_enabled"`
	LoginExpired                bool   `json:"login_expired"`
	Name                        string `json:"name"`
	OS                          string `json:"os"`
	SerialNumber                string `json:"serial_number"`
	SSHEnabled                  bool   `json:"ssh_enabled"`
	UIVersion                   string `json:"ui_version"`
	UserID                      string `json:"user_id"`
	Version                     string `json:"version"`
}

type VpnRoutes

type VpnRoutes struct {
	Total    int `json:"total"`
	RowCount int `json:"rowCount"`
	Current  int `json:"current"`
	Rows     []VpnRouteRow
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL