Documentation
¶
Index ¶
- type Config
- type Database
- type PostgresDB
- func (pdb PostgresDB) AddCandumpFrame(packet string, context int) error
- func (pdb PostgresDB) AddContext(capturer string, captureName string, details string, target string) (int, error)
- func (pdb PostgresDB) AddProcessedFrame(frame canlib.ProcessedCanFrame, context int) error
- func (pdb PostgresDB) AddRawFrame(frame canlib.RawCanFrame, context int) error
- func (pdb *PostgresDB) Close() error
- func (pdb PostgresDB) Ping() (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config contains the configuration to be used by canalyze
func (*Config) LoadConfig ¶
LoadConfig loads the configuration file based upon the file path provided
If the file does not exist or is not accessible, LoadConfig will return an error
type Database ¶
type Database interface { Close() error // Close the connection to the database Ping() (bool, error) // Check that the database is still there AddContext(capturer string, captureName string, details string, target string) (int, error) // Create context entry AddCandumpFrame(packet string, context int) error // Add unparsed data from SocketCan/Candump to the database AddRawFrame(frame canlib.RawCanFrame, context int) error // Add raw frames to the database that have not been processed AddProcessedFrame(frame canlib.ProcessedCanFrame, context int) error // Add processed frames to the database }
Database is an interface that defines a type that can interact with the various databases this framework supports
type PostgresDB ¶
PostgresDB will manage transactions with a PostgreSQL database
func CreatePostgres ¶
func CreatePostgres(conf Config) (*PostgresDB, error)
CreatePostgres will connect to the Postgres DB and update the pdb struct to contain that connection
func (PostgresDB) AddCandumpFrame ¶
func (pdb PostgresDB) AddCandumpFrame(packet string, context int) error
AddCandumpFrame will add a can frame captured by Socketcan/candump to the database
func (PostgresDB) AddContext ¶
func (pdb PostgresDB) AddContext(capturer string, captureName string, details string, target string) (int, error)
AddContext will add a context row to the database and return the ID of that context
func (PostgresDB) AddProcessedFrame ¶
func (pdb PostgresDB) AddProcessedFrame(frame canlib.ProcessedCanFrame, context int) error
AddProcessedFrame will add a processed can frame into the database
func (PostgresDB) AddRawFrame ¶
func (pdb PostgresDB) AddRawFrame(frame canlib.RawCanFrame, context int) error
AddRawFrame will add a raw frame to the database
func (*PostgresDB) Close ¶
func (pdb *PostgresDB) Close() error
Close will close the database connection
func (PostgresDB) Ping ¶
func (pdb PostgresDB) Ping() (bool, error)
Ping will try to ping the database