api_v1

package
v0.0.0-...-05e2a6c Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(g *gin.RouterGroup, log *zap.Logger, cachedDnsServer string, pinger *pingttl.Pinger)

Init initializes the API.

Types

type BGPRoute

type BGPRoute struct {
	// Prefix is used to define the prefix of the BGP route.
	Prefix *string `json:"prefix"`

	// AsPath is set when the route has an AS path.
	AsPath []int `json:"as_path"`

	// LocalPref is set when the route has a local preference.
	LocalPref *int `json:"local_pref"`

	// NextHop is set when the route has a next hop.
	NextHop *string `json:"next_hop"`

	// Community is used to define a BGP community.
	Community []string `json:"community"`

	// LargeCommunity is used to define a large BGP community.
	LargeCommunity []string `json:"large_community"`
}

BGPRoute is used to define a route in BGP.

type BGPRouteSlice

type BGPRouteSlice []*BGPRoute

BGPRouteSlice is used to define a slice of BGP routes that implements sort.Interface.

func (BGPRouteSlice) Len

func (v BGPRouteSlice) Len() int

Len implements sort.Interface.

func (BGPRouteSlice) Less

func (v BGPRouteSlice) Less(i, j int) bool

Less implements sort.Interface.

func (BGPRouteSlice) Swap

func (v BGPRouteSlice) Swap(i, j int)

Swap implements sort.Interface.

type PingErrorMessage

type PingErrorMessage struct {
	// IsTimeout is used to define if the error is a timeout.
	IsTimeout bool `json:"is_timeout"`

	// Message is used to define the error message.
	Message string `json:"message"`
}

PingErrorMessage is used to define the error message.

type PingResponse

type PingResponse struct {
	// Error is not nil if there was an error.
	Error *PingErrorMessage `json:"error,omitempty"`

	// IPAddress is used to define the IP address of the host.
	IPAddress string `json:"ip_address"`

	// Hostname is used to define the hostname. If it is nil, it means the rDNS lookup is not available.
	Hostname *string `json:"hostname"`

	// Latency is the time the round-trip in milliseconds.
	Latency *float64 `json:"latency,omitempty"`
}

PingResponse is used to define an item in the ping response.

type TraceItem

type TraceItem struct {
	// Pings is used to define the latency of all pings sent.
	Pings [3]*float64 `json:"pings"`

	// RDNS is used to define the RDNS of the host if valid.
	RDNS *string `json:"rdns"`

	// IPAddress is used to define the IP address of the host.
	IPAddress string `json:"ip_address"`
}

TraceItem is used to define an item within the traceroute slice.

type TraceResponse

type TraceResponse struct {
	// Traceroute is used to define the traceroute slice.
	Traceroute []*TraceItem `json:"traceroute"`

	// DestinationIP is used to define the destination IP address.
	DestinationIP string `json:"destination_ip"`
}

TraceResponse is used to define the response of the traceroute API.

Jump to

Keyboard shortcuts

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