models

package
v0.3.9-5 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 29 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MIN_PRIO                = 0
	MAX_PRIO                = 2000
	DEF_PRIO                = 0
	DEF_PRIO_ROUTER_FORWARD = 1000
	DEF_PRIO_MASQUERADE     = 1000

	ACT_SNAT           = "SNAT"
	ACT_DNAT           = "DNAT"
	ACT_MASQUERADE     = "MASQUERADE"
	ACT_TCPMSS         = "TCPMSS" // FORWARD chain for now
	ACT_INPUT_ACCEPT   = "INPUT_ACCEPT"
	ACT_FORWARD_ACCEPT = "FORWARD_ACCEPT"

	PROTO_TCP = "tcp"
	PROTO_UDP = "udp"
)

Variables

This section is empty.

Functions

func InitDB

func InitDB() error

func IsMoreThanOne

func IsMoreThanOne(err error) bool

func IsNotFound

func IsNotFound(err error) bool

Types

type SIface

type SIface struct {
	db.SStandaloneResourceBase

	RouterId  string `length:"32" nullable:"false"`
	NetworkId string `length:"32" nullable:"false"`

	Ifname string `length:"32" nullable:"false"`

	PrivateKey string
	PublicKey  string
	ListenPort int `nullable:"false"`

	IsSystem bool `nullable:"false"`
}

func (*SIface) CustomizeDelete

func (iface *SIface) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SIface) ValidateDeleteCondition

func (iface *SIface) ValidateDeleteCondition(ctx context.Context, info jsonutils.JSONObject) error

func (*SIface) ValidateUpdateCondition

func (iface *SIface) ValidateUpdateCondition(ctx context.Context) error

type SIfaceManager

type SIfaceManager struct {
	db.SStandaloneResourceBaseManager
}
var IfaceManager *SIfaceManager

func (*SIfaceManager) ListItemFilter

func (man *SIfaceManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error)

虚拟路由器接口列表

func (*SIfaceManager) ValidateCreateData

type SIfacePeer

type SIfacePeer struct {
	db.SStandaloneResourceBase

	RouterId string
	IfaceId  string

	PeerIfaceId  string
	PeerRouterId string

	PublicKey           string
	AllowedIPs          string
	Endpoint            string
	PersistentKeepalive int
}

type SIfacePeerManager

type SIfacePeerManager struct {
	db.SStandaloneResourceBaseManager
}
var IfacePeerManager *SIfacePeerManager

type SMeshNetwork

type SMeshNetwork struct {
	db.SStandaloneResourceBase
}

func (*SMeshNetwork) CustomizeDelete

func (mn *SMeshNetwork) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SMeshNetwork) PerformRealize

type SMeshNetworkManager

type SMeshNetworkManager struct {
	db.SStandaloneResourceBaseManager
}
var MeshNetworkManager *SMeshNetworkManager

type SMeshNetworkMember

type SMeshNetworkMember struct {
	db.SStandaloneResourceBase

	MeshNetworkId    string
	RouterId         string
	AdvertiseSubnets string
}

type SMeshNetworkMemberManager

type SMeshNetworkMemberManager struct {
	db.SStandaloneResourceBaseManager
}
var MeshNetworkMemberManager *SMeshNetworkMemberManager

type SRoute

type SRoute struct {
	db.SStandaloneResourceBase

	IfaceId string `length:"32" nullable:"false" list:"user" create:"required"`
	Ifname  string `length:"32" nullable:"false" list:"user" create:"optional"`

	Network string `length:"32" nullable:"false" list:"user" update:"user" create:"required"`
	Gateway string `length:"32" nullable:"false" list:"user" update:"user" create:"optional"`

	RouterId string `length:"32" nullable:"false" list:"user" create:"optional"`
}

func (*SRoute) ValidateUpdateData

func (route *SRoute) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.RouteUpdateInput) (api.RouteUpdateInput, error)

type SRouteManager

type SRouteManager struct {
	db.SStandaloneResourceBaseManager
}
var RouteManager *SRouteManager

func (*SRouteManager) ListItemFilter

func (man *SRouteManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error)

虚拟路由器路由列表

func (*SRouteManager) ValidateCreateData

type SRouter

type SRouter struct {
	db.SStandaloneResourceBase

	User       string `nullable:"false" list:"user" update:"user" create:"optional"`
	Host       string `nullable:"false" list:"user" update:"user" create:"required"`
	Port       int    `nullable:"false" list:"user" update:"user" create:"optional"`
	PrivateKey string `nullable:"true" update:"user" create:"optional"` // do not allow get, list

	RealizeWgIfaces bool `width:"16" charset:"ascii" nullable:"false" list:"user" create:"optional" update:"user"`
	RealizeRoutes   bool `width:"16" charset:"ascii" nullable:"false" list:"user" create:"optional" update:"user"`
	RealizeRules    bool `width:"16" charset:"ascii" nullable:"false" list:"user" create:"optional" update:"user"`
}

Add revision?

func (*SRouter) CustomizeDelete

func (router *SRouter) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error

func (*SRouter) PerformDeploy

func (router *SRouter) PerformDeploy(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SRouter) PerformJoinMeshNetwork

func (router *SRouter) PerformJoinMeshNetwork(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SRouter) PerformLeaveMeshNetwork

func (router *SRouter) PerformLeaveMeshNetwork(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SRouter) PerformRealize

func (router *SRouter) PerformRealize(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SRouter) PerformRegisterIfname

func (router *SRouter) PerformRegisterIfname(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SRouter) PerformUnregisterIfname

func (router *SRouter) PerformUnregisterIfname(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error)

func (*SRouter) PostCreate

func (router *SRouter) PostCreate(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SRouter) PostUpdate

func (router *SRouter) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject)

func (*SRouter) ValidateUpdateData

func (router *SRouter) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.RouterUpdateInput) (api.RouterUpdateInput, error)

type SRouterDeployment

type SRouterDeployment struct {
	db.SStandaloneResourceBase

	RouterId          string
	AnsiblePlaybookId string

	RouterRevision int
}

type SRouterDeploymentManager

type SRouterDeploymentManager struct {
	db.SStandaloneResourceBaseManager
}
var RouterDeploymentManager *SRouterDeploymentManager

type SRouterManager

type SRouterManager struct {
	db.SStandaloneResourceBaseManager
}
var RouterManager *SRouterManager

func (*SRouterManager) ValidateCreateData

type SRule

type SRule struct {
	db.SStandaloneResourceBase

	Prio int `nullable:"false" list:"user" update:"user" create:"optional"`

	MatchSrcNet    string `length:"32" nullable:"false" list:"user" update:"user" create:"optional"`
	MatchDestNet   string `length:"32" nullable:"false" list:"user" update:"user" create:"optional"`
	MatchProto     string `length:"8" nullable:"false" list:"user" update:"user" create:"optional"`
	MatchSrcPort   int    `nullable:"false" list:"user" update:"user" create:"optional"`
	MatchDestPort  int    `nullable:"false" list:"user" update:"user" create:"optional"`
	MatchInIfname  string `length:"32" nullable:"false" list:"user" update:"user" create:"optional"`
	MatchOutIfname string `length:"32" nullable:"false" list:"user" update:"user" create:"optional"`

	Action        string `length:"32" nullable:"false" list:"user" update:"user" create:"required"`
	ActionOptions string `length:"32" nullable:"false" list:"user" update:"user" create:"optional"`

	RouterId string `length:"32" nullable:"false" list:"user" create:"optional"`

	IsSystem bool `nullable:"false" list:"user" create:"optional"`
}

func (*SRule) ValidateUpdateData

func (rule *SRule) ValidateUpdateData(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.RuleUpdateInput) (api.RuleUpdateInput, error)

type SRuleManager

type SRuleManager struct {
	db.SStandaloneResourceBaseManager
}
var RuleManager *SRuleManager

func (*SRuleManager) ListItemFilter

func (man *SRuleManager) ListItemFilter(ctx context.Context, q *sqlchemy.SQuery, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (*sqlchemy.SQuery, error)

虚拟路由器路由规则列表

func (*SRuleManager) ValidateCreateData

func (man *SRuleManager) ValidateCreateData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

type Subnets

type Subnets []*netutils.IPV4Prefix

func (Subnets) ContainsAny

func (nets Subnets) ContainsAny(nets1 Subnets) bool

func (Subnets) ContainsAnyEx

func (nets Subnets) ContainsAnyEx(nets1 Subnets) (bool, *netutils.IPV4Prefix)

func (Subnets) StrList

func (nets Subnets) StrList() []string

func (Subnets) String

func (nets Subnets) String() string

Jump to

Keyboard shortcuts

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