Documentation
¶
Index ¶
- type AddSiteMember
- type Agent
- type AgentStats
- type AgentStatsList
- type CreateAgent
- type IcmpData
- type LoginUser
- type Mtr
- type MtrData
- type MtrResult
- type NetworkData
- type RealMtrData
- type RegisterUser
- type Site
- type SiteMember
- type SpeedTestData
- type Stats
- type User
- func (u *User) AddSite(site primitive.ObjectID, db *mongo.Database) (bool, error)
- func (u *User) Create(db *mongo.Database) (bool, error)
- func (u *User) GetUserFromEmail(db *mongo.Database) (*User, error)
- func (u *User) GetUserFromID(db *mongo.Database) (*User, error)
- func (u *User) UserExistsEmail(db *mongo.Database) (bool, error)
- func (u *User) UserExistsID(db *mongo.Database) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddSiteMember ¶
type Agent ¶
type Agent struct {
ID primitive.ObjectID `bson:"_id, omitempty"json:"id"`
Name string `bson:"name"json:"name"`
Site primitive.ObjectID `bson:"site"json:"site"` // _id of mongo object
AgentConfig agent_models.AgentConfig `bson:"agent_config"json:"agent_config"`
Pin string `bson:"pin"json:"pin"` // used for registration & authentication
Hash string `bson:"hash"json:"hash"`
Heartbeat time.Time `bson:"heartbeat"json:"heartbeat"`
}
type AgentStats ¶
type AgentStats struct {
ID primitive.ObjectID `json:"id"`
Name string `json:"name"`
Heartbeat time.Time `json:"heartbeat"`
NetworkInfo agent_models.NetworkInfo `json:"network_info"`
LastSeen time.Duration `json:"last_seen"`
Online bool `json:"online"`
}
type AgentStatsList ¶
type AgentStatsList struct {
List []AgentStats `json:"list"`
}
type CreateAgent ¶
type IcmpData ¶
type IcmpData struct {
ID primitive.ObjectID `bson:"_id, omitempty"json:"id"`
Agent primitive.ObjectID `bson:"agent"json:"agent"` // _id of mongo object
Data []agent_models.IcmpTarget `bson:"data"json:"data"`
Timestamp time.Time `bson:"timestamp"json:"timestamp"`
}
type NetworkData ¶
type NetworkData struct {
ID primitive.ObjectID `bson:"_id, omitempty"json:"id"`
Agent primitive.ObjectID `bson:"agent"json:"agent"`
Data agent_models.NetworkInfo `bson:"data"json:"data"`
Timestamp time.Time `bson:"timestamp"json:"timestamp"`
}
type RealMtrData ¶
type RegisterUser ¶
type RegisterUser struct {
Email string `bson:"email"form:"email"` // email, will be used as username
FirstName string `bson:"first_name"form:"first_name"`
LastName string `bson:"last_name"form:"last_name"`
Password string `bson:"password"form:"password"` // password in sha256?
PasswordConfirm string `bson:"password_confirm"form:"password_confirm"` // password in sha256?
}
type Site ¶
type Site struct {
ID primitive.ObjectID `bson:"_id, omitempty"json:"id"`
Name string `bson:"name"form:"name"json:"name"`
Members []SiteMember `bson:"members"json:"members"`
CreateTimestamp time.Time `bson:"create_timestamp"json:"create_timestamp"`
}
func (*Site) CreateSite ¶
type SiteMember ¶
type SpeedTestData ¶
type SpeedTestData struct {
ID primitive.ObjectID `bson:"_id, omitempty"json:"id"`
Agent primitive.ObjectID `bson:"agent"json:"agent"`
Data agent_models.SpeedTestInfo `bson:"data"json:"data"`
Timestamp time.Time `bson:"timestamp"json:"timestamp"`
}
type Stats ¶
type Stats struct {
Sent int `json:"sent"bson:"sent"`
TTL int `json:"ttl"bson:"TTL"`
Target string `json:"target"bson:"target"`
LastMs float32 `json:"last_ms"bson:"last_ms"`
BestMs float32 `json:"best_ms"bson:"best_ms"`
WorstMs float32 `json:"worst_ms"bson:"worst_ms"`
AvgMs float32 `json:"avg_ms"bson:"avg_ms"`
LossPercent int `json:"loss_percent"bson:"loss_percent"`
}
type User ¶
type User struct {
ID primitive.ObjectID `bson:"_id, omitempty"json:"id"`
Email string `bson:"email"json:"email"` // email, will be used as username
FirstName string `bson:"first_name"json:"first_name"`
LastName string `bson:"last_name"json:"last_name"`
Admin bool `bson:"admin" default:"false"json:"admin"`
Password string `bson:"password"` // password in sha256?
Sites []primitive.ObjectID `bson:"sites"json:"sites"` // _id's of mongo objects
Verified bool `bson:"verified"json:"sites"` // verified, meaning email confirmation
CreateTimestamp time.Time `bson:"create_timestamp"json:"create_timestamp"`
}
func (*User) UserExistsEmail ¶
UserExistsEmail check based on wether a user with the email in user exists
Click to show internal directories.
Click to hide internal directories.