helpers

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlreadyLogin

func AlreadyLogin(r *http.Request) bool

AlreadyLogin checks is user already logged in.

func AsyncCheck

func AsyncCheck(handler http.HandlerFunc) http.HandlerFunc

AsyncCheck is a middleware for async requests.

func AuthCheck

func AuthCheck(handler http.HandlerFunc) http.HandlerFunc

AuthCheck is a middleware for handlers.

func GetAdditionalSwData

func GetAdditionalSwData(ip, model string) (rev, sernum string, err error)

GetAdditionalSwData trying to get serial number and revision of switch by SNMP.

func GetMainSwData

func GetMainSwData(name string) (ip, mac, upswitchname, port string, err error)

GetMainSwData gets IP, MAC and UpSwitchName of switch from source database.

Types

type Build

type Build struct {
	Name    string `db:"name"`
	Address string `db:"addr"`
}

Build struct describing build.

type Floor

type Floor struct {
	Build string `db:"build"`
	Floor string `db:"floor"`
}

Floor struct describing floor.

type Switch

type Switch struct {
	Name     string `db:"name"`
	IP       string `db:"ip"`
	MAC      string `db:"mac"`
	Revision string `db:"revision"`
	Serial   string `db:"serial"`
	Model    string `db:"model"`
	Build    string `db:"build"`
	Floor    string `db:"floor"`
	Upswitch string `db:"upswitch"`
	Port     string `db:"port"`
	Postop   string `db:"postop"`
	Posleft  string `db:"posleft"`
}

Switch struct describing switch.

type ViewData

type ViewData struct {
	Build  string      // Build to go back from build page.
	Floor  string      // Floor to go back from plan page.
	User   interface{} // User to show username of user.
	Sw     Switch      // Sw to show switch information on change page.
	Swits  []Switch    // Swits to show information of switch on plan.
	Builds []Build     // Builds to show build on map.
	Floors []Floor     // Floors to show floors in build.
}

ViewData struct for data that inserts into HTML templates.

Jump to

Keyboard shortcuts

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