Documentation ¶
Index ¶
- func IsClientRegistered(db *sqlx.DB, clientID string) (bool, error)
- func ListClientsHandler(c *gin.Context)
- func Register(db *sqlx.DB, req ClientData) (string, error)
- func RegisterHandler(c *gin.Context)
- func Update(db *sqlx.DB, clientID string, req ClientData) error
- func UpdateHandler(c *gin.Context)
- type ActiveClient
- type ClientData
- type ClientsQuery
- type CountryCount
- type Dict
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsClientRegistered ¶
IsClientRegistered checks is a client is registered
func ListClientsHandler ¶
ListClientsHandler is the admin handler for listing registered clients
func RegisterHandler ¶
RegisterHandler this is the public endpoint handler for registering new clients
func Update ¶
func Update(db *sqlx.DB, clientID string, req ClientData) error
Update the metadata for a client
func UpdateHandler ¶
UpdateHandler device endpoint for registered probes to update their metadata
Types ¶
type ActiveClient ¶
type ActiveClient struct { ClientID string `json:"client_id"` ProbeCC string `json:"probe_cc"` ProbeASN string `json:"probe_asn"` Platform string `json:"platform"` SoftwareName string `json:"software_name"` SoftwareVersion string `json:"software_version"` SupportedTests string `json:"supported_tests"` NetworkType string `json:"network_type"` AvailableBandwidth string `json:"available_bandwidth"` Language string `json:"language"` Token string `json:"token"` ProbeFamily string `json:"probe_family"` ProbeID string `json:"probe_id"` LastUpdated time.Time `json:"last_updated"` CreationTime time.Time `json:"creation_time"` }
ActiveClient metadata about an active client
func ListClients ¶
func ListClients(db *sqlx.DB, q ClientsQuery) ([]ActiveClient, error)
ListClients lists all the clients in the database
type ClientData ¶
type ClientData struct { ProbeCC string `json:"probe_cc" binding:"required"` ProbeASN string `json:"probe_asn" binding:"required"` Platform string `json:"platform" binding:"required"` SoftwareName string `json:"software_name" binding:"required"` SoftwareVersion string `json:"software_version" binding:"required"` SupportedTests []string `json:"supported_tests" binding:"required"` NetworkType string `json:"network_type"` AvailableBandwidth string `json:"available_bandwidth"` Language string `json:"language"` Token string `json:"token"` ProbeFamily string `json:"probe_family"` ProbeID string `json:"probe_id"` Password string `json:"password"` }
ClientData metadata about a client
type ClientsQuery ¶
type ClientsQuery struct { Limit int64 `form:"limit" binding:"max=1000"` Offset int64 `form:"offset"` CountryCode string `form:"country_code"` }
ClientsQuery this is the query for the clients to be retrieved from the DB
func (ClientsQuery) MakeMetadata ¶
func (q ClientsQuery) MakeMetadata(db *sqlx.DB) (Dict, error)
MakeMetadata generates the metadata for the request
type CountryCount ¶
CountryCount is the count of active probes for the given country
Click to show internal directories.
Click to hide internal directories.