model

package
v0.0.0-...-fca866f Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubscriptionTypeVmess  = "vmess"
	SubscriptionTypeTrojan = "trojan"
)

Variables

This section is empty.

Functions

func GetAllModels

func GetAllModels() []interface{}

Types

type FlexString

type FlexString string

A FlexString is an string that can be unmarshalled from a JSON field that has either a number or a string value. E.g. if the json field contains an string "42", the FlexString value will be "42".

func (*FlexString) UnmarshalJSON

func (fi *FlexString) UnmarshalJSON(b []byte) error

type GenericStatus

type GenericStatus struct {
	Code    int         `json:"code"`
	Message string      `json:"message,omitempty" `
	Data    interface{} `json:"data,omitempty"`
}

func NewGenericData

func NewGenericData(code int, data interface{}) *GenericStatus

func NewGenericStatus

func NewGenericStatus(code int, message string) *GenericStatus

type Modeler

type Modeler interface {
	GetCacheKey() string
	GetCacheDuration() time.Duration
	encoding.BinaryMarshaler
	encoding.BinaryUnmarshaler
}

type PacContent

type PacContent struct {
	gorm.Model
	Content string
}

func NewPacContent

func NewPacContent(content string) *PacContent

func (*PacContent) GetCacheDuration

func (c *PacContent) GetCacheDuration() time.Duration

func (*PacContent) GetCacheKey

func (c *PacContent) GetCacheKey() string

func (*PacContent) MarshalBinary

func (c *PacContent) MarshalBinary() ([]byte, error)

func (*PacContent) TableName

func (c *PacContent) TableName() string

func (*PacContent) UnmarshalBinary

func (c *PacContent) UnmarshalBinary(data []byte) error

type PacHandlerConfig

type PacHandlerConfig struct {
	PacGenerateCron string `validate:"required" form:"cron" json:"cron"`
	PacGenerateCmd  string `validate:"required" form:"cmd" json:"cmd"`
}

type PacWebSite

type PacWebSite struct {
	gorm.Model
	WebSiteUrl string `validate:"required"`
}

func NewPacWebSite

func NewPacWebSite(s string) *PacWebSite

func NewPacWebSiteForDelete

func NewPacWebSiteForDelete(id int64) *PacWebSite

func (*PacWebSite) GetCacheDuration

func (p *PacWebSite) GetCacheDuration() time.Duration

func (*PacWebSite) GetCacheKey

func (p *PacWebSite) GetCacheKey() string

func (*PacWebSite) MarshalBinary

func (p *PacWebSite) MarshalBinary() ([]byte, error)

func (*PacWebSite) Render

func (p *PacWebSite) Render() *PacWebSiteToRender

func (*PacWebSite) TableName

func (p *PacWebSite) TableName() string

func (*PacWebSite) UnmarshalBinary

func (p *PacWebSite) UnmarshalBinary(data []byte) error

type PacWebSiteToRender

type PacWebSiteToRender struct {
	Id         uint   `json:"id"`
	WebSiteUrl string `validate:"required" json:"url"`
}

func RenderPacWebSites

func RenderPacWebSites(before []*PacWebSite) []*PacWebSiteToRender

type Subscription

type Subscription struct {
	Id   int64  `json:"id"`
	Name string `json:"subscription_name"`
	Addr string `json:"subscription_addr"`
}

func NewSubscription

func NewSubscription(name, addr string) *Subscription

func (*Subscription) GetCacheDuration

func (s *Subscription) GetCacheDuration() time.Duration

func (*Subscription) GetCacheKey

func (s *Subscription) GetCacheKey() string

func (*Subscription) MarshalBinary

func (s *Subscription) MarshalBinary() ([]byte, error)

func (*Subscription) TableName

func (s *Subscription) TableName() string

func (*Subscription) UnmarshalBinary

func (s *Subscription) UnmarshalBinary(data []byte) error

type Traffic

type Traffic struct {
	Tag     string `json:"tag"`
	Traffic int64  `json:"traffic"`
}

type V2rayCoreStatus

type V2rayCoreStatus struct {
	StartTime string `json:"start_time"`
}

type V2rayNode

type V2rayNode struct {
	Id               int64  `json:"primary_key"`
	SubscriptionId   int64  `json:"subscription_id"`
	SubscriptionName string `json:"subscription_name"`
	SubscriptionType string `json:"subscription_type"`

	//props for v2ray start
	Host     string     `json:"host"`
	Path     string     `json:"path"`
	TLS      string     `json:"tls"`
	Address  string     `json:"add"`
	Port     FlexString `json:"port"`
	Aid      FlexString `json:"aid"`
	Net      string     `json:"net"`
	Type     string     `json:"type"`
	V        string     `json:"v"`
	Name     string     `json:"ps"`
	ServerId string     `json:"id"`
	PingRTT  int64      `json:"ping_rtt"`

	//props for trojan start
	Password string `json:"password"`
	Sni      string `json:"sni"`
}

func NewV2rayNode

func NewV2rayNode(subscriptionId int64, subscriptionName, subscriptionType string) *V2rayNode

func (*V2rayNode) DeepCopy

func (s *V2rayNode) DeepCopy() *V2rayNode

func (*V2rayNode) GetCacheDuration

func (s *V2rayNode) GetCacheDuration() time.Duration

func (*V2rayNode) GetCacheKey

func (s *V2rayNode) GetCacheKey() string

func (*V2rayNode) MarshalBinary

func (s *V2rayNode) MarshalBinary() ([]byte, error)

func (*V2rayNode) TableName

func (s *V2rayNode) TableName() string

func (*V2rayNode) UnmarshalBinary

func (s *V2rayNode) UnmarshalBinary(data []byte) error

type V2rayStatus

type V2rayStatus struct {
	CurrentNode     *V2rayNode       `json:"current_node"`
	Core            *V2rayCoreStatus `json:"v2ray_core"`
	RefreshTime     string           `json:"refresh_time"`
	InboundTraffic  []Traffic        `json:"inbound_traffic"`
	OutboundTraffic []Traffic        `json:"outbound_traffic"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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