Documentation
¶
Index ¶
- Constants
- type APICallError
- type Arp
- type ArpTable
- type Client
- func (c *Client) Endpoints() map[EndpointName]EndpointPath
- func (c *Client) FetchArpTable() (ArpTable, *APICallError)
- func (c *Client) FetchCronTable() (CronTable, *APICallError)
- func (c *Client) FetchGateways() (Gateways, *APICallError)
- func (c *Client) FetchInterfaces() (Interfaces, *APICallError)
- func (c *Client) FetchOpenVPNInstances() (OpenVPNInstances, *APICallError)
- func (c *Client) FetchPFStatsByInterface() (FirewallPFStats, *APICallError)
- func (c *Client) FetchProtocolStatistics() (ProtocolStatistics, *APICallError)
- func (c *Client) FetchServices() (Services, *APICallError)
- func (c *Client) FetchSystemInfo() (SystemInfo, *APICallError)
- func (c *Client) FetchUnboundOverview() (UnboundDNSOverview, *APICallError)
- func (c *Client) FetchWireguardConfig() (WireguardClients, *APICallError)
- func (c *Client) HealthCheck() (HealthCheckResponse, error)
- type Cron
- type CronStatus
- type CronTable
- type EndpointName
- type EndpointPath
- type FirewallPFStat
- type FirewallPFStats
- type Gateway
- type GatewayStatus
- type Gateways
- type HealthCheckResponse
- type Interface
- type InterfaceDetails
- type Interfaces
- type OpenVPN
- type OpenVPNInstances
- type ProtocolStatistics
- type Service
- type ServiceStatus
- type Services
- type SystemInfo
- type Temperature
- type UnboundDNSOverview
- type WGInterfaceStatus
- type WireguardClients
- type WireguardInterfaces
- type WireguardPeers
Constants ¶
const HealthCheckStatusOK = "OK"
const MaxRetries = 3
MaxRetries is the maximum number of retries when a request to the OPNsense API fails
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APICallError ¶
APICallError is an error returned by the OPNsense API
func (APICallError) Error ¶
func (e APICallError) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an OPNsense API client
func (*Client) Endpoints ¶
func (c *Client) Endpoints() map[EndpointName]EndpointPath
Endpoints returns a map of all the endpoints that are called by the client.
func (*Client) FetchArpTable ¶
func (c *Client) FetchArpTable() (ArpTable, *APICallError)
func (*Client) FetchCronTable ¶
func (c *Client) FetchCronTable() (CronTable, *APICallError)
func (*Client) FetchGateways ¶
func (c *Client) FetchGateways() (Gateways, *APICallError)
FetchGateways fetches the gateways status details from the OPNsense API and returns a safe wrapper Gateways struct.
func (*Client) FetchInterfaces ¶
func (c *Client) FetchInterfaces() (Interfaces, *APICallError)
func (*Client) FetchOpenVPNInstances ¶
func (c *Client) FetchOpenVPNInstances() (OpenVPNInstances, *APICallError)
func (*Client) FetchPFStatsByInterface ¶ added in v0.0.6
func (c *Client) FetchPFStatsByInterface() (FirewallPFStats, *APICallError)
func (*Client) FetchProtocolStatistics ¶
func (c *Client) FetchProtocolStatistics() (ProtocolStatistics, *APICallError)
func (*Client) FetchServices ¶
func (c *Client) FetchServices() (Services, *APICallError)
func (*Client) FetchSystemInfo ¶
func (c *Client) FetchSystemInfo() (SystemInfo, *APICallError)
func (*Client) FetchUnboundOverview ¶
func (c *Client) FetchUnboundOverview() (UnboundDNSOverview, *APICallError)
func (*Client) FetchWireguardConfig ¶ added in v0.0.2
func (c *Client) FetchWireguardConfig() (WireguardClients, *APICallError)
func (*Client) HealthCheck ¶ added in v0.0.4
func (c *Client) HealthCheck() (HealthCheckResponse, error)
HealthCheck checks if the OPNsense is up and running.
type CronStatus ¶
type CronStatus int
const ( CronStatusDisabled CronStatus = iota CronStatusEnabled )
type EndpointName ¶
type EndpointName string
EndpointName is the custom type for name of an endpoint definition
type EndpointPath ¶
type EndpointPath string
EndpointPath is the custom type for url path of an endpoint definition
type FirewallPFStat ¶ added in v0.0.6
type FirewallPFStat struct { InterfaceName string `json:"interface,omitempty"` // We will populate this field with the key of the map References int `json:"references"` In4PassPackets int `json:"in4_pass_packets"` In4BlockPackets int `json:"in4_block_packets"` Out4PassPackets int `json:"out4_pass_packets"` Out4BlockPackets int `json:"out4_block_packets"` In6PassPackets int `json:"in6_pass_packets"` In6BlockPackets int `json:"in6_block_packets"` Out6PassPackets int `json:"out6_pass_packets"` Out6BlockPackets int `json:"out6_block_packets"` }
type FirewallPFStats ¶ added in v0.0.6
type FirewallPFStats struct {
Interfaces []FirewallPFStat
}
type GatewayStatus ¶
type GatewayStatus int
GatewayStatus is the custom type that represents the status of a gateway
const ( GatewayStatusOffline GatewayStatus = iota GatewayStatusOnline GatewayStatusUnknown )
type HealthCheckResponse ¶ added in v0.0.4
type HealthCheckResponse struct { System struct { Status string `json:"status"` } `json:"System"` CrashReporter struct { Message string `json:"message"` Status string `json:"status"` StatusCode int `json:"statusCode"` } `json:"CrashReporter"` Firewall struct { Message string `json:"message"` Status string `json:"status"` StatusCode int `json:"statusCode"` } `json:"Firewall"` }
type InterfaceDetails ¶
type InterfaceDetails struct { Device string `json:"device"` Driver string `json:"driver"` Index string `json:"index"` Flags string `json:"flags"` PromiscuousListeners string `json:"promiscuous listeners"` SendQueueLength string `json:"send queue length"` SendQueueMaxLength string `json:"send queue max length"` SendQueueDrops string `json:"send queue drops"` Type string `json:"type"` AddressLength string `json:"address length"` HeaderLength string `json:"header length"` LinkState string `json:"link state"` Vhid string `json:"vhid"` Datalen string `json:"datalen"` MTU string `json:"mtu"` Metric string `json:"metric"` LineRate string `json:"line rate"` PacketsReceived string `json:"packets received"` PacketsTransmitted string `json:"packets transmitted"` BytesReceived string `json:"bytes received"` BytesTransmitted string `json:"bytes transmitted"` OutputErrors string `json:"output errors"` InputErrors string `json:"input errors"` Collisions string `json:"collisions"` MulticastsReceived string `json:"multicasts received"` MulticastsTransmitted string `json:"multicasts transmitted"` InputQueueDrops string `json:"input queue drops"` PacketsForUnknownProtocol string `json:"packets for unknown protocol"` HWOffloadCapabilities string `json:"HW offload capabilities"` UptimeAtAttachOrStatReset string `json:"uptime at attach or stat reset"` Name string `json:"name"` }
type Interfaces ¶
type Interfaces struct {
Interfaces []Interface
}
type OpenVPNInstances ¶
type OpenVPNInstances struct {
Rows []OpenVPN
}
type ProtocolStatistics ¶
type ProtocolStatistics struct { TCPSentPackets int TCPReceivedPackets int ARPSentRequests int ARPReceivedRequests int TCPConnectionCountByState map[string]int ICMPCalls int ICMPSentPackets int ICMPDroppedByReason map[string]int UDPDeliveredPackets int UDPOutputPackets int UDPReceivedDatagrams int UDPDroppedByReason map[string]int }
type Service ¶
type Service struct { Description string Name string Status ServiceStatus }
type ServiceStatus ¶
type ServiceStatus int
const ( ServiceStatusStopped ServiceStatus = iota ServiceStatusRunning ServiceStatusUnknown )
type SystemInfo ¶
type SystemInfo struct {
Temperature []Temperature
}
type Temperature ¶
type UnboundDNSOverview ¶
type WGInterfaceStatus ¶ added in v0.0.2
type WGInterfaceStatus int
WGInterfaceStatus is the custom type that represents the status of a Wireguard interface
const ( WGInterfaceStatusDown WGInterfaceStatus = iota WGInterfaceStatusUp WGInterfaceStatusUnknown )
type WireguardClients ¶ added in v0.0.2
type WireguardClients struct { Peers []WireguardPeers Interfaces []WireguardInterfaces }
type WireguardInterfaces ¶ added in v0.0.2
type WireguardInterfaces struct { Device string DeviceType string Name string DeviceName string Status WGInterfaceStatus }