data

package
v0.0.0-...-cc1be1a Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TunOutType = "tun_out"
	TunInType  = "tun_in"
)

Variables

View Source
var ErrServerNotExist = errors.New("server not exist")

Functions

This section is empty.

Types

type Data

type Data struct {
	Func
	// contains filtered or unexported fields
}

func New

func New(path string) (*Data, error)

type Func

type Func struct {
	Rule   RuleFunc
	Server ServerFunc
}

type Rule

type Rule struct {
	Id         int64     `xorm:"pk autoincr" json:"id"`
	Name       string    `xorm:"varchar(255) notnull unique" json:"name"`
	ListenAddr string    `xorm:"varchar(255) notnull" json:"listen_addr"`
	TargetType string    `xorm:"varchar(255)" json:"target_type"`
	TargetAddr []string  `xorm:"json" json:"target_addr"`
	TargetRule int64     `xorm:"index" json:"target_rule"`
	TargetTag  string    `xorm:"varchar(255)" json:"target_tag"`
	Config     string    `json:"config"`
	ServerId   int64     `xorm:"index notnull" json:"server_id"`
	CreatedAt  time.Time `xorm:"created" json:"created_at"`
	UpdatedAt  time.Time `xorm:"updated" json:"updated_at"`
}

type RuleFunc

type RuleFunc struct {
	// contains filtered or unexported fields
}

func (*RuleFunc) Create

func (r *RuleFunc) Create(nd ...*Rule) error

func (*RuleFunc) Delete

func (r *RuleFunc) Delete(nd ...*Rule) error

func (*RuleFunc) Get

func (r *RuleFunc) Get(nd *Rule) error

func (*RuleFunc) IsExist

func (r *RuleFunc) IsExist(nd *Rule) (bool, error)

func (*RuleFunc) List

func (r *RuleFunc) List(serverId int64, targetType string) ([]Rule, error)

func (*RuleFunc) Update

func (r *RuleFunc) Update(nd *Rule) error

type Server

type Server struct {
	Id     int64  `xorm:"pk autoincr" json:"id"`
	Name   string `xorm:"varchar(255) notnull" json:"name"`
	Config string `json:"config"`
}

type ServerFunc

type ServerFunc struct {
	// contains filtered or unexported fields
}

func (*ServerFunc) Create

func (s *ServerFunc) Create(nd *Server) error

func (*ServerFunc) Delete

func (s *ServerFunc) Delete(nd *Server) error

func (*ServerFunc) Get

func (s *ServerFunc) Get(nd *Server) error

func (*ServerFunc) IsExist

func (s *ServerFunc) IsExist(sv *Server) (bool, error)

func (*ServerFunc) List

func (s *ServerFunc) List() ([]Server, error)

func (*ServerFunc) Update

func (s *ServerFunc) Update(nd *Server) error

Jump to

Keyboard shortcuts

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