Documentation
¶
Index ¶
- func NewIPOption(t layers.DHCPOpt, v net.IP) layers.DHCPOption
- func NewInt32Option(t layers.DHCPOpt, v int) layers.DHCPOption
- func NewStringOption(t layers.DHCPOpt, v string) layers.DHCPOption
- func NewUint16Option(t layers.DHCPOpt, v int) layers.DHCPOption
- func NewUint32Option(t layers.DHCPOpt, v int) layers.DHCPOption
- type APIError
- type Address
- type AddressForm
- type DeviceClass
- type DeviceClassForm
- type Group
- type GroupForm
- type GroupOptions
- type Image
- type ImageForm
- type NoPWGroup
- type NoPWGroupForm
- type NullInt32
- type Option
- type OptionForm
- type Pool
- type PoolForm
- type PoolWithAddresses
- type User
- type UserForm
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewIPOption ¶
func NewInt32Option ¶
func NewInt32Option(t layers.DHCPOpt, v int) layers.DHCPOption
func NewStringOption ¶
func NewStringOption(t layers.DHCPOpt, v string) layers.DHCPOption
func NewUint16Option ¶
func NewUint16Option(t layers.DHCPOpt, v int) layers.DHCPOption
func NewUint32Option ¶
func NewUint32Option(t layers.DHCPOpt, v int) layers.DHCPOption
Types ¶
type Address ¶
type Address struct {
ID int `json:"id" gorm:"primary_key"`
Pool Pool `json:"pool" gorm:"foreignkey:PoolID"`
Group Group `json:"group" gorm:"foreignkey:GroupID"`
AddressForm
FirstSeen time.Time `json:"first_seen"`
LastSeen time.Time `json:"last_seen"`
// DHCP parameters
LastSeenRelay string `json:"last_seen_relay" gorm:"type:varchar(15)"`
MissingOptions string `json:"missing_options" gorm:"type:varchar(255)"`
Expires time.Time `json:"expires_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}
type AddressForm ¶
type AddressForm struct {
IP string `json:"ip" gorm:"type:varchar(15);not null;index:uniqIp,unique"`
Mac string `json:"mac" gorm:"type:varchar(17);not null"`
Hostname string `json:"hostname" gorm:"type:varchar(255)"`
Domain string `json:"domain" gorm:"type:varchar(255)"`
Reimage bool `json:"reimage" gorm:"type:bool;index:uniqIp,unique"`
PoolID NullInt32 `json:"pool_id" gorm:"type:BIGINT" swaggertype:"integer"`
GroupID NullInt32 `json:"group_id" gorm:"type:BIGINT" swaggertype:"integer"`
Progress int `json:"progress" gorm:"type:INT"`
Progresstext string `json:"progresstext" gorm:"type:varchar(255)"`
Ks string `json:"ks" gorm:"type:text"`
}
type DeviceClass ¶
type DeviceClassForm ¶
type Group ¶
type Group struct {
ID int `json:"id" gorm:"primary_key"`
GroupForm
Pool *Pool `json:"pool,omitempty" gorm:"foreignkey:PoolID"`
Option []Option `json:"option,omitempty" gorm:"foreignkey:PoolID"`
Address []Address `json:"address,omitempty" gorm:"foreignkey:GroupID"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}
type GroupForm ¶
type GroupForm struct {
PoolID int `json:"pool_id" gorm:"type:BIGINT"`
Name string `json:"name" gorm:"type:varchar(255)"`
DNS string `json:"dns" gorm:"type:varchar(255)"`
NTP string `json:"ntp" gorm:"type:varchar(255)"`
Password string `json:"password" gorm:"type:varchar(255)"`
ImageID int `json:"image_id" gorm:"type:INT"`
Ks string `json:"ks" gorm:"type:text"`
Syslog string `json:"syslog" gorm:"type:varchar(255)"`
Vlan string `json:"vlan" gorm:"type:INT"`
CallbackURL string `json:"callbackurl"`
BootDisk string `json:"bootdisk" gorm:"type:varchar(255)"`
Options datatypes.JSON `json:"options" sql:"type:JSONB" swaggertype:"object,string"`
}
type GroupOptions ¶
type NoPWGroup ¶ added in v0.3.20
type NoPWGroup struct {
ID int `json:"id" gorm:"primary_key"`
NoPWGroupForm
Pool *Pool `json:"pool,omitempty" gorm:"foreignkey:PoolID"`
Option []Option `json:"option,omitempty" gorm:"foreignkey:PoolID"`
Address []Address `json:"address,omitempty" gorm:"foreignkey:GroupID"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}
type NoPWGroupForm ¶ added in v0.3.20
type NoPWGroupForm struct {
PoolID int `json:"pool_id" gorm:"type:BIGINT"`
Name string `json:"name" gorm:"type:varchar(255)"`
DNS string `json:"dns" gorm:"type:varchar(255)"`
NTP string `json:"ntp" gorm:"type:varchar(255)"`
ImageID int `json:"image_id" gorm:"type:INT"`
Ks string `json:"ks" gorm:"type:text"`
Syslog string `json:"syslog" gorm:"type:varchar(255)"`
Vlan string `json:"vlan" gorm:"type:INT"`
CallbackURL string `json:"callbackurl"`
BootDisk string `json:"bootdisk" gorm:"type:varchar(255)"`
Options datatypes.JSON `json:"options" sql:"type:JSONB" swaggertype:"object,string"`
}
type NullInt32 ¶
func (NullInt32) MarshalJSON ¶
NullInt64 MarshalJSON interface redefinition
func (*NullInt32) UnmarshalJSON ¶
type Option ¶
type Option struct {
ID int `json:"id" gorm:"primary_key"`
OptionForm
Pool *Pool `json:"pool,omitempty" gorm:"foreignkey:PoolID"`
Address *Address `json:"address,omitempty" gorm:"foreignkey:AddressID"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt *time.Time `json:"deleted_at,omitempty"`
}
func (Option) ToDHCPOption ¶
func (o Option) ToDHCPOption() (opt layers.DHCPOption, merge bool, err error)
type OptionForm ¶
type OptionForm struct {
PoolID int `json:"pool_id" gorm:"type:BIGINT"`
AddressID int `json:"address_id" gorm:"type:BIGINT"`
DeviceClassID int `json:"device_class_id" gorm:"type:BIGINT"`
OpCode byte `json:"opcode" gorm:"type:SMALLINT;unsigned;not null" binding:"required" `
Data string `json:"data" gorm:"type:varchar(255);not null" binding:"required" `
Priority int `json:"priority" gorm:"type:SMALLINT;not null" binding:"required" `
}
type Pool ¶
type PoolForm ¶
type PoolForm struct {
Name string `json:"name" gorm:"type:varchar(255);not null" binding:"required" `
StartAddress string `json:"start_address" gorm:"type:varchar(15);not null" binding:"required" `
EndAddress string `json:"end_address" gorm:"type:varchar(15);not null" binding:"required" `
Netmask int `json:"netmask" gorm:"type:integer;not null" binding:"required" `
LeaseTime int `json:"lease_time" gorm:"type:bigint" binding:"required" `
Gateway string `json:"gateway" gorm:"type:varchar(15)" binding:"required" `
OnlyServeReimage bool `json:"only_serve_reimage" gorm:"type:boolean"`
AuthorizedVlan int `json:"authorized_vlan" gorm:"type:bigint"`
ManagedRef string `json:"managed_reference"`
}
type PoolWithAddresses ¶
type PoolWithAddresses struct {
Pool
Addresses []Address `json:"address,omitempty" gorm:"foreignkey:PoolID"`
}
func (*PoolWithAddresses) IsAvailable ¶
func (p *PoolWithAddresses) IsAvailable(ip net.IP) error
func (*PoolWithAddresses) IsAvailableExcept ¶
func (p *PoolWithAddresses) IsAvailableExcept(ip net.IP, exclude string) error
Click to show internal directories.
Click to hide internal directories.