datastore

package
v0.0.0-...-3195ca0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2014 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlockedRouteHelper

func GetBlockedRouteHelper() (*blockroutehelper, error)

func GetConnectionHelper

func GetConnectionHelper() (*connectionhelper, error)

func GetDeviceHelper

func GetDeviceHelper() (*devicehelper, error)

func GetFilterCollectionHelper

func GetFilterCollectionHelper() (*filtercollectionhelper, error)

func GetLeaseHelper

func GetLeaseHelper() (*leasehelper, error)

func GetUserFilterCollectionsHelper

func GetUserFilterCollectionsHelper() (*userfiltercollectionhelper, error)

func GetUserHelper

func GetUserHelper() (*userhelper, error)

Types

type BlockedRoute

type BlockedRoute struct {
	Source      net.IP
	Destination net.IP
}

func (*BlockedRoute) AsBytes

func (t *BlockedRoute) AsBytes() []byte

type ClassifiedConnection

type ClassifiedConnection struct {
	Connection
	// contains filtered or unexported fields
}

func NewClassifiedConnection

func NewClassifiedConnection(c Connection) (ClassifiedConnection, error)

func (*ClassifiedConnection) Classisications

func (*ClassifiedConnection) Protocol

func (t *ClassifiedConnection) Protocol() string

type Connection

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

func GetExampleConnections

func GetExampleConnections() []Connection

func NewConnectionFromPacket

func NewConnectionFromPacket(packet []byte) (Connection, error)

func NewConnectionFromPacketAndIPHeaderAndTCPHeader

func NewConnectionFromPacketAndIPHeaderAndTCPHeader(packet []byte, ipheader *ipv4.Header, tcpheader *tcp.Header) (Connection, error)

func (*Connection) AddPacket

func (t *Connection) AddPacket(packet []byte) error

func (*Connection) DestinationIP

func (t *Connection) DestinationIP() net.IP

func (*Connection) DestinationPort

func (t *Connection) DestinationPort() uint16

func (*Connection) DeviceID

func (t *Connection) DeviceID() net.HardwareAddr

func (*Connection) NumberOfPackets

func (t *Connection) NumberOfPackets() int

func (*Connection) Packets

func (t *Connection) Packets() [][]byte

func (*Connection) SourceIP

func (t *Connection) SourceIP() net.IP

func (*Connection) SourcePort

func (t *Connection) SourcePort() uint16

func (*Connection) Updated

func (t *Connection) Updated() time.Time

func (*Connection) Username

func (t *Connection) Username() string

type Connections

type Connections []Connection

func (Connections) ConnectionsForUsernameAndDeviceID

func (t Connections) ConnectionsForUsernameAndDeviceID(username, deviceid string) []Connection

func (Connections) DeviceIDs

func (t Connections) DeviceIDs() []net.HardwareAddr

func (Connections) DeviceIDsForUsername

func (t Connections) DeviceIDsForUsername(username string) []net.HardwareAddr

func (Connections) Usernames

func (t Connections) Usernames() []string

type Device

type Device struct {
	MACAddress  net.HardwareAddr
	IPAddress   net.IP
	Hostname    string
	Nickname    string
	CurrentUser *User
	DefaultUser *User
}

MACAddress Is the Primary Key IPAddress Is Needed as a Lookup [IPAddress -> MACAddress] (Things from the Kernel have the IP)

func (Device) DisplayName

func (t Device) DisplayName() string

func (*Device) GetActiveUser

func (this *Device) GetActiveUser() *User

* Get the Current Username (CurrentUser, Default User if Blank and blank if both blank)

func (*Device) GetDisplayName

func (this *Device) GetDisplayName() string

*

  • Returns the display name for this device.
  • If there is a Nickname present, returns that, otherwise return the hostname.

func (Device) MarshalJSON

func (t Device) MarshalJSON() ([]byte, error)

func (*Device) UnmarshalJSON

func (t *Device) UnmarshalJSON(data []byte) error

type FilterCollection

type FilterCollection struct {
	Name    string   //Collection Name
	Domains []string // Usually domains but should also be ok for IPs
}

func (*FilterCollection) EscapedName

func (this *FilterCollection) EscapedName() string

*

  • Returns a HTML safe escaped version of the name of this collection.

func (*FilterCollection) GetNumberOfDomains

func (this *FilterCollection) GetNumberOfDomains() int

*

  • Returns the number of domains on this collection.

type User

type User struct {
	Username    string
	Password    string
	DisplayName string
	IsAdmin     bool      //So we're starting with Admin & User only (I'm sure this will change one day)
	DOB         time.Time //DOB YYYY-MM-DD
}

func (*User) GetDisplayName

func (this *User) GetDisplayName() string

*

  • Returns the display name for this user.
  • If there is a DisplayName present, returns that, otherwise return the Username.

func (*User) IsDefaultUserForDevice

func (this *User) IsDefaultUserForDevice(device Device) bool

*

  • Identifies if this user is the default user for the given device.

func (User) MarshalJSON

func (t User) MarshalJSON() ([]byte, error)

func (*User) NumberOfFilterCollections

func (this *User) NumberOfFilterCollections() (int, error)

*

  • Returns the number of filter collections assigned to this user.

func (*User) SetShortDOB

func (this *User) SetShortDOB(shortFormat string) error

*

  • Sets the DOB field using the given YYYY-MM-DD format.

func (*User) ShortDOB

func (this *User) ShortDOB() string

*

  • Returns the DOB field in YYYY-MM-DD format.

func (*User) UnmarshalJSON

func (t *User) UnmarshalJSON(data []byte) error

func (*User) UserFilterCollections

func (this *User) UserFilterCollections() (UserFilterCollections, error)

*

  • Gets and returns the UserFilterCollections related to this user.

type UserFilterCollections

type UserFilterCollections struct {
	Username    string
	Collections []string //Array Of Collection Names...
}

func (*UserFilterCollections) ContainsCollection

func (t *UserFilterCollections) ContainsCollection(searchCollectionName string) bool

func (*UserFilterCollections) NumberOfCollections

func (this *UserFilterCollections) NumberOfCollections() int

*

  • Returns the number of collections.

Jump to

Keyboard shortcuts

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