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 ¶
- func AddIpToMac(ip net.IP, mac net.HardwareAddr)
- func AddRegistrationToMapFromDB(r Registration)
- func Init()
- func Remove(r Registration)
- func RemoveIP(e Registration, ip net.IP)
- func SetHostDown(e Registration)
- func SetHostUp(e Registration)
- func SetOldIP(e Registration, ip net.IP)
- func UpdateLastPing(e Registration)
- type Registration
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 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