common

package
v1.6.65 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPV4_DEFAULT_PREFIX  = "0.0.0.0"
	IPV4_DEFAULT_NETMASK = 32
	IPV4_DEFAULT_GATEWAY = "0.0.0.0"
	IPV6_DEFAULT_PREFIX  = "::"
	IPV6_DEFAULT_NETMASK = 128
	IPV6_DEFAULT_GATEWAY = "::"
)
View Source
const (
	VROUTER_STATE_RUNNING = 7
	WAN_IP_ISP            = 7
	PUBLIC_NETWORK_LCUUID = "ffffffff-ffff-ffff-ffff-ffffffffffff"
)

Variables

Functions

func CIDRToPreNetMask

func CIDRToPreNetMask(cidr string) (string, string, error)

func ElementsSame

func ElementsSame[T constraints.Ordered](s1, s2 []T) bool

func FormatIP

func FormatIP(ip string) string

func IntSliceToString

func IntSliceToString(s []int) string

func LogAdd

func LogAdd(resourceType string) string

func LogDelete

func LogDelete(resourceType string) string

func LogUpdate

func LogUpdate(resourceType string) string

func NewDomainPrefix

func NewDomainPrefix(name string) logger.Prefix

func NewSubDomainPrefix

func NewSubDomainPrefix(name string) logger.Prefix

func StringToIntSlice

func StringToIntSlice(str string) []int

Types

type DomainInfo

type DomainInfo struct {
	mysqlmodel.Domain
}

type DomainNameLogPrefix

type DomainNameLogPrefix struct {
	Name string
}

func (*DomainNameLogPrefix) Prefix

func (p *DomainNameLogPrefix) Prefix() string

type Metadata

type Metadata struct {
	ORGID       int       // org id
	DB          *mysql.DB // org database connection
	Domain      *DomainInfo
	SubDomain   *SubDomainInfo
	LogPrefixes []logger.Prefix
}

func NewMetadata

func NewMetadata(orgID int) (*Metadata, error)

func (*Metadata) Copy

func (m *Metadata) Copy() *Metadata

func (*Metadata) GetORGID

func (m *Metadata) GetORGID() int

func (*Metadata) GetTeamID

func (m *Metadata) GetTeamID() int

func (*Metadata) SetDomain

func (m *Metadata) SetDomain(domain mysqlmodel.Domain)

func (*Metadata) SetSubDomain

func (m *Metadata) SetSubDomain(subDomain mysqlmodel.SubDomain)

type ORG

type ORG struct {
	ID        int       // org id
	DB        *mysql.DB // org database connection
	LogPrefix logger.Prefix
}

func NewORG

func NewORG(id int) (*ORG, error)

type SubDomainInfo

type SubDomainInfo struct {
	mysqlmodel.SubDomain
}

type SubDomainNameLogPrefix

type SubDomainNameLogPrefix struct {
	Name string
}

func (*SubDomainNameLogPrefix) Prefix

func (p *SubDomainNameLogPrefix) Prefix() string

Jump to

Keyboard shortcuts

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