model

package
v0.0.0-...-9e5c6c4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB() *gorm.DB

Types

type CfIp

type CfIp struct {
	ModelBase
	IP    string `json:"ip" gorm:"type:varchar(15)"`
	Cidr  string `json:"cidr" gorm:"type:varchar(18)"`
	Ports []int  `json:"ports" gorm:"type:json;serializer:json"`
}

type Config

type Config struct {
	PortSocks5 int    `json:"port_socks5"`
	PortHttp   int    `json:"port_http"`
	AuthUser   string `json:"auth_user"`
	AuthPass   string `json:"auth_pass"`
}

func Cfg

func Cfg() *Config

type Meta

type Meta struct {
	ModelBase
	Config Config `json:"config" gorm:"type:json;serializer:json"`
}

type ModelBase

type ModelBase struct {
	ID        uint           `gorm:"primarykey" json:"id"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"  gorm:"index"`
}

type PaginationQ

type PaginationQ struct {
	Ok    bool        `json:"ok"`
	Size  int         `form:"size" json:"size"`
	Page  int         `form:"page" json:"page"`
	Data  interface{} `json:"data" comment:"muster be a pointer of slice gorm.Model"` // save pagination list
	Total int64       `json:"total"`
}

PaginationQ gin handler query binding struct

func (*PaginationQ) SearchAll

func (p *PaginationQ) SearchAll(queryTx *gorm.DB) (data *PaginationQ, err error)

SearchAll optimized pagination method for gorm

type Proxy

type Proxy struct {
	ModelBase
	Name string `json:"name" gorm:"varchar(255)"`

	Protocol string `json:"protocol" gorm:"varchar(16)"` //ws,wss,http2,tls,http3
	Host     string `json:"host" gorm:"varchar(255)"`
	Uri      string `json:"uri" gorm:"varchar(255)"`
	Sni      string `json:"sni" gorm:"varchar(255)"`
	Version  string `json:"version" gorm:"varchar(16)"` // one socks5

	UserID    string `json:"user_id"`
	Password  string `json:"password"`
	TrafficKb int64  `json:"traffic_kb" gorm:"default:0"`
	SpeedMs   int64  `json:"speed_ms" gorm:"default:0"`
	Status    string `json:"status" gorm:"varchar(16);default:''"` //active, inactive
}

func (*Proxy) IsActive

func (p *Proxy) IsActive() bool

func (*Proxy) RelayURL

func (p *Proxy) RelayURL() string

Jump to

Keyboard shortcuts

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