network

package
v0.0.0-...-fef6819 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache = cache.New(5*time.Minute, 10*time.Minute)

Cache represent the process-global cache system, used for example to prevent repetitive HTTP requests from being sent to LibreNMS

Functions

func BuildAPIClient

func BuildAPIClient() *gentleman.Client

BuildAPIClient build the HTTP client used for LibreNMS, it automatically inject the base URL and authentication token.

func BuildHTTPClient

func BuildHTTPClient() *gentleman.Client

BuildHTTPClient build the default HTTP client used in the application and inject a debug logging

func RunRequestIfNotCached

func RunRequestIfNotCached(key string, req *gentleman.Request) (*gentleman.Response, error)

RunRequestIfNotCached will take a cache key and a request as parameter, it will only run it if the same request hasn't been executed already (checked using cache keys) and returns the cached response (or run it and cache the response before returning it)

Types

This section is empty.

Jump to

Keyboard shortcuts

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