models

package
v0.0.0-...-04092ee Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NetworkEqual

func NetworkEqual(o *Network, n *Network) bool

func NewEspPolicySchema

func NewEspPolicySchema(e *EspPolicy) schema.EspPolicy

func NewEspSchema

func NewEspSchema(e *Esp) schema.Esp

func NewEspStateSchema

func NewEspStateSchema(e *EspState) schema.EspState

func NewLinkSchema

func NewLinkSchema(l *Link) schema.Link

func NewNeighborSchema

func NewNeighborSchema(n *Neighbor) schema.Neighbor

func NewNetworkSchema

func NewNetworkSchema(n *Network) schema.Network

func NewOnLineSchema

func NewOnLineSchema(l *Line) schema.OnLine

func NewPointSchema

func NewPointSchema(p *Point) schema.Point

func NewUserSchema

func NewUserSchema(u *User) schema.User

Types

type Esp

type Esp struct {
	Name    string
	Address string
	NewTime int64
}

func (*Esp) ID

func (l *Esp) ID() string

func (*Esp) Update

func (l *Esp) Update()

type EspPolicy

type EspPolicy struct {
	*schema.EspPolicy
	In  *nl.XfrmPolicy
	Fwd *nl.XfrmPolicy
	Out *nl.XfrmPolicy
}

func (*EspPolicy) ID

func (l *EspPolicy) ID() string

func (*EspPolicy) String

func (l *EspPolicy) String() string

func (*EspPolicy) Update

func (l *EspPolicy) Update()

type EspState

type EspState struct {
	*schema.EspState
	NewTime int64
	In      *nl.XfrmState
	Out     *nl.XfrmState
}

func (*EspState) ID

func (l *EspState) ID() string

func (*EspState) String

func (l *EspState) String() string

func (*EspState) UpTime

func (l *EspState) UpTime() int64

func (*EspState) Update

func (l *EspState) Update()

type Line

type Line struct {
	EthType    uint16
	IpSource   net.IP
	IpDest     net.IP
	IpProtocol uint8
	PortDest   uint16
	PortSource uint16
	NewTime    int64
	HitTime    int64
}

func NewLine

func NewLine(t uint16) *Line

func (*Line) LastTime

func (l *Line) LastTime() int64

func (*Line) String

func (l *Line) String() string

func (*Line) UpTime

func (l *Line) UpTime() int64
type Link struct {
	User       string
	Network    string
	Protocol   string
	StatusFile string
}

func (*Link) Status

func (l *Link) Status() *schema.Point

type Neighbor

type Neighbor struct {
	Network string           `json:"network"`
	Device  string           `json:"device"`
	Client  string           `json:"client"`
	HwAddr  net.HardwareAddr `json:"hwAddr"`
	IpAddr  net.IP           `json:"ipAddr"`
	NewTime int64            `json:"newTime"`
	HitTime int64            `json:"hitTime"`
}

func NewNeighbor

func NewNeighbor(hwAddr net.HardwareAddr, ipAddr net.IP, client libol.SocketClient) (e *Neighbor)

func (*Neighbor) String

func (e *Neighbor) String() string

func (*Neighbor) UpTime

func (e *Neighbor) UpTime() int64

func (*Neighbor) Update

func (e *Neighbor) Update(client libol.SocketClient)

type Network

type Network struct {
	Name    string   `json:"name"`
	Tenant  string   `json:"tenant,omitempty"`
	IfAddr  string   `json:"ifAddr"`
	IpStart string   `json:"ipStart"`
	IpEnd   string   `json:"ipEnd"`
	Netmask string   `json:"netmask"`
	Routes  []*Route `json:"routes"`
}

func NewNetwork

func NewNetwork(name string, ifAddr string) (this *Network)

func (*Network) ParseIP

func (u *Network) ParseIP(s string)

func (*Network) String

func (u *Network) String() string

type Point

type Point struct {
	UUID     string             `json:"uuid"`
	Alias    string             `json:"alias"`
	Network  string             `json:"network"`
	User     string             `json:"user"`
	Protocol string             `json:"protocol"`
	Server   string             `json:"server"`
	Uptime   int64              `json:"uptime"`
	Status   string             `json:"status"`
	IfName   string             `json:"device"`
	Client   libol.SocketClient `json:"-"`
	Device   network.Taper      `json:"-"`
	System   string             `json:"system"`
}

func NewPoint

func NewPoint(c libol.SocketClient, d network.Taper, proto string) (w *Point)

func (*Point) SetUser

func (p *Point) SetUser(user *User)

func (*Point) Update

func (p *Point) Update() *Point

type Route

type Route struct {
	Prefix  string `json:"prefix"`
	NextHop string `json:"nexthop"`
	Metric  int    `json:"metric"`
	Mode    string `json:"mode"`
	Origin  string `json:"origin"`
}

func NewRoute

func NewRoute(prefix string, nexthop, mode string) (this *Route)

func (*Route) SetMetric

func (u *Route) SetMetric(value int)

func (*Route) SetOrigin

func (u *Route) SetOrigin(value string)

func (*Route) String

func (u *Route) String() string

type User

type User struct {
	Alias    string             `json:"alias"`
	Name     string             `json:"name"`
	Network  string             `json:"network"`
	Password string             `json:"password"`
	UUID     string             `json:"uuid"`
	System   string             `json:"system"`
	Role     string             `json:"type"` // admin , guest or ldap
	Last     libol.SocketClient `json:"last"` // lastly accessed by this.
	Lease    time.Time          `json:"leastTime"`
	UpdateAt int64
}

func NewUser

func NewUser(name, network, password string) *User

func SchemaToUserModel

func SchemaToUserModel(user *schema.User) *User

func (*User) Id

func (u *User) Id() string

func (*User) String

func (u *User) String() string

func (*User) Update

func (u *User) Update()

Jump to

Keyboard shortcuts

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