registration

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

The registration package is responsible for the memorization of all the reqeusts. It does not interact with iptables or other part of the program. It is made to abstract the memorization process.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIpToMac

func AddIpToMac(ip net.IP, mac net.HardwareAddr)

This function adds the ip to the registration associated with the mac address. If the ip is in the Ips or OldIps fields nothing is done

func AddRegistrationToMapFromDB

func AddRegistrationToMapFromDB(r Registration)

func Init

func Init()

func Remove

func Remove(r Registration)

func RemoveIP

func RemoveIP(e Registration, ip net.IP)

This function removes the ip form the Ips field of a registration and save the new registration to the hashmap.

func SetHostDown

func SetHostDown(e Registration)

func SetHostUp

func SetHostUp(e Registration)

func SetOldIP

func SetOldIP(e Registration, ip net.IP)

This function removes the ip form the Ips field of a registration, move the ip to the OldIp field and save the new registration to the hashmap.

func UpdateLastPing

func UpdateLastPing(e Registration)

Types

type Registration

type Registration struct {
	Id       uint64
	User     string
	Mac      string
	Ips      []net.IP
	OldIps   []net.IP
	Start    time.Time
	End      time.Time
	LastPing time.Time
	IsDown   bool
}

A Registration represent a pass that is binded to a user. The pass allow a Mac to exit the firewall

func AddRequest

func AddRequest(newRequest comunication.Request) (r Registration)

func GetAllEntries

func GetAllEntries() (entries []Registration)

func GetOldEntries

func GetOldEntries() (oldEntries []Registration)

Old entries are registration on the hashmap that have the connection time expired.

func GetOldStateFromDB

func GetOldStateFromDB() []Registration

func (*Registration) String

func (e *Registration) String() string

Jump to

Keyboard shortcuts

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