model

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package model defines the core domain entities used across LalatinaHub services. It has zero external dependencies and relies solely on the Go standard library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValue

type KeyValue struct {
	ID    int64  `json:"id"`
	Key   string `json:"key"`
	Value any    `json:"value"`
}

KeyValue represents a generic key-value configuration entry.

type ProxyNode

type ProxyNode struct {
	ID          int64  `json:"id"`
	Server      string `json:"server"`
	IP          string `json:"ip"`
	ServerPort  int    `json:"server_port"`
	UUID        string `json:"uuid"`
	Password    string `json:"password"`
	Security    string `json:"security"`
	AlterID     int    `json:"alter_id"`
	Method      string `json:"method"`
	Plugin      string `json:"plugin"`
	PluginOpts  string `json:"plugin_opts"`
	Host        string `json:"host"`
	TLS         bool   `json:"tls"`
	Transport   string `json:"transport"`
	Path        string `json:"path"`
	ServiceName string `json:"service_name"`
	Insecure    bool   `json:"insecure"`
	SNI         string `json:"sni"`
	Remark      string `json:"remark"`
	ConnMode    string `json:"conn_mode"`
	CountryCode string `json:"country_code"`
	Region      string `json:"region"`
	Org         string `json:"org"`
	VPN         string `json:"vpn"`
	Raw         string `json:"raw"`
}

ProxyNode represents a generic relay proxy node from external database or parsed protocol URL. It contains all configuration properties required to reconstruct or convert the node to various protocols (such as Shadowsocks, VMess, VLESS, and Trojan).

type Server

type Server struct {
	ID         int64  `json:"id"`
	Code       string `json:"code"`
	Domain     string `json:"domain"`
	IP         string `json:"ip"`
	Country    string `json:"country"`
	UsersCount int64  `json:"users_count"`
	UsersMax   int64  `json:"users_max"`
}

Server represents a VPN edge server in the cluster.

func (*Server) IsFull

func (s *Server) IsFull() bool

IsFull returns true if current users count reached maximum capacity.

type User

type User struct {
	ID         int64     `json:"id"`
	Token      string    `json:"token"`
	Password   string    `json:"password"`
	Expired    time.Time `json:"expired"`
	ServerCode string    `json:"server_code"`
	Quota      int64     `json:"quota"` // Quota in bytes
	Relay      string    `json:"relay"`
	Adblock    bool      `json:"adblock"`
	VPN        string    `json:"vpn"`
}

User represents a VPN user entity.

func (*User) IsActive

func (u *User) IsActive(now time.Time) bool

IsActive returns true if the user has remaining quota, has not expired, and has assigned ServerCode and VPN protocol.

Jump to

Keyboard shortcuts

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