utils

package
v0.0.0-...-663b682 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 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
	OpnsenseApiConnection OpnsenseApi
	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 OpnsenseApi

type OpnsenseApi struct {
	Username string
	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 {
	VirtualAddress string `json:"virtual_address"`
	CommonName     string `json:"common_name"`
	RealAddress    string `json:"real_address"`
	LastRef        string `json:"last_ref"`
	LastRefTime    string `json:"last_ref__time_t_"`
	Type           string `json:"type"`
	ID             string `json:"id"`
	Description    string `json:"description"`
}

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