Documentation ¶
Index ¶
- Variables
- func AlertErrorf(source string, text string, args ...interface{})
- func AlertInfof(source string, text string, args ...interface{})
- func AlertWarnf(source string, text string, args ...interface{})
- func AuthUser(name string, pwd string, db *DB) bool
- func CheckForQuit() bool
- func CheckSlaveAuth(db *DB, user string, secret string) (bool, uuid.UUID)
- func CleanAndCheckFileNameAndPath(path string) (string, error)
- func ConfigPoller(masterHost string, masterPort string, slave Slave, ppCfg **SlaveConfig)
- func DebugPrintAllArguments(args ...string)
- func DeleteSlave(db *DB, slaveID uuid.UUID) error
- func DeleteTarget(db *DB, targetID uuid.UUID) error
- func DeleteUser(db *DB, userID uuid.UUID) error
- func GetToken(claims AuthClaims) (token []byte, err error)
- func GetUptime() time.Duration
- func ListenForOSSignals()
- func PrintUsageAndExit(fSet flag.FlagSet, exitWithError bool)
- func QuitGracefully()
- func SetLogOptions(logger *logrus.Logger, logPathAndName string, logLevel string)
- func TokenFromAuthHeader(header string) (token string)
- func ValidateTraceResult(res TraceResult) (bool, error)
- func VerifyToken(token []byte) (err error)
- func WaitForOSSignalAndQuit()
- func WaitForValidConfig(name string, ppCfg **SlaveConfig)
- type AppAlert
- type AuthClaims
- type DB
- func (db *DB) Begin() (*Tx, error)
- func (db *DB) Close() error
- func (db *DB) Exec(query string, args ...interface{}) (sql.Result, error)
- func (db *DB) Ping() error
- func (db *DB) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (db *DB) QueryRow(query string, args ...interface{}) *sql.Row
- type Slave
- type SlaveConfig
- type Stmt
- type SubmitResult
- type TraceResult
- type TraceTarget
- type Tx
- func (tx *Tx) Commit() error
- func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error)
- func (tx *Tx) Prepare(query string) (*Stmt, error)
- func (tx *Tx) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (tx *Tx) QueryRow(query string, args ...interface{}) *sql.Row
- func (tx *Tx) Rollback() error
- type User
Constants ¶
This section is empty.
Variables ¶
var ConfigPollerProcRunning = make(chan bool, 1)
ConfigPollerProcRunning mutex for graceful shutdown
var OSSigReceived = make(chan bool, 1)
OSSigReceived mutex to show OS signal was received
Functions ¶
func AlertErrorf ¶
AlertErrorf creates a new alert on web GUI of 'error' severity
func AlertInfof ¶
AlertInfof creates a new alert on web GUI of 'info' severity
func AlertWarnf ¶
AlertWarnf creates a new alert on web GUI of 'warn' severity
func CheckSlaveAuth ¶
CheckSlaveAuth checks supplied credentials for validity
func CleanAndCheckFileNameAndPath ¶
CleanAndCheckFileNameAndPath validates a path and filename
func ConfigPoller ¶
func ConfigPoller(masterHost string, masterPort string, slave Slave, ppCfg **SlaveConfig)
ConfigPoller runs as process, periodically polls slave configuration on master
func DebugPrintAllArguments ¶
func DebugPrintAllArguments(args ...string)
DebugPrintAllArguments prints all supplied arguments with their valie
func DeleteSlave ¶
DeleteSlave deletes an existing slave from the db
func DeleteTarget ¶
DeleteTarget deletes an existing target from the db
func DeleteUser ¶
DeleteUser deletes an existing user from the db
func GetToken ¶
func GetToken(claims AuthClaims) (token []byte, err error)
GetToken generates a new token with given claims
func ListenForOSSignals ¶
func ListenForOSSignals()
ListenForOSSignals registers for OS signals and waits for them
func PrintUsageAndExit ¶
PrintUsageAndExit prints usage instructions for cmdline arguments
func SetLogOptions ¶
SetLogOptions sets the logging detail level
func TokenFromAuthHeader ¶
TokenFromAuthHeader extracts the JWT token from the Authorization header
func ValidateTraceResult ¶
func ValidateTraceResult(res TraceResult) (bool, error)
ValidateTraceResult validates contents of a TraceResult
func WaitForOSSignalAndQuit ¶
func WaitForOSSignalAndQuit()
WaitForOSSignalAndQuit blocks until a signal from OS is received, then sends exit signal
func WaitForValidConfig ¶
func WaitForValidConfig(name string, ppCfg **SlaveConfig)
WaitForValidConfig blocks until ppCfg holds a valid config
Types ¶
type AuthClaims ¶
type AuthClaims struct { Payload jwt.Payload Username string }
AuthClaims holds the signed auth info
type DB ¶
DB wraps sql.DB
func InitDBConnectionAndUpdate ¶
InitDBConnectionAndUpdate initializes a connection to the database and upgrades the schema if needed
type Slave ¶
type Slave struct { ID uuid.UUID `json:",omitempty" valid:"-"` Name string `valid:"alphanum, required"` Secret string `valid:"alphanum, required"` }
Slave holds all infos about a slave
func CreateSlave ¶
CreateSlave stores a new slave in the db
type SlaveConfig ¶
type SlaveConfig struct { ID uuid.UUID `json:",omitempty" valid:"-"` MasterHost string `json:"-" valid:"-"` MasterPort string `json:"-" valid:"-"` Targets []TraceTarget `valid:"-"` }
SlaveConfig holds the configuration for a dist-traceroute-slave
type SubmitResult ¶
SubmitResult holds information about success or failure of submission of result(s)
type TraceResult ¶
type TraceResult struct { Slave Slave `valid:" required"` ID uuid.UUID `valid:"-"` DateTime time.Time `valid:"-"` Target TraceTarget `valid:" required"` Success bool `valid:"-"` HopCount int `valid:"int, required, range(1|100)"` Hops []tracert.TracerouteHop `valid:"-"` }
TraceResult holds all relevant information of a single traceroute run
type TraceTarget ¶
type TraceTarget struct { ID uuid.UUID `valid:"-"` Name string `valid:"alphanum, required"` Address string `valid:"host, required"` Retries int `valid:"int, required, range(0|10)"` MaxHops int `valid:"int, required, range(1|100)"` TimeoutMs int `valid:"int, required, range(1|10000)"` }
TraceTarget contains information about a single dist-traceroute target
func CreateTarget ¶
func CreateTarget(db *DB, target TraceTarget) (TraceTarget, error)
CreateTarget stores a new target in the db
func GetTarget ¶
func GetTarget(targetID uuid.UUID, db *DB) (TraceTarget, error)
GetTarget returns the specified target from DB
func GetTargets ¶
func GetTargets(db *DB) ([]TraceTarget, error)
GetTargets reads all targets from the db
func UpdateTarget ¶
func UpdateTarget(db *DB, target TraceTarget) (TraceTarget, error)
UpdateTarget updates an existing new target in the db
type Tx ¶
Tx wraps sql.Tx
func (*Tx) Query ¶
Query executes a query on the given transaction and returns a reference to the resultset