models

package
v0.0.0-...-bc6238b Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID       int    `json:"id" structs:"id"`
	Username string `json:"username" structs:"username" binding:"required,excludesall= "`
	Password string `json:"password" structs:"password" db:"-" binding:"required"`
	// Watch out: un/marshalling booleans is a pain, see https://github.com/gin-gonic/gin/issues/814
	Admin       bool      `json:"admin" structs:"admin"`
	DisplayName string    `json:"display_name" structs:"display_name"`
	UnitGroups  []int     `json:"unit_groups" structs:"unit_groups"`
	Created     time.Time `json:"created" structs:"created_at"`
	Updated     time.Time `json:"updated" structs:"updated_at"`
	TwoFA       bool      `json:"two_fa" structs:"two_fa"`
}

type AccountUpdate

type AccountUpdate struct {
	Password    string `json:"password" structs:"password"`
	DisplayName string `json:"display_name" structs:"display_name"`
	Admin       bool   `json:"admin" structs:"admin"`
	UnitGroups  []int  `json:"unit_groups" structs:"unit_groups" binding:"required"`
}

type AddRequest

type AddRequest struct {
	UnitId string `json:"unit_id" binding:"required"`
}

type CheckSystemUpdate

type CheckSystemUpdate struct {
	LastVersion    string `json:"lastVersion"`
	ScheduledAt    int    `json:"scheduledAt"`
	CurrentVersion string `json:"currentVersion"`
}

type DpiStat

type DpiStat struct {
	Timestamp     int64  `json:"timestamp" binding:"required"`
	ClientAddress string `json:"client_address" binding:"required"`
	ClientName    string `json:"client_name" binding:"required"`
	Protocol      string `json:"protocol"`
	Host          string `json:"host"`
	Application   string `json:"application"`
	Bytes         int64  `json:"bytes" binding:"required"`
}

type DpiStats

type DpiStats []DpiStat

type DpiStatsRequest

type DpiStatsRequest struct {
	Data DpiStats `json:"data" binding:"required"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" binding:"required"`
	Password string `json:"password" binding:"required"`
}

type LoginResponse

type LoginResponse struct {
	Code   int    `json:"code" binding:"required"`
	Expire string `json:"expire" binding:"required"`
	Token  string `json:"token" binding:"required"`
}

type MwanEvent

type MwanEvent struct {
	Timestamp int64  `json:"timestamp" binding:"required"`
	Wan       string `json:"wan" binding:"required"`
	Interface string `json:"interface" binding:"required"`
	Event     string `json:"event" binding:"required"`
}

type MwanEventRequest

type MwanEventRequest struct {
	Data MwanEvents `json:"data" binding:"required"`
}

type MwanEvents

type MwanEvents []MwanEvent

type OTPJson

type OTPJson struct {
	Username string `json:"username" structs:"username"`
	Token    string `json:"token" structs:"token"`
	OTP      string `json:"otp" structs:"otp"`
}

type OpenVPNConfiguration

type OpenVPNConfiguration struct {
	Instance string `json:"instance" binding:"required"`
	Name     string `json:"name" binding:"required"`
	Device   string `json:"device" binding:"required"`
	Type     string `json:"type"` // valid values are: rw (for roadwarrior), client (for tunnel client), server (for tunnel server)
}

type OpenVPNConfigurations

type OpenVPNConfigurations []OpenVPNConfiguration

type OvpnRwConnection

type OvpnRwConnection struct {
	Timestamp     int64  `json:"timestamp" binding:"required"`
	Instance      string `json:"instance" binding:"required"`
	CommonName    string `json:"common_name" binding:"required"`
	VirtualIpAddr string `json:"virtual_ip_addr" binding:"required"`
	RemoteIpAddr  string `json:"remote_ip_addr" binding:"required"`
	StartTime     int64  `json:"start_time" binding:"required"`
	Duration      int64  `json:"duration" binding:"required"`
	BytesReceived int64  `json:"bytes_received" binding:"required"`
	BytesSent     int64  `json:"bytes_sent" binding:"required"`
}

type OvpnRwConnections

type OvpnRwConnections []OvpnRwConnection

type OvpnRwConnectionsRequest

type OvpnRwConnectionsRequest struct {
	Data OvpnRwConnections `json:"data" binding:"required"`
}

type PasswordChange

type PasswordChange struct {
	OldPassword string `json:"old_password" binding:"required"`
	NewPassword string `json:"new_password" binding:"required"`
}

type PlatformInfo

type PlatformInfo struct {
	VpnPort              string `json:"vpn_port" structs:"vpn_port"`
	VpnNetwork           string `json:"vpn_network" structs:"vpn_network"`
	ControllerVersion    string `json:"controller_version" structs:"controller_version"`
	MetricsRetentionDays int    `json:"metrics_retention_days" structs:"metrics_retention_days"`
	LogsRetentionDays    int    `json:"logs_retention_days" structs:"logs_retention_days"`
}

type RegisterRequest

type RegisterRequest struct {
	UnitId           string `json:"unit_id" binding:"required"`
	Username         string `json:"username" binding:"required"`
	Password         string `json:"password" binding:"required"`
	UnitName         string `json:"unit_name" binding:"required"`
	Version          string `json:"version"`
	SubscriptionType string `json:"subscription_type"`
	SystemId         string `json:"system_id"`
}

type SSHGenerate

type SSHGenerate struct {
	Passphrase string `json:"passphrase" binding:"required"`
}

type TsAttack

type TsAttack struct {
	Timestamp int64  `json:"timestamp" binding:"required"`
	Ip        string `json:"ip" binding:"required"`
}

type TsAttackRequest

type TsAttackRequest struct {
	Data TsAttacks `json:"data" binding:"required"`
}

type TsAttacks

type TsAttacks []TsAttack

type TsMalware

type TsMalware struct {
	Timestamp int64  `json:"timestamp" binding:"required"`
	Src       string `json:"src" binding:"required"`
	Dst       string `json:"dst" binding:"required"`
	Category  string `json:"category" binding:"required"`
	Chain     string `json:"chain" binding:"required"`
}

type TsMalwareRequest

type TsMalwareRequest struct {
	Data TsMalwares `json:"data" binding:"required"`
}

type TsMalwares

type TsMalwares []TsMalware

type UbusCommand

type UbusCommand struct {
	Path    string                 `json:"path" binding:"required"`
	Method  string                 `json:"method" binding:"required"`
	Payload map[string]interface{} `json:"payload" binding:"required"`
}

type UbusResponse

type UbusResponse[T any] struct {
	Code    int    `json:"code"`
	Data    T      `json:"data"`
	Message string `json:"message"`
}

Response example: {"code":200,"data":{"depends": "on the call"},"message":"ubus call action success"}

type Unit

type Unit struct {
	ID               string    `json:"unit_id" structs:"id"`
	Name             string    `json:"unit_name" structs:"name"`
	Version          string    `json:"version" structs:"version"`
	SubscriptionType string    `json:"subscription_type" structs:"subscription_type"`
	SystemID         string    `json:"system_id" structs:"system_id"`
	Created          time.Time `json:"created" structs:"created"`
}

type UnitGroup

type UnitGroup struct {
	ID          int       `json:"id" structs:"id"`
	Name        string    `json:"name" structs:"name"`
	Description string    `json:"description" structs:"description"`
	Units       []string  `json:"units" structs:"units"`
	CreatedAt   time.Time `json:"created_at" structs:"created_at"`
	UpdatedAt   time.Time `json:"updated_at" structs:"updated_at"`
	UsedBy      []string  `json:"used_by" structs:"used_by"`
}

type UnitInfo

type UnitInfo struct {
	UnitName         string `json:"unit_name"`
	Version          string `json:"version"`
	VersionUpdate    string `json:"version_update"`
	ScheduledUpdate  int    `json:"scheduled_update"`
	SubscriptionType string `json:"subscription_type"`
	SystemID         string `json:"system_id"`
	SSHPort          int    `json:"ssh_port"`
	FQDN             string `json:"fqdn"`
	APIVersion       string `json:"api_version"`
	Description      string `json:"description"`
}

type UnitNameRequest

type UnitNameRequest struct {
	Name string `json:"name" binding:"required"`
}

type UnitOpenVPNRWRequest

type UnitOpenVPNRWRequest struct {
	Data OpenVPNConfigurations `json:"data" binding:"required"`
}

type UnitWanRequest

type UnitWanRequest struct {
	Data Wans `json:"data" binding:"required"`
}

type Wan

type Wan struct {
	Interface string `json:"interface" binding:"required"`
	Device    string `json:"device" binding:"required"`
	Status    string `json:"status" binding:"required"`
}

type Wans

type Wans []Wan

Jump to

Keyboard shortcuts

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