models

package
v0.0.0-...-b4ab54f Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 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 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 NewOutputSchema

func NewOutputSchema(o *Output) schema.Output

func NewPointSchema

func NewPointSchema(p *Point) schema.Point

func NewUserSchema

func NewUserSchema(u *User) schema.User

Types

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 MultiPath

type MultiPath struct {
	NextHop string `json:"nexthop"`
	Weight  int    `json:"weight"`
}

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"`
	Config  interface{} `json:"config"`
}

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 Output

type Output struct {
	Network  string
	Protocol string
	Remote   string
	Segment  int
	Device   string
	Secret   string
	RxBytes  uint64
	TxBytes  uint64
	ErrPkt   uint64
	NewTime  int64
}

func (*Output) UpTime

func (o *Output) UpTime() int64

func (*Output) Update

func (l *Output) Update()

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"`
	MultiPath []MultiPath `json:"multipath,omitempty"`
}

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