server

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RelayModeNone        = "none"
	RelayModeAll         = "all"
	RelayModeRandom      = "random"
	RuleGroupTypeReject  = "reject"
	RuleGroupTypeDefault = "default"
	RuleGroupTypeDirect  = "direct"
)

Variables

View Source
var (
	CacheServerDetailPrefix = "cache:server:detail:"
)

Functions

This section is empty.

Types

type Group

type Group struct {
	Id          int64     `gorm:"primary_key"`
	Name        string    `gorm:"type:varchar(100);not null;default:'';comment:Group Name"`
	Description string    `gorm:"type:varchar(255);default:'';comment:Group Description"`
	CreatedAt   time.Time `gorm:"<-:create;comment:Creation Time"`
	UpdatedAt   time.Time `gorm:"comment:Update Time"`
}

func (Group) TableName

func (Group) TableName() string

type Hysteria2

type Hysteria2 struct {
	Port           int            `json:"port"`
	HopPorts       string         `json:"hop_ports"`
	HopInterval    int            `json:"hop_interval"`
	ObfsPassword   string         `json:"obfs_password"`
	SecurityConfig SecurityConfig `json:"security_config"`
}

type Model

type Model interface {
	// contains filtered or unexported methods
}

func NewModel

func NewModel(conn *gorm.DB, c *redis.Client) Model

NewModel returns a model for the database table.

type NodeRelay

type NodeRelay struct {
	Host   string `json:"host"`
	Port   int    `json:"port"`
	Prefix string `json:"prefix"`
}

type RuleGroup

type RuleGroup struct {
	Id        int64     `gorm:"primary_key"`
	Icon      string    `gorm:"type:MEDIUMTEXT;comment:Rule Group Icon"`
	Name      string    `gorm:"type:varchar(100);not null;default:'';comment:Rule Group Name"`
	Type      string    `gorm:"type:varchar(100);not null;default:'';comment:Rule Group Type"`
	Tags      string    `gorm:"type:text;comment:Selected Node Tags"`
	Rules     string    `gorm:"type:MEDIUMTEXT;comment:Rules"`
	Enable    bool      `gorm:"type:tinyint(1);not null;default:1;comment:Rule Group Enable"`
	Default   bool      `gorm:"type:tinyint(1);not null;default:0;comment:Rule Group is Default"`
	CreatedAt time.Time `gorm:"<-:create;comment:Creation Time"`
	UpdatedAt time.Time `gorm:"comment:Update Time"`
}

func (RuleGroup) TableName

func (RuleGroup) TableName() string

type SecurityConfig

type SecurityConfig struct {
	SNI               string `json:"sni"`
	AllowInsecure     bool   `json:"allow_insecure"`
	Fingerprint       string `json:"fingerprint"`
	RealityServerAddr string `json:"reality_server_addr"`
	RealityServerPort int    `json:"reality_server_port"`
	RealityPrivateKey string `json:"reality_private_key"`
	RealityPublicKey  string `json:"reality_public_key"`
	RealityShortId    string `json:"reality_short_id"`
}

type Server

type Server struct {
	Id             int64     `gorm:"primary_key"`
	Name           string    `gorm:"type:varchar(100);not null;default:'';comment:Node Name"`
	Tags           string    `gorm:"type:varchar(128);not null;default:'';comment:Tags"`
	Country        string    `gorm:"type:varchar(128);not null;default:'';comment:Country"`
	City           string    `gorm:"type:varchar(128);not null;default:'';comment:City"`
	Latitude       string    `gorm:"type:varchar(128);not null;default:'';comment:Latitude"`
	Longitude      string    `gorm:"type:varchar(128);not null;default:'';comment:Longitude"`
	ServerAddr     string    `gorm:"type:varchar(100);not null;default:'';comment:Server Address"`
	RelayMode      string    `gorm:"type:varchar(20);not null;default:'none';comment:Relay Mode"`
	RelayNode      string    `gorm:"type:text;comment:Relay Node"`
	SpeedLimit     int       `gorm:"type:int;not null;default:0;comment:Speed Limit"`
	TrafficRatio   float32   `gorm:"type:DECIMAL(4,2);not null;default:0;comment:Traffic Ratio"`
	GroupId        int64     `gorm:"index:idx_group_id;type:int;default:null;comment:Group ID"`
	Protocol       string    `gorm:"type:varchar(20);not null;default:'';comment:Protocol"`
	Config         string    `gorm:"type:text;comment:Config"`
	Enable         *bool     `gorm:"type:tinyint(1);not null;default:1;comment:Enabled"`
	Sort           int64     `gorm:"type:int;not null;default:0;comment:Sort"`
	LastReportedAt time.Time `gorm:"comment:Last Reported Time"`
	CreatedAt      time.Time `gorm:"<-:create;comment:Creation Time"`
	UpdatedAt      time.Time `gorm:"comment:Update Time"`
}

func (*Server) BeforeCreate

func (s *Server) BeforeCreate(tx *gorm.DB) error

func (*Server) BeforeDelete

func (s *Server) BeforeDelete(tx *gorm.DB) error

func (*Server) BeforeUpdate

func (s *Server) BeforeUpdate(tx *gorm.DB) error

func (*Server) TableName

func (*Server) TableName() string

type ServerFilter

type ServerFilter struct {
	Id     int64
	Tags   []string
	Group  int64
	Search string
	Page   int
	Size   int
}

type Shadowsocks

type Shadowsocks struct {
	Method    string `json:"method"`
	Port      int    `json:"port"`
	ServerKey string `json:"server_key"`
}

type TransportConfig

type TransportConfig struct {
	Path        string `json:"path,omitempty"` // ws/httpupgrade
	Host        string `json:"host,omitempty"`
	ServiceName string `json:"service_name"` // grpc
}

type Trojan

type Trojan struct {
	Port            int             `json:"port"`
	Flow            string          `json:"flow"`
	Transport       string          `json:"transport"`
	TransportConfig TransportConfig `json:"transport_config"`
	Security        string          `json:"security"`
	SecurityConfig  SecurityConfig  `json:"security_config"`
}

type Tuic

type Tuic struct {
	Port           int            `json:"port"`
	SecurityConfig SecurityConfig `json:"security_config"`
}

type Vless

type Vless struct {
	Port            int             `json:"port"`
	Flow            string          `json:"flow"`
	Transport       string          `json:"transport"`
	TransportConfig TransportConfig `json:"transport_config"`
	Security        string          `json:"security"`
	SecurityConfig  SecurityConfig  `json:"security_config"`
}

type Vmess

type Vmess struct {
	Port            int             `json:"port"`
	Flow            string          `json:"flow"`
	Transport       string          `json:"transport"`
	TransportConfig TransportConfig `json:"transport_config"`
	Security        string          `json:"security"`
	SecurityConfig  SecurityConfig  `json:"security_config"`
}

Jump to

Keyboard shortcuts

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