storage

package
v0.0.0-...-9c42f08 Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogDnsResponse

func LogDnsResponse(db *sql.DB, event DnsEvent) error

func LogFlow

func LogFlow(db *sql.DB, start time.Time, stop time.Time, flow classify.FiveTuple, bytesAB int, bytesBA int)

func QueryToppedUpCustomers

func QueryToppedUpCustomers(db *sql.DB) []net.IP

func UpdateBridgedState

func UpdateBridgedState(db *sql.DB, userIP net.IP, bridged bool) error

Types

type DnsEvent

type DnsEvent struct {
	Timestamp  time.Time
	Flow       classify.FiveTuple
	Query      string
	OpCode     uint16
	ResultCode uint16
	AnswerTTLs string
	AnswerIPs  string
}

type UseEvent

type UseEvent struct {
	UserAddress gopacket.Endpoint
	BytesUp     int64
	BytesDown   int64
}

type UserBridgedState

type UserBridgedState struct {
	Addr    net.IP
	Bridged bool
}

func QueryGlobalBridgedState

func QueryGlobalBridgedState(db *sql.DB) []UserBridgedState

type UserStatus

type UserStatus struct {
	UserAddress        gopacket.Endpoint
	CurrentDataBalance int64
	PriorDataBalance   int64
	CurrencyBalance    decimal.Decimal
}

func LogUsage

func LogUsage(db *sql.DB, event UseEvent) (UserStatus, error)

Jump to

Keyboard shortcuts

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