Documentation ¶
Index ¶
- func IsExist(err error) bool
- func IsNotExist(err error) bool
- type Agent
- type AgentForJSON
- type DB
- func (db *DB) CreateAgent(username, hash, tag string) error
- func (db *DB) CreateTunnel(username, ahash, hash, proto, exportAddr, serverAddr, tag string) error
- func (db *DB) CreateUser(name, password, email string, isAdmin bool) error
- func (db *DB) DeleteAgent(username, hash string) error
- func (db *DB) DeleteAgents(username string) error
- func (db *DB) DeleteTunnel(username, ahash, hash string) error
- func (db *DB) DeleteTunnels(username, ahash string) error
- func (db *DB) DeleteUser(name string) error
- func (db *DB) IsEmpty() (bool, error)
- func (db *DB) QueryAgent(username, hash string) (Agent, error)
- func (db *DB) QueryAgentCount(username string) (n int, err error)
- func (db *DB) QueryAgentHashs(username string) ([]string, error)
- func (db *DB) QueryAgents(username string) ([]Agent, error)
- func (db *DB) QueryTunnel(username, ahash, hash string) (Tunnel, error)
- func (db *DB) QueryTunnelCount(username, ahash string) (n int, err error)
- func (db *DB) QueryTunnels(username, ahash string) ([]Tunnel, error)
- func (db *DB) QueryUser(name string) (User, error)
- func (db *DB) QueryUserCount() (n int, err error)
- func (db *DB) QueryUsers() ([]User, error)
- func (db *DB) UpdateAgent(username, hash string, args map[string]interface{}) (bool, error)
- func (db *DB) UpdateTunnel(username, ahash, hash string, args map[string]interface{}) (bool, error)
- func (db *DB) UpdateUser(name string, args map[string]interface{}) (bool, error)
- type Tunnel
- type TunnelForJSON
- type User
- type UserForJSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotExist ¶
Types ¶
type Agent ¶
type Agent struct { ID int `json:"id" db:"id"` UserID int `json:"user_id" db:"user_id"` Hash string `json:"hash" db:"hash"` Device string `json:"device" db:"device"` // os, kernel, arch Version string `json:"version" db:"version"` Status string `json:"status" db:"status"` Delayed string `json:"delayed" db:"delayed"` Tag string `json:"tag" db:"tag"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` Tunnels []Tunnel `json:"tunnels,omitempty" db:"-"` }
func (Agent) MarshalJSON ¶
type AgentForJSON ¶
type AgentForJSON Agent // Use alias to avoid infinite recursive.
type DB ¶
func (*DB) CreateAgent ¶
func (*DB) CreateTunnel ¶
func (*DB) DeleteAgent ¶
func (*DB) DeleteAgents ¶
func (*DB) DeleteTunnel ¶
func (*DB) DeleteTunnels ¶
func (*DB) DeleteUser ¶
func (*DB) QueryTunnelCount ¶
func (*DB) QueryUserCount ¶
func (*DB) QueryUsers ¶
func (*DB) UpdateAgent ¶
func (*DB) UpdateTunnel ¶
type Tunnel ¶
type Tunnel struct { ID int `json:"id" db:"id"` AgentID int `json:"agent_id" db:"agent_id"` Hash string `json:"hash" db:"hash"` Proto string `json:"proto" db:"proto"` ExportAddr string `json:"export_addr" db:"export_addr"` ServerAddr string `json:"server_addr" db:"server_addr"` Status string `json:"status" db:"status"` NumConn int `json:"num_conn" db:"num_conn"` TrafficIn int64 `json:"traffic_in" db:"traffic_in"` TrafficOut int64 `json:"traffic_out" db:"traffic_out"` CountAt time.Time `json:"count_at" db:"count_at"` Enabled bool `json:"enabled" db:"enabled"` Tag string `json:"tag" db:"tag"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
func (Tunnel) MarshalJSON ¶
type TunnelForJSON ¶
type TunnelForJSON Tunnel // Use alias to avoid infinite recursive.
type User ¶
type User struct { ID int `json:"id" db:"id"` Name string `json:"name" db:"name"` Password string `json:"password" db:"password"` Email string `json:"email" db:"email"` IsAdmin bool `json:"is_admin" db:"is_admin"` CreatedAt time.Time `json:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"` }
func (User) MarshalJSON ¶
type UserForJSON ¶
type UserForJSON User // Use alias to avoid infinite recursive.
Click to show internal directories.
Click to hide internal directories.