model

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SourceTypeHistory    string = "history"
	SourceTypeEdgeTunnel string = "edtunnel"
	SourceTypeManually   string = "manual"
)
View Source
const (
	WireGuardTypeIP     string = "ip"
	WireGuardTypeDomain string = "domain"
)

Variables

View Source
var (
	DBEngine *gorm.DB
)

Functions

func NewDBEngine

func NewDBEngine(cnf *conf.NeoConf) (db *gorm.DB, err error)

Types

type Country

type Country struct {
	*Model
	NameCN   string `json:"name_cn" gorm:"uniqueIndex"`
	ISOTwo   string `json:"iso_two"`
	ISOThree string `json:"iso_three"`
	FullEng  string `json:"full_eng"`
}

func NewCountryItem

func NewCountryItem() (c *Country)

func (*Country) Count

func (that *Country) Count(db *gorm.DB) (count int64, err error)

func (*Country) Create

func (that *Country) Create(db *gorm.DB) (*Country, error)

func (*Country) CreateOrUpdateCountryItem

func (that *Country) CreateOrUpdateCountryItem(db *gorm.DB) (err error)

func (*Country) DeleteAll

func (that *Country) DeleteAll(db *gorm.DB) (err error)

func (*Country) GetByNameCN

func (that *Country) GetByNameCN(db *gorm.DB) (*Country, error)

func (*Country) TableName

func (that *Country) TableName() string

func (*Country) Update

func (that *Country) Update(db *gorm.DB, values any) error

type Location

type Location struct {
	*Model
	IP      string `json:"ip" gorm:"uniqueIndex"`
	Country string `json:"country"`
}

func NewLocation

func NewLocation() (l *Location)

func (*Location) Create

func (that *Location) Create(db *gorm.DB) (*Location, error)

func (*Location) DeleteAll

func (that *Location) DeleteAll(db *gorm.DB) (err error)

func (*Location) GetByIP

func (that *Location) GetByIP(db *gorm.DB) (*Location, error)

func (*Location) TableName

func (that *Location) TableName() string

type Model

type Model struct {
	ID         uint32 `gorm:"primary_key" json:"id"`
	CreatedOn  uint32 `json:"created_on"`
	ModifiedOn uint32 `json:"modified_on"`
}

type Proxy

type Proxy struct {
	*Model
	Scheme       string              `json:"scheme"`
	Address      string              `json:"address" gorm:"uniqueIndex:idx_addr_port"`
	Port         int                 `json:"port" gorm:"uniqueIndex:idx_addr_port"`
	RTT          int64               `json:"rtt"`
	RawUri       string              `json:"raw_uri"`
	Location     string              `json:"location"`
	Outbound     string              `json:"outbound"`
	OutboundType outbound.ClientType `json:"outbound_type"`
	SourceType   string              `json:"source_type"`
}

func NewProxy

func NewProxy() (p *Proxy)

func (*Proxy) CountBySchemeOrSourceType

func (that *Proxy) CountBySchemeOrSourceType(db *gorm.DB) (count int64, err error)

func (*Proxy) Create

func (that *Proxy) Create(db *gorm.DB) (*Proxy, error)

func (*Proxy) Delete

func (that *Proxy) Delete(db *gorm.DB) (err error)

func (*Proxy) DeleteAll

func (that *Proxy) DeleteAll(db *gorm.DB) (err error)

func (*Proxy) Get

func (that *Proxy) Get(db *gorm.DB) (*Proxy, error)

func (*Proxy) GetItemListBySourceType

func (that *Proxy) GetItemListBySourceType(db *gorm.DB) (pList []*outbound.ProxyItem, err error)

func (*Proxy) TableName

func (that *Proxy) TableName() string

func (*Proxy) Update

func (that *Proxy) Update(db *gorm.DB, values any) error

type WireGuard

type WireGuard struct {
	*Model
	Address    string  `json:"address"`
	Port       int     `json:"port"`
	RTT        int64   `json:"rtt"`
	PacketLoss float32 `json:"packet_loss"`
	Type       string  `json:"type"`
}

func NewWireGuardItem

func NewWireGuardItem() (w *WireGuard)

func (*WireGuard) Create

func (that *WireGuard) Create(db *gorm.DB) (*WireGuard, error)

func (*WireGuard) DeleteAll

func (that *WireGuard) DeleteAll(db *gorm.DB) (err error)

func (*WireGuard) DeleteByType

func (that *WireGuard) DeleteByType(db *gorm.DB) (err error)

func (*WireGuard) GetByHost

func (that *WireGuard) GetByHost(db *gorm.DB) (*WireGuard, error)

func (*WireGuard) GetIPListByPort

func (that *WireGuard) GetIPListByPort(db *gorm.DB) (wList []*WireGuard, err error)

func (*WireGuard) GetIPListByType

func (that *WireGuard) GetIPListByType(db *gorm.DB) (wList []*WireGuard, err error)

func (*WireGuard) TableName

func (that *WireGuard) TableName() string

Jump to

Keyboard shortcuts

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