model

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HMachine added in v1.1.0

type HMachine struct {
	ID          int        `json:"id"`
	IPAddresses []string   `json:"ip_addresses,omitempty"`
	Name        string     `json:"name"`
	LastSeen    *Timestamp `json:"last_seen,omitempty"`
	ForcedTags  []string   `json:"forced_tags,omitempty"`
	GivenName   string     `json:"given_name,omitempty"`
	Online      bool       `json:"online"`
	User        *HUser     `json:"user,omitempty"`
	Routes      []*HRoute  `json:"routes"`
}

Headscale Machine

func ToHMachine added in v1.1.0

func ToHMachine(m *v1.Machine) *HMachine

type HMachineMutation added in v1.1.0

type HMachineMutation struct {
	RenameMachine  *HMachine `json:"renameMachine"`
	DeleteMachine  bool      `json:"deleteMachine"`
	SetMachineTags *HMachine `json:"setMachineTags"`
	MoveMachine    *HMachine `json:"moveMachine"`
}

type HRoute added in v1.1.0

type HRoute struct {
	ID         int        `json:"id"`
	Machine    *HMachine  `json:"machine,omitempty"`
	Prefix     string     `json:"prefix"`
	Advertised bool       `json:"advertised"`
	Enabled    bool       `json:"enabled"`
	IsPrimary  bool       `json:"is_primary,omitempty"`
	CreatedAt  *Timestamp `json:"created_at,omitempty"`
	UpdatedAt  *Timestamp `json:"updated_at,omitempty"`
	DeletedAt  *Timestamp `json:"deleted_at,omitempty"`
}

func ToHRoute added in v1.1.0

func ToHRoute(r *v1.Route) *HRoute

type HRouteMutation added in v1.1.0

type HRouteMutation struct {
	EnableRoute bool `json:"enableRoute"`
	DeleteRoute bool `json:"deleteRoute"`
}

type HUser added in v1.1.0

type HUser struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	CreatedAt *Timestamp `json:"created_at,omitempty"`
}

Headscale User

func ToHUser added in v1.1.0

func ToHUser(u *v1.User) *HUser

type HUserMutation added in v1.2.0

type HUserMutation struct {
	CreateUser *HUser `json:"createUser"`
	DeleteUser bool   `json:"deleteUser"`
	RenameUser *HUser `json:"renameUser"`
}

type HasID

type HasID interface {
	IsHasID()
	GetID() *string
}

type HeadscaleMutation added in v1.1.0

type HeadscaleMutation struct {
	Route   *HRouteMutation   `json:"route,omitempty"`
	Machine *HMachineMutation `json:"machine,omitempty"`
	User    *HUserMutation    `json:"user,omitempty"`
}

type HeadscaleQuery added in v1.1.0

type HeadscaleQuery struct {
	Machines []*HMachine `json:"machines"`
	Machine  *HMachine   `json:"machine,omitempty"`
	Users    []*HUser    `json:"users"`
}

type Machine

type Machine struct {
	ID *string `json:"id,omitempty" bson:"_id"`
	// 名称
	Name *string `json:"name,omitempty"`
}

机器

func (Machine) GetID

func (this Machine) GetID() *string

func (Machine) IsHasID

func (Machine) IsHasID()

type MachineInput

type MachineInput struct {
	ID   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

func (*MachineInput) GetID

func (input *MachineInput) GetID() *string

func (*MachineInput) ToBson

func (machine *MachineInput) ToBson() *bson.M

type MachineMutation

type MachineMutation struct {
	SaveMachine   *Machine `json:"saveMachine,omitempty"`
	DeleteMachine int      `json:"deleteMachine"`
}

type Project

type Project struct {
	ID *string `json:"id,omitempty" bson:"_id"`
	// 项目编码
	Code *string `json:"code,omitempty"`
	// 项目名称
	Name *string `json:"name,omitempty"`
	// 当前机器
	Machine *Machine `json:"machine,omitempty" bson:"-"`
	// 可用机器
	Machines []*Machine `json:"machines,omitempty" bson:"-"`
	// 当前机器ID
	MachineID *string `json:"machineID,omitempty" bson:"machine"`
	// 可用机器ID
	MachineIDs []*string `json:"machineIDs,omitempty" bson:"machines"`
	Routes     []*Route  `json:"routes,omitempty" bson:"-"`
}

项目

func (Project) GetID

func (this Project) GetID() *string

func (Project) IsHasID

func (Project) IsHasID()

type ProjectInput

type ProjectInput struct {
	ID         *string   `json:"id,omitempty"`
	Code       *string   `json:"code,omitempty"`
	Name       *string   `json:"name,omitempty"`
	MachineID  *string   `json:"machineID,omitempty"`
	MachineIDs []*string `json:"machineIDs,omitempty"`
}

func (*ProjectInput) GetID

func (input *ProjectInput) GetID() *string

func (*ProjectInput) ToBson

func (project *ProjectInput) ToBson() *bson.M

type ProjectMutation

type ProjectMutation struct {
	SaveProject      *Project      `json:"saveProject,omitempty"`
	DeleteProject    int           `json:"deleteProject"`
	SyncProjectRoute []*SyncResult `json:"syncProjectRoute,omitempty"`
}

type Route

type Route struct {
	ID *string `json:"id,omitempty" bson:"_id"`
	// 地址
	Name *string `json:"name,omitempty"`
	// 描述
	Description *string `json:"description,omitempty"`
	// 项目
	Project   *Project `json:"project,omitempty" bson:"-"`
	ProjectID *string  `json:"projectID,omitempty" bson:"project"`
}

路由

func (Route) GetID

func (this Route) GetID() *string

func (Route) IsHasID

func (Route) IsHasID()

type RouteInput

type RouteInput struct {
	ID          *string `json:"id,omitempty"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
	ProjectID   *string `json:"projectID,omitempty"`
}

func (*RouteInput) GetID

func (input *RouteInput) GetID() *string

func (*RouteInput) ToBson

func (route *RouteInput) ToBson() *bson.M

type RouteMutation

type RouteMutation struct {
	SaveRoute   *Route `json:"saveRoute,omitempty"`
	DeleteRoute int    `json:"deleteRoute"`
}

type SyncResult

type SyncResult struct {
	ProjectID string   `json:"projectID"`
	Project   *Project `json:"project,omitempty"`
	RouteID   string   `json:"routeID"`
	Route     *Route   `json:"route,omitempty"`
	MachineID string   `json:"machineID"`
	Machine   *Machine `json:"machine,omitempty"`
	// 路由是否启用
	RouteEnable bool `json:"routeEnable"`
}

项目路由同步结果

type Timestamp added in v1.1.0

type Timestamp struct {
	Seconds int `json:"seconds"`
	Nanos   int `json:"nanos"`
}

func ToTimestamp added in v1.1.0

func ToTimestamp(t *timestamppb.Timestamp) *Timestamp

Jump to

Keyboard shortcuts

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