Documentation
¶
Overview ¶
Package pfsenseapi provides the api client for calling the pfsense api
Index ¶
- type APIConfiguration
- type APIConfigurationRequest
- type APIVersion
- type ArpEntry
- type CACertificate
- type CACertificateRequest
- type Certificate
- type CertificateCreateRequest
- type CertificateUpdateRequest
- type Client
- type Config
- type DHCPLease
- type DHCPRange
- type DHCPServerConfiguration
- type DHCPServerConfigurationRequest
- type DHCPService
- func (s DHCPService) CreateStaticMapping(ctx context.Context, newStaticMapping DHCPStaticMappingRequest) (*DHCPStaticMapping, error)
- func (s DHCPService) DeleteStaticMapping(ctx context.Context, mappingInterface string, macAddress string) error
- func (s DHCPService) ListLeases(ctx context.Context) ([]*DHCPLease, error)
- func (s DHCPService) ListServerConfigurations(ctx context.Context) ([]*DHCPServerConfiguration, error)
- func (s DHCPService) ListStaticMappings(ctx context.Context, netInterface string) ([]*DHCPStaticMapping, error)
- func (s DHCPService) UpdateServerConfiguration(ctx context.Context, dhcpConfigData DHCPServerConfigurationRequest) (*DHCPServerConfiguration, error)
- func (s DHCPService) UpdateStaticMapping(ctx context.Context, macAddress string, mappingData DHCPStaticMappingRequest) (*DHCPStaticMapping, error)
- type DHCPStaticMapping
- type DHCPStaticMappingRequest
- type DNSConfiguration
- type DefaultGatewayRequest
- type EmailNotification
- type EmailNotificationRequest
- type ErrorDefinition
- type FirewallAlias
- type FirewallAliasRequest
- type FirewallRule
- type FirewallRuleRequest
- type FirewallService
- func (s FirewallService) AddAliasEntry(ctx context.Context, aliasName string, toAdd map[string]string, apply bool) error
- func (s FirewallService) Apply(ctx context.Context) error
- func (s FirewallService) CreateAlias(ctx context.Context, newAlias FirewallAliasRequest, apply bool) (*FirewallAlias, error)
- func (s FirewallService) CreateRule(ctx context.Context, newRule FirewallRuleRequest, apply bool) (*FirewallRule, error)
- func (s FirewallService) DeleteAlias(ctx context.Context, aliasToDelete string, apply bool) error
- func (s FirewallService) DeleteAliasEntry(ctx context.Context, aliasName string, address string, apply bool) error
- func (s FirewallService) DeleteRule(ctx context.Context, tracker int, apply bool) error
- func (s FirewallService) ListAliases(ctx context.Context) ([]*FirewallAlias, error)
- func (s FirewallService) ListRules(ctx context.Context) ([]*FirewallRule, error)
- func (s FirewallService) UpdateAlias(ctx context.Context, aliasToUpdate string, newAliasData FirewallAliasRequest, ...) (*FirewallAlias, error)
- func (s FirewallService) UpdateRule(ctx context.Context, ruleToUpdate int, newRuleData FirewallRuleRequest, ...) (*FirewallRule, error)
- type FirewallTarget
- type Gateway
- type GatewayRequest
- type GatewayStatus
- type Group
- type GroupRequest
- type Interface
- type InterfaceGroup
- type InterfaceGroupRequestCreate
- type InterfaceGroupRequestUpdate
- type InterfaceRequest
- type InterfaceService
- func (s InterfaceService) Apply(ctx context.Context, async bool) error
- func (s InterfaceService) CreateInterface(ctx context.Context, newInterface InterfaceRequest) (*Interface, error)
- func (s InterfaceService) CreateInterfaceGroup(ctx context.Context, newGroup InterfaceGroupRequestCreate) (*InterfaceGroup, error)
- func (s InterfaceService) CreateVLAN(ctx context.Context, newVLAN VLANRequest) (*VLAN, error)
- func (s InterfaceService) DeleteInterface(ctx context.Context, interfaceID string) error
- func (s InterfaceService) DeleteInterfaceGroup(ctx context.Context, idToDelete int) error
- func (s InterfaceService) DeleteVLAN(ctx context.Context, vlanIf string) error
- func (s InterfaceService) ListInterfaceGroups(ctx context.Context) ([]*InterfaceGroup, error)
- func (s InterfaceService) ListInterfaces(ctx context.Context) ([]*Interface, error)
- func (s InterfaceService) ListVLANs(ctx context.Context) ([]*VLAN, error)
- func (s InterfaceService) UpdateInterface(ctx context.Context, idToUpdate string, interfaceData InterfaceRequest) (*Interface, error)
- func (s InterfaceService) UpdateInterfaceGroup(ctx context.Context, groupData InterfaceGroupRequestUpdate) (*InterfaceGroup, error)
- func (s InterfaceService) UpdateVLAN(ctx context.Context, vlanIf string, vlanData VLANRequest) (*VLAN, error)
- type InterfaceStatus
- type JSONInt
- type OptionalJSONInt
- type Package
- type RoutingService
- func (s RoutingService) Apply(ctx context.Context) error
- func (s RoutingService) CreateGateway(ctx context.Context, newGateway GatewayRequest) (*Gateway, error)
- func (s RoutingService) DeleteGateway(ctx context.Context, gatewayID int) error
- func (s RoutingService) ListGateways(ctx context.Context) ([]*Gateway, error)
- func (s RoutingService) SetDefaultGateway(ctx context.Context, newDefaultGateway DefaultGatewayRequest) error
- func (s RoutingService) UpdateGateway(ctx context.Context, gatewayToUpdate GatewayRequest) (*Gateway, error)
- type StatusService
- func (s StatusService) DHCPLog(ctx context.Context) ([]string, error)
- func (s StatusService) FirewallLog(ctx context.Context) ([]string, error)
- func (s StatusService) GetSystemStatus(ctx context.Context) (*SystemStatus, error)
- func (s StatusService) ListGatewayStatus(ctx context.Context) ([]*GatewayStatus, error)
- func (s StatusService) ListInterfaceStatus(ctx context.Context) ([]*InterfaceStatus, error)
- func (s StatusService) SystemLog(ctx context.Context) ([]string, error)
- type StringArray
- type SystemHostname
- type SystemService
- func (s SystemService) AddDNSServers(ctx context.Context, newDNSServers []string) error
- func (s SystemService) CreateCACertificate(ctx context.Context, newCACertificate CACertificateRequest) (*CACertificate, error)
- func (s SystemService) CreateCertificate(ctx context.Context, newCertificate CertificateCreateRequest) (*Certificate, error)
- func (s SystemService) CreateTunable(ctx context.Context, newTunable TunableRequest) (*Tunable, error)
- func (s SystemService) DeleteArpEntry(ctx context.Context, address string) error
- func (s SystemService) DeleteCACertificate(ctx context.Context, refid string) error
- func (s SystemService) DeleteCertificate(ctx context.Context, refid string) error
- func (s SystemService) DeleteDNSServer(ctx context.Context, dnsserver string) error
- func (s SystemService) DeleteTunable(ctx context.Context, tunableID int) error
- func (s SystemService) GetAPIConfiguration(ctx context.Context) (*APIConfiguration, error)
- func (s SystemService) GetAPIVersion(ctx context.Context) (*APIVersion, error)
- func (s SystemService) GetDNSConfiguration(ctx context.Context) (*DNSConfiguration, error)
- func (s SystemService) GetEmailNotification(ctx context.Context) (*EmailNotification, error)
- func (s SystemService) GetErrorDefinitions(ctx context.Context) (map[string]*ErrorDefinition, error)
- func (s SystemService) GetHostname(ctx context.Context) (*SystemHostname, error)
- func (s SystemService) GetVersion(ctx context.Context) (*Version, error)
- func (s SystemService) GetVersionUpgradeStatus(ctx context.Context, useCache bool) (*VersionUpgradeStatus, error)
- func (s SystemService) Halt(ctx context.Context) error
- func (s SystemService) InstallPackage(ctx context.Context, name string) error
- func (s SystemService) ListArpTable(ctx context.Context) ([]*ArpEntry, error)
- func (s SystemService) ListCACertificates(ctx context.Context) ([]*CACertificate, error)
- func (s SystemService) ListCertificates(ctx context.Context) ([]*Certificate, error)
- func (s SystemService) ListPackages(ctx context.Context, all bool) ([]*Package, error)
- func (s SystemService) ListTunables(ctx context.Context) ([]*Tunable, error)
- func (s SystemService) Reboot(ctx context.Context) error
- func (s SystemService) UninstallPackage(ctx context.Context, name string) error
- func (s SystemService) UpdateAPIConfiguration(ctx context.Context, apiConfiguration APIConfigurationRequest) error
- func (s SystemService) UpdateCertificate(ctx context.Context, refIDToUpdate string, ...) (*Certificate, error)
- func (s SystemService) UpdateDNSConfiguration(ctx context.Context, dnsConfiguration DNSConfiguration) error
- func (s SystemService) UpdateEmailNotification(ctx context.Context, newConfig EmailNotificationRequest) error
- func (s SystemService) UpdateHostname(ctx context.Context, newHostname SystemHostname) error
- func (s SystemService) UpdateTunable(ctx context.Context, tunableToUpdate string, newTunable TunableRequest) (*Tunable, error)
- type SystemStatus
- type TokenService
- type TrueIfPresent
- type Tunable
- type TunableRequest
- type UnboundAliasesList
- type UnboundHostOverride
- type UnboundHostOverrideAlias
- type UnboundService
- func (s UnboundService) CreateHostOverride(ctx context.Context, hostOverride *UnboundHostOverride, apply bool) (*UnboundHostOverride, error)
- func (s UnboundService) DeleteHostOverride(ctx context.Context, host string, domain string, apply bool) error
- func (s UnboundService) ListHostOverrides(ctx context.Context) ([]*UnboundHostOverride, error)
- func (s UnboundService) UpdateHostOverride(ctx context.Context, hostOverride *UnboundHostOverride, apply bool) (*UnboundHostOverride, error)
- type User
- type UserRequest
- type UserService
- func (s UserService) AddPrivilegesToUser(ctx context.Context, username string, privileges []string) error
- func (s UserService) AddUserToGroups(ctx context.Context, username string, groups []string) error
- func (s UserService) CreateGroup(ctx context.Context, newGroup GroupRequest) (*Group, error)
- func (s UserService) CreateUser(ctx context.Context, newUser UserRequest) (*User, error)
- func (s UserService) DeleteGroup(ctx context.Context, groupname string) error
- func (s UserService) DeleteUser(ctx context.Context, username string) error
- func (s UserService) ListGroups(ctx context.Context) ([]*Group, error)
- func (s UserService) ListUsers(ctx context.Context) ([]*User, error)
- func (s UserService) RemovePrivilegeFromUser(ctx context.Context, username, privname string) error
- func (s UserService) RemoveUserFromGroup(ctx context.Context, username, groupname string) error
- func (s UserService) UpdateGroup(ctx context.Context, groupToUpdate string, newGroupData GroupRequest) (*Group, error)
- func (s UserService) UpdateUser(ctx context.Context, userData UserRequest) (*User, error)
- type VLAN
- type VLANRequest
- type Version
- type VersionUpgradeStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIConfiguration ¶
type APIConfiguration struct { Enable string `json:"enable"` Persist string `json:"persist"` AllowedInterfaces string `json:"allowed_interfaces"` AuthMode string `json:"authmode"` ContentType string `json:"content_type"` JwtExp string `json:"jwt_exp"` Keyhash string `json:"keyhash"` Keybytes string `json:"keybytes"` Keys string `json:"keys"` AccessList string `json:"access_list"` }
APIConfiguration represents the API configuration
type APIConfigurationRequest ¶
type APIConfigurationRequest struct { AccessList []string `json:"access_list"` AllowOptions bool `json:"allow_options"` AuthMode string `json:"authmode"` AllowedInterfaces []string `json:"allowed_interfaces"` CustomHeaders []map[string]string `json:"custom_headers"` Enable bool `json:"enable"` EnableLoginProtection bool `json:"enable_login_protection"` LogSuccessfulAuth bool `json:"log_successful_auth"` Hasync bool `json:"hasync"` HasyncHosts []string `json:"hasync_hosts"` HasyncPassword string `json:"hasync_password"` HasyncUsername string `json:"hasync_username"` JwtExp int `json:"jwt_exp"` Keybytes int `json:"keybytes"` Keyhash string `json:"keyhash"` Persist bool `json:"persist"` Readonly bool `json:"readonly"` }
APIConfigurationRequest is the request used to update the API configuration
type APIVersion ¶
type APIVersion struct { CurrentVersion string `json:"current_version"` LatestVersion string `json:"latest_version"` UpdateAvailable bool `json:"update_available"` }
APIVersion represents the API Versions.
type ArpEntry ¶
type ArpEntry struct { Ip string `json:"ip"` Mac string `json:"mac"` Interface string `json:"interface"` Status string `json:"status"` Linktype string `json:"linktype"` }
ArpEntry represents a single arp entry in the arp table.
type CACertificate ¶
type CACertificate struct { Refid string `json:"refid"` Descr string `json:"descr"` Trust string `json:"trust"` Randomserial string `json:"randomserial"` Crt string `json:"crt"` Prv string `json:"prv"` Serial string `json:"serial"` }
CACertificate represents a single CACertificate.
type CACertificateRequest ¶
type CACertificateRequest struct { Caref string `json:"caref"` Crt string `json:"crt"` Descr string `json:"descr"` DigestAlg string `json:"digest_alg"` DnCity string `json:"dn_city"` DnCommonname string `json:"dn_commonname"` DnCountry string `json:"dn_country"` DnOrganization string `json:"dn_organization"` DnOrganizationalunit string `json:"dn_organizationalunit"` DnState string `json:"dn_state"` Ecname string `json:"ecname"` Keylen int `json:"keylen"` Keytype string `json:"keytype"` Lifetime int `json:"lifetime"` Method string `json:"method"` Prv string `json:"prv"` RandomSerial bool `json:"randomserial"` Serial int `json:"serial"` Trust bool `json:"trust"` }
CACertificateRequest represents a single CA Certificate. This type is used for creating a new CA certificate.
type Certificate ¶
type Certificate struct { Refid string `json:"refid"` Descr string `json:"descr"` Prv string `json:"prv"` Crt string `json:"crt"` Caref string `json:"caref"` }
Certificate represents a single installed SSL/TLS certificate.
type CertificateCreateRequest ¶ added in v0.1.4
type CertificateCreateRequest struct { Active bool `json:"active"` Altnames []struct { DNS string `json:"dns,omitempty"` IP string `json:"ip,omitempty"` URI string `json:"uri,omitempty"` Email string `json:"email,omitempty"` } `json:"altnames"` Caref string `json:"caref"` Crt string `json:"crt"` Descr string `json:"descr"` DigestAlg string `json:"digest_alg"` DnCity string `json:"dn_city"` DnCommonname string `json:"dn_commonname"` DnCountry string `json:"dn_country"` DnOrganization string `json:"dn_organization"` DnOrganizationalunit string `json:"dn_organizationalunit"` DnState string `json:"dn_state"` Ecname string `json:"ecname"` Keylen int `json:"keylen"` Keytype string `json:"keytype"` Lifetime int `json:"lifetime"` Method string `json:"method"` Prv string `json:"prv"` Type string `json:"type"` }
CertificateCreateRequest represents a single Certificate. This type is used to create a new certificate.
type CertificateUpdateRequest ¶ added in v0.1.4
type CertificateUpdateRequest struct { Descr string `json:"descr"` Prv string `json:"prv"` Crt string `json:"crt"` Active bool `json:"active"` }
CertificateUpdateRequest is used to update a certificate.
type Client ¶
type Client struct { Cfg Config System *SystemService Token *TokenService DHCP *DHCPService Unbound *UnboundService Status *StatusService Interface *InterfaceService Routing *RoutingService Firewall *FirewallService User *UserService // contains filtered or unexported fields }
Client provides client Methods
func NewClientWithJWTAuth ¶
NewClientWithJWTAuth constructs a new Client using JWT token authentication. The username and password provided here will be used to generate JWT tokens for authentication.
func NewClientWithLocalAuth ¶
NewClientWithLocalAuth constructs a new Client using Local username/password authentication
func NewClientWithNoAuth ¶
NewClientWithNoAuth constructs a new Client using defaults for everything except the host
func NewClientWithTokenAuth ¶
NewClientWithTokenAuth constructs a new Client using token authentication
type Config ¶
type Config struct { Host string LocalAuthEnabled bool User string Password string JWTAuthEnabled bool JWTToken string TokenAuthEnabled bool ApiClientID string ApiClientToken string SkipTLS bool Timeout time.Duration }
Config provides configuration for the client. These values are only read in when NewClient is called.
type DHCPLease ¶
type DHCPLease struct { Ip string `json:"ip"` Type string `json:"type"` Mac string `json:"mac"` If string `json:"if"` Starts string `json:"starts"` Ends string `json:"ends"` Hostname string `json:"hostname"` Descr string `json:"descr"` Online string `json:"online"` StaticmapArrayIndex int `json:"staticmap_array_index"` State string `json:"state"` }
DHCPLease represents a single DHCP lease
type DHCPServerConfiguration ¶ added in v1.1.0
type DHCPServerConfiguration struct { DefaultLeaseTime OptionalJSONInt `json:"defaultleasetime"` DenyUnknown TrueIfPresent `json:"denyunknown"` DNSServer []string `json:"dnsserver"` Domain string `json:"domain"` DomainSearchList string `json:"domainsearchlist"` Enable TrueIfPresent `json:"enable"` Gateway string `json:"gateway"` IgnoreBootP bool `json:"ignorebootp"` Interface string `json:"interface"` MacAllow string `json:"mac_allow"` MacDeny string `json:"mac_deny"` MaxLeaseTime OptionalJSONInt `json:"maxleasetime"` NumberOptions string `json:"numberoptions"` Range *DHCPRange `json:"range"` StaticARP TrueIfPresent `json:"staticarp"` }
DHCPServerConfiguration describes the current DHCP Server (dhcpd) configuration for a specified interface
type DHCPServerConfigurationRequest ¶ added in v1.1.0
type DHCPServerConfigurationRequest struct { DefaultLeaseTime *int `json:"defaultleasetime"` DenyUnknown bool `json:"denyunknown"` DNSServer []string `json:"dnsserver,omitempty"` Domain string `json:"domain,omitempty"` DomainSearchList []string `json:"domainsearchlist,omitempty"` Enable bool `json:"enable"` Gateway string `json:"gateway,omitempty"` IgnoreBootP bool `json:"ignorebootp,omitempty"` Interface string `json:"interface"` MacAllow []string `json:"mac_allow,omitempty"` MacDeny []string `json:"mac_deny,omitempty"` MaxLeaseTime *int `json:"maxleasetime,omitempty"` NumberOptions []interface{} `json:"numberoptions,omitempty"` RangeFrom string `json:"range_from,omitempty"` RangeTo string `json:"range_to,omitempty"` StaticARP bool `json:"staticarp"` }
DHCPServerConfigurationRequest updates the current DHCP Server (dhcpd) configuration for a specified interface
type DHCPService ¶
type DHCPService service
DHCPService provides DHCP API methods
func (DHCPService) CreateStaticMapping ¶
func (s DHCPService) CreateStaticMapping( ctx context.Context, newStaticMapping DHCPStaticMappingRequest, ) (*DHCPStaticMapping, error)
CreateStaticMapping creates a new DHCP static mapping.
func (DHCPService) DeleteStaticMapping ¶
func (s DHCPService) DeleteStaticMapping(ctx context.Context, mappingInterface string, macAddress string) error
DeleteStaticMapping deletes a DHCP static mapping.
func (DHCPService) ListLeases ¶
func (s DHCPService) ListLeases(ctx context.Context) ([]*DHCPLease, error)
ListLeases returns a list of the DHCP leases
func (DHCPService) ListServerConfigurations ¶ added in v1.1.0
func (s DHCPService) ListServerConfigurations(ctx context.Context) ([]*DHCPServerConfiguration, error)
ListServerConfigurations lists all DHCP server configurations
func (DHCPService) ListStaticMappings ¶
func (s DHCPService) ListStaticMappings(ctx context.Context, netInterface string) ([]*DHCPStaticMapping, error)
ListStaticMappings returns a list of the static reservations for the interface provided. The interface can be either the interface's descriptive name, the pfSense interface ID (e.g. wan, lan, optx), or the real interface ID (e.g. igb0).
func (DHCPService) UpdateServerConfiguration ¶ added in v1.1.0
func (s DHCPService) UpdateServerConfiguration( ctx context.Context, dhcpConfigData DHCPServerConfigurationRequest, ) (*DHCPServerConfiguration, error)
UpdateServerConfiguration modifies a DHCP server configuration.
func (DHCPService) UpdateStaticMapping ¶
func (s DHCPService) UpdateStaticMapping( ctx context.Context, macAddress string, mappingData DHCPStaticMappingRequest, ) (*DHCPStaticMapping, error)
UpdateStaticMapping modifies a DHCP static mapping.
type DHCPStaticMapping ¶
type DHCPStaticMapping struct { ID int `json:"id"` Mac string `json:"mac"` Cid string `json:"cid"` IPaddr string `json:"ipaddr"` Hostname string `json:"hostname"` Descr string `json:"descr"` Filename string `json:"filename"` Rootpath string `json:"rootpath"` DefaultLeaseTime string `json:"defaultleasetime"` MaxLeaseTime string `json:"maxleasetime"` Gateway string `json:"gateway"` Domain string `json:"domain"` DomainSearchList string `json:"domainsearchlist"` DDNSDomain string `json:"ddnsdomain"` DDNSDomainPrimary string `json:"ddnsdomainprimary"` DDNSDomainSecondary string `json:"ddnsdomainsecondary"` DDNSDomainkeyName string `json:"ddnsdomainkeyname"` DDNSDomainkeyAlgorithm string `json:"ddnsdomainkeyalgorithm"` DDNSDomainkey string `json:"ddnsdomainkey"` DNSServers []string `json:"dnsserver"` TFTP string `json:"tftp"` LDAP string `json:"ldap"` NextServer string `json:"nextserver"` Filename32 string `json:"filename32"` Filename64 string `json:"filename64"` Filename32Arm string `json:"filename32arm"` Filename64Arm string `json:"filename64arm"` NumberOptions string `json:"numberoptions"` ArpTableStaticEntry TrueIfPresent `json:"arp_table_static_entry"` }
DHCPStaticMapping represents a single DHCP static reservation
type DHCPStaticMappingRequest ¶
type DHCPStaticMappingRequest struct { ArpTableStaticEntry bool `json:"arp_table_static_entry"` Cid string `json:"cid"` Descr string `json:"descr"` DNSServer []string `json:"dnsserver"` Domain string `json:"domain"` DomainSearchList []string `json:"domainsearchlist"` Gateway string `json:"gateway"` Hostname string `json:"hostname"` Interface string `json:"interface"` Ipaddr string `json:"ipaddr"` Mac string `json:"mac"` }
DHCPStaticMappingRequest represents a single DHCP static reservation. This type is used for updating or creating a new static reservation.
type DNSConfiguration ¶
type DNSConfiguration struct { Dnsserver []string `json:"dnsserver"` Dnsallowoverride bool `json:"dnsallowoverride"` Dnslocalhost bool `json:"dnslocalhost"` }
DNSConfiguration represents the system DNS configuration.
type DefaultGatewayRequest ¶
type EmailNotification ¶
type EmailNotification struct { Ipaddress string `json:"ipaddress"` Port string `json:"port"` Sslvalidate string `json:"sslvalidate"` Timeout string `json:"timeout"` Notifyemailaddress string `json:"notifyemailaddress"` Username string `json:"username"` Password string `json:"password"` AuthenticationMechanism string `json:"authentication_mechanism"` Fromaddress string `json:"fromaddress"` Disable string `json:"disable"` }
EmailNotification represents the email notification configuration.
type EmailNotificationRequest ¶
type EmailNotificationRequest struct { AuthenticationMechanism string `json:"authentication_mechanism"` Disabled bool `json:"disabled"` FromAddress string `json:"fromaddress"` Ipaddress string `json:"ipaddress"` Notifyemailaddress string `json:"notifyemailaddress"` Password string `json:"password"` Port int `json:"port"` Ssl bool `json:"ssl"` SslValidate bool `json:"sslvalidate"` Timeout int `json:"timeout"` Username string `json:"username"` }
type ErrorDefinition ¶
type ErrorDefinition struct { Status string `json:"status"` Code int `json:"code"` Return int `json:"return"` Message string `json:"message"` }
ErrorDefinition represents a single error definition.
type FirewallAlias ¶
type FirewallAlias struct { Name string `json:"name"` Type string `json:"type"` Address string `json:"address"` Descr string `json:"descr"` Detail string `json:"detail"` }
FirewallAlias represents a single firewall alias
type FirewallAliasRequest ¶
type FirewallRule ¶
type FirewallRule struct { ID string `json:"id"` AckQueue string `json:"ackqueue,omitempty"` Direction string `json:"direction"` DefaultQueue string `json:"defaultqueue,omitempty"` Disabled bool `json:"disabled"` ICMPType string `json:"icmptype,omitempty"` Dnpipe string `json:"dnpipe,omitempty"` TCPFlags1 string `json:"tcpflags1"` TCPFlags2 string `json:"tcpflags2"` Floating string `json:"floating"` Quick string `json:"quick"` Protocol string `json:"protocol"` Sched string `json:"sched"` Gateway string `json:"gateway"` Tracker JSONInt `json:"tracker"` Type string `json:"type"` PDNPipe string `json:"pdnpipe,omitempty"` Log TrueIfPresent `json:"log"` Interface string `json:"interface"` IPProtocol string `json:"ipprotocol"` Tag string `json:"tag"` Tagged string `json:"tagged"` Max string `json:"max"` MaxSrcNodes string `json:"max-src-nodes"` MaxSrcConn string `json:"max-src-conn"` MaxSrcStates string `json:"max-src-states"` Statetimeout string `json:"statetimeout"` Statetype string `json:"statetype"` Os string `json:"os"` Source *FirewallTarget `json:"source,omitempty"` Destination *FirewallTarget `json:"destination,omitempty"` Descr string `json:"descr"` Updated struct { Time JSONInt `json:"time"` Username string `json:"username"` } `json:"updated"` Created struct { Time JSONInt `json:"time"` Username string `json:"username"` } `json:"created"` }
type FirewallRuleRequest ¶
type FirewallRuleRequest struct { AckQueue string `json:"ackqueue,omitempty"` DefaultQueue string `json:"defaultqueue,omitempty"` Descr string `json:"descr,omitempty"` Direction string `json:"direction,omitempty"` Disabled bool `json:"disabled"` DNPipe string `json:"dnpipe,omitempty"` Dst string `json:"dst,omitempty"` DstPort string `json:"dstport,omitempty"` Floating bool `json:"floating"` Gateway string `json:"gateway,omitempty"` ICMPType []string `json:"icmptype,omitempty"` Interface []string `json:"interface"` IPProtocol string `json:"ipprotocol,omitempty"` Log bool `json:"log"` PDNPipe string `json:"pdnpipe,omitempty"` Protocol string `json:"protocol,omitempty"` Quick bool `json:"quick,omitempty"` Sched string `json:"sched,omitempty"` Src string `json:"src,omitempty"` SrcPort string `json:"srcport,omitempty"` StateType string `json:"statetype,omitempty"` TCPFlagsAny bool `json:"tcpflags_any"` TCPFlags1 []string `json:"tcpflags1,omitempty"` TCPFlags2 []string `json:"tcpflags2,omitempty"` Top bool `json:"top"` Type string `json:"type"` }
type FirewallService ¶
type FirewallService service
FirewallService provides firewall API methods
func (FirewallService) AddAliasEntry ¶
func (s FirewallService) AddAliasEntry(ctx context.Context, aliasName string, toAdd map[string]string, apply bool) error
AddAliasEntry adds an address to an existing Alias. The addresses to add is represented by a map with the address to add being the key, and the description being the value.
func (FirewallService) Apply ¶
func (s FirewallService) Apply(ctx context.Context) error
Apply applies pending firewall changes
func (FirewallService) CreateAlias ¶
func (s FirewallService) CreateAlias( ctx context.Context, newAlias FirewallAliasRequest, apply bool, ) (*FirewallAlias, error)
CreateAlias creates a new Alias.
func (FirewallService) CreateRule ¶
func (s FirewallService) CreateRule( ctx context.Context, newRule FirewallRuleRequest, apply bool, ) (*FirewallRule, error)
CreateRule creates a new Rule
func (FirewallService) DeleteAlias ¶
DeleteAlias deletes a firewall Alias
func (FirewallService) DeleteAliasEntry ¶
func (s FirewallService) DeleteAliasEntry(ctx context.Context, aliasName string, address string, apply bool) error
DeleteAliasEntry deletes a address from a firewall alias
func (FirewallService) DeleteRule ¶
DeleteRule deletes a firewall Rule
func (FirewallService) ListAliases ¶
func (s FirewallService) ListAliases(ctx context.Context) ([]*FirewallAlias, error)
ListAliases returns the aliases
func (FirewallService) ListRules ¶
func (s FirewallService) ListRules(ctx context.Context) ([]*FirewallRule, error)
ListRules returns the rules
func (FirewallService) UpdateAlias ¶
func (s FirewallService) UpdateAlias( ctx context.Context, aliasToUpdate string, newAliasData FirewallAliasRequest, apply bool, ) (*FirewallAlias, error)
UpdateAlias modifies an existing alias
func (FirewallService) UpdateRule ¶
func (s FirewallService) UpdateRule( ctx context.Context, ruleToUpdate int, newRuleData FirewallRuleRequest, apply bool, ) (*FirewallRule, error)
UpdateRule modifies an existing rule
type FirewallTarget ¶ added in v1.1.0
type FirewallTarget struct { Network string `json:"network,omitempty"` Address string `json:"address,omitempty"` Not TrueIfPresent `json:"not,omitempty"` Any TrueIfPresent `json:"any,omitempty"` Port string `json:"port,omitempty"` }
func (*FirewallTarget) TargetString ¶ added in v1.1.0
func (t *FirewallTarget) TargetString() string
type Gateway ¶
type Gateway struct { Dynamic bool `json:"dynamic"` IpProtocol string `json:"ipprotocol"` Gateway string `json:"gateway"` Interface string `json:"interface"` FriendlyIface string `json:"friendlyiface"` FriendlyIfDescr string `json:"friendlyifdescr"` Name string `json:"name"` Attribute any `json:"attribute"` IsDefaultGW bool `json:"isdefaultgw"` Monitor string `json:"monitor"` Descr string `json:"descr"` TierName string `json:"tiername"` }
Gateway represents a single routing gateway
type GatewayRequest ¶
type GatewayRequest struct { ActionDisable bool `json:"action_disable"` AlertInterval int `json:"alert_interval"` Apply bool `json:"apply"` DataPayload int `json:"data_payload"` Descr string `json:"descr"` Disabled bool `json:"disabled"` ForceDown bool `json:"force_down"` Gateway string `json:"gateway"` Interface string `json:"interface"` Interval int `json:"interval"` IpProtocol string `json:"ipprotocol"` LatencyHigh int `json:"latencyhigh"` LatencyLow int `json:"latencylow"` LossInterval int `json:"loss_interval"` LossHigh int `json:"losshigh"` LossLow int `json:"losslow"` Monitor string `json:"monitor"` MonitorDisable bool `json:"monitor_disable"` Name string `json:"name"` TimePeriod int `json:"time_period"` Weight int `json:"weight"` }
GatewayRequest represents a single gateway to be created or modified. This type is use for creations and updates.
type GatewayStatus ¶
type Group ¶
type Group struct { Name string `json:"name"` Description string `json:"description"` Scope string `json:"scope"` Gid int `json:"gid"` Member []int `json:"member"` Priv []string `json:"priv"` }
Group represents a single user group.
type GroupRequest ¶
type Interface ¶
type Interface struct { Enable TrueIfPresent `json:"enable"` If string `json:"if"` Descr string `json:"descr"` AliasAddress string `json:"alias-address"` AliasSubnet OptionalJSONInt `json:"alias-subnet"` Ipaddr string `json:"ipaddr"` Dhcprejectfrom string `json:"dhcprejectfrom"` AdvDhcpPtTimeout OptionalJSONInt `json:"adv_dhcp_pt_timeout,omitempty"` AdvDhcpPtRetry OptionalJSONInt `json:"adv_dhcp_pt_retry,omitempty"` AdvDhcpPtSelectTimeout OptionalJSONInt `json:"adv_dhcp_pt_select_timeout,omitempty"` AdvDhcpPtReboot OptionalJSONInt `json:"adv_dhcp_pt_reboot,omitempty"` AdvDhcpPtBackoffCutoff OptionalJSONInt `json:"adv_dhcp_pt_backoff_cutoff,omitempty"` AdvDhcpPtInitialInterval OptionalJSONInt `json:"adv_dhcp_pt_initial_interval,omitempty"` AdvDhcpPtValues string `json:"adv_dhcp_pt_values"` AdvDhcpSendOptions string `json:"adv_dhcp_send_options"` AdvDhcpRequestOptions string `json:"adv_dhcp_request_options"` AdvDhcpRequiredOptions string `json:"adv_dhcp_required_options"` AdvDhcpOptionModifiers string `json:"adv_dhcp_option_modifiers"` AdvDhcpConfigAdvanced TrueIfPresent `json:"adv_dhcp_config_advanced"` AdvDhcpConfigFileOverride TrueIfPresent `json:"adv_dhcp_config_file_override"` AdvDhcpConfigFileOverridePath string `json:"adv_dhcp_config_file_override_path"` Ipaddrv6 string `json:"ipaddrv6"` Dhcp6Duid string `json:"dhcp6-duid"` Dhcp6IaPdLen string `json:"dhcp6-ia-pd-len"` AdvDhcp6PrefixSelectedInterface string `json:"adv_dhcp6_prefix_selected_interface"` Blockpriv TrueIfPresent `json:"blockpriv"` Blockbogons TrueIfPresent `json:"blockbogons"` Subnet OptionalJSONInt `json:"subnet,omitempty"` Spoofmac string `json:"spoofmac"` Name string `json:"name"` AdvDhcpConfigFileOverrideFile string `json:"adv_dhcp_config_file_override_file"` Apply TrueIfPresent `json:"apply"` Dhcpcvpt OptionalJSONInt `json:"dhcpcvpt,omitempty"` Dhcphostname string `json:"dhcphostname"` Dhcpvlanenable TrueIfPresent `json:"dhcpvlanenable"` Gateway string `json:"gateway"` Gateway6Rd string `json:"gateway-6rd"` Gatewayv6 string `json:"gatewayv6"` Ipv6Usev4Iface TrueIfPresent `json:"ipv6usev4iface"` Media string `json:"media"` Mss string `json:"mss"` Mtu OptionalJSONInt `json:"mtu,omitempty"` Prefix6Rd string `json:"prefix-6rd"` Prefix6RdV4Plen OptionalJSONInt `json:"prefix-6rd-v4plen,omitempty"` Subnetv6 string `json:"subnetv6"` Track6Interface string `json:"track6-interface"` Track6PrefixIdHex OptionalJSONInt `json:"track6-prefix-id-hex,omitempty"` Type string `json:"type"` Type6 string `json:"type6"` }
Interface represents a single interface.
type InterfaceGroup ¶
type InterfaceRequest ¶
type InterfaceRequest struct { AdvDhcpConfigAdvanced bool `json:"adv_dhcp_config_advanced"` AdvDhcpConfigFileOverride bool `json:"adv_dhcp_config_file_override"` AdvDhcpConfigFileOverrideFile string `json:"adv_dhcp_config_file_override_file,omitempty"` AdvDhcpOptionModifiers string `json:"adv_dhcp_option_modifiers,omitempty"` AdvDhcpPtBackoffCutoff *int `json:"adv_dhcp_pt_backoff_cutoff,omitempty"` AdvDhcpPtInitialInterval *int `json:"adv_dhcp_pt_initial_interval,omitempty"` AdvDhcpPtReboot *int `json:"adv_dhcp_pt_reboot,omitempty"` AdvDhcpPtRetry *int `json:"adv_dhcp_pt_retry,omitempty"` AdvDhcpPtSelectTimeout *int `json:"adv_dhcp_pt_select_timeout,omitempty"` AdvDhcpPtTimeout *int `json:"adv_dhcp_pt_timeout,omitempty"` AdvDhcpRequestOptions string `json:"adv_dhcp_request_options,omitempty"` AdvDhcpRequiredOptions string `json:"adv_dhcp_required_options,omitempty"` AdvDhcpSendOptions string `json:"adv_dhcp_send_options,omitempty"` AliasAddress string `json:"alias-address,omitempty"` AliasSubnet *int `json:"alias-subnet,omitempty"` Apply bool `json:"apply"` Blockbogons bool `json:"blockbogons"` Blockpriv bool `json:"blockpriv"` Descr string `json:"descr"` Dhcpcvpt *int `json:"dhcpcvpt,omitempty"` Dhcphostname string `json:"dhcphostname,omitempty"` Dhcprejectfrom []string `json:"dhcprejectfrom,omitempty"` Dhcpvlanenable bool `json:"dhcpvlanenable"` Enable bool `json:"enable"` Gateway string `json:"gateway,omitempty"` Gateway6Rd string `json:"gateway-6rd,omitempty"` Gatewayv6 string `json:"gatewayv6,omitempty"` If string `json:"if"` Ipaddr string `json:"ipaddr,omitempty"` Ipaddrv6 string `json:"ipaddrv6,omitempty"` Ipv6Usev4Iface bool `json:"ipv6usev4iface"` Media string `json:"media,omitempty"` Mss string `json:"mss,omitempty"` Mtu *int `json:"mtu,omitempty"` Prefix6Rd string `json:"prefix-6rd,omitempty"` Prefix6RdV4Plen *int `json:"prefix-6rd-v4plen"` Spoofmac string `json:"spoofmac,omitempty"` Subnet *int `json:"subnet,omitempty"` Subnetv6 string `json:"subnetv6,omitempty"` Track6Interface string `json:"track6-interface,omitempty"` Track6PrefixIdHex *int `json:"track6-prefix-id-hex,omitempty"` Type string `json:"type,omitempty"` Type6 string `json:"type6,omitempty"` }
type InterfaceService ¶
type InterfaceService service
InterfaceService provides interface API methods
func (InterfaceService) Apply ¶
func (s InterfaceService) Apply(ctx context.Context, async bool) error
Apply applies pending interface changes
func (InterfaceService) CreateInterface ¶
func (s InterfaceService) CreateInterface( ctx context.Context, newInterface InterfaceRequest, ) (*Interface, error)
CreateInterface creates a new interface.
func (InterfaceService) CreateInterfaceGroup ¶
func (s InterfaceService) CreateInterfaceGroup( ctx context.Context, newGroup InterfaceGroupRequestCreate, ) (*InterfaceGroup, error)
CreateInterfaceGroup creates a new interface group.
func (InterfaceService) CreateVLAN ¶
func (s InterfaceService) CreateVLAN( ctx context.Context, newVLAN VLANRequest, ) (*VLAN, error)
CreateVLAN creates a new VLAN.
func (InterfaceService) DeleteInterface ¶
func (s InterfaceService) DeleteInterface(ctx context.Context, interfaceID string) error
DeleteInterface deletes the interface. The interfaceID can be specified in either the interface's descriptive name, the pfSense ID (wan, lan, optx), or the physical interface id (e.g. igb0).
func (InterfaceService) DeleteInterfaceGroup ¶
func (s InterfaceService) DeleteInterfaceGroup(ctx context.Context, idToDelete int) error
DeleteInterfaceGroup deletes an interface group.
func (InterfaceService) DeleteVLAN ¶
func (s InterfaceService) DeleteVLAN(ctx context.Context, vlanIf string) error
DeleteVLAN deletes a VLAN.
func (InterfaceService) ListInterfaceGroups ¶
func (s InterfaceService) ListInterfaceGroups(ctx context.Context) ([]*InterfaceGroup, error)
ListInterfaceGroups returns the interface groups.
func (InterfaceService) ListInterfaces ¶
func (s InterfaceService) ListInterfaces(ctx context.Context) ([]*Interface, error)
ListInterfaces returns the interfaces
func (InterfaceService) ListVLANs ¶
func (s InterfaceService) ListVLANs(ctx context.Context) ([]*VLAN, error)
ListVLANs returns the VLANs
func (InterfaceService) UpdateInterface ¶
func (s InterfaceService) UpdateInterface( ctx context.Context, idToUpdate string, interfaceData InterfaceRequest, ) (*Interface, error)
UpdateInterface modifies an existing interface.
func (InterfaceService) UpdateInterfaceGroup ¶
func (s InterfaceService) UpdateInterfaceGroup( ctx context.Context, groupData InterfaceGroupRequestUpdate, ) (*InterfaceGroup, error)
UpdateInterfaceGroup updates an existing interface group.
func (InterfaceService) UpdateVLAN ¶
func (s InterfaceService) UpdateVLAN( ctx context.Context, vlanIf string, vlanData VLANRequest, ) (*VLAN, error)
UpdateVLAN modifies an existing VLAN.
type InterfaceStatus ¶
type InterfaceStatus struct { Name string `json:"name"` Descr string `json:"descr"` Hwif string `json:"hwif"` Enable bool `json:"enable"` If string `json:"if"` Status string `json:"status"` Macaddr string `json:"macaddr"` Mtu int `json:"mtu"` Ipaddr string `json:"ipaddr"` Subnet string `json:"subnet"` Linklocal string `json:"linklocal"` Ipaddrv6 string `json:"ipaddrv6"` Subnetv6 int `json:"subnetv6"` Inerrs int `json:"inerrs"` Outerrs int `json:"outerrs"` Collisions int `json:"collisions"` Inbytespass int64 `json:"inbytespass"` Outbytespass int64 `json:"outbytespass"` Inpktspass int `json:"inpktspass"` Outpktspass int `json:"outpktspass"` Inbytesblock int `json:"inbytesblock"` Outbytesblock int `json:"outbytesblock"` Inpktsblock int `json:"inpktsblock"` Outpktsblock int `json:"outpktsblock"` Inbytes int64 `json:"inbytes"` Outbytes int64 `json:"outbytes"` Inpkts int `json:"inpkts"` Outpkts int `json:"outpkts"` Dhcplink string `json:"dhcplink"` Media string `json:"media"` Gateway string `json:"gateway"` Gatewayv6 string `json:"gatewayv6"` }
type JSONInt ¶ added in v1.1.0
type JSONInt int
func (*JSONInt) UnmarshalJSON ¶ added in v1.1.0
UnmarshalJSON implements the json.Unmarshaler interface.
type OptionalJSONInt ¶ added in v1.1.0
type OptionalJSONInt struct {
Value *int
}
OptionalInt can unmarshal both JSON numbers and strings into an integer.
func (*OptionalJSONInt) UnmarshalJSON ¶ added in v1.1.0
func (jsi *OptionalJSONInt) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type Package ¶
type Package struct { Name string `json:"name"` Version string `json:"version"` InstalledVersion string `json:"installed_version"` Descr string `json:"descr"` Installed bool `json:"installed"` UpdateAvailable bool `json:"update_available"` }
Package represents a single package.
type RoutingService ¶
type RoutingService service
RoutingService provides routing API methods
func (RoutingService) Apply ¶
func (s RoutingService) Apply(ctx context.Context) error
Apply applies pending routing changes
func (RoutingService) CreateGateway ¶
func (s RoutingService) CreateGateway( ctx context.Context, newGateway GatewayRequest, ) (*Gateway, error)
CreateGateway creates a new Gateway
func (RoutingService) DeleteGateway ¶
func (s RoutingService) DeleteGateway(ctx context.Context, gatewayID int) error
DeleteGateway deletes a Gateway
func (RoutingService) ListGateways ¶
func (s RoutingService) ListGateways(ctx context.Context) ([]*Gateway, error)
ListGateways returns the gateways
func (RoutingService) SetDefaultGateway ¶
func (s RoutingService) SetDefaultGateway(ctx context.Context, newDefaultGateway DefaultGatewayRequest) error
SetDefaultGateway sets the default gateway
func (RoutingService) UpdateGateway ¶
func (s RoutingService) UpdateGateway( ctx context.Context, gatewayToUpdate GatewayRequest, ) (*Gateway, error)
UpdateGateway modifies a existing gateway
type StatusService ¶
type StatusService service
StatusService provides Status API methods
func (StatusService) DHCPLog ¶
func (s StatusService) DHCPLog(ctx context.Context) ([]string, error)
DHCPLog returns the DHCP log
func (StatusService) FirewallLog ¶
func (s StatusService) FirewallLog(ctx context.Context) ([]string, error)
FirewallLog returns the firewall log
func (StatusService) GetSystemStatus ¶
func (s StatusService) GetSystemStatus(ctx context.Context) (*SystemStatus, error)
GetSystemStatus returns the system status
func (StatusService) ListGatewayStatus ¶
func (s StatusService) ListGatewayStatus(ctx context.Context) ([]*GatewayStatus, error)
ListGatewayStatus returns the interface status
func (StatusService) ListInterfaceStatus ¶
func (s StatusService) ListInterfaceStatus(ctx context.Context) ([]*InterfaceStatus, error)
ListInterfaceStatus returns the interface status
type StringArray ¶ added in v1.1.0
type StringArray []string
StringArray is designed to unmarshal PFSense string arrays which look like "192.168.0.1,192.168.1.1"
func (*StringArray) UnmarshalJSON ¶ added in v1.1.0
func (sa *StringArray) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type SystemHostname ¶
type SystemService ¶
type SystemService service
SystemService provides System API methods
func (SystemService) AddDNSServers ¶
func (s SystemService) AddDNSServers(ctx context.Context, newDNSServers []string) error
AddDNSServers adds new DNS servers to the system DNS configuration.
func (SystemService) CreateCACertificate ¶
func (s SystemService) CreateCACertificate( ctx context.Context, newCACertificate CACertificateRequest, ) (*CACertificate, error)
CreateCACertificate generate or import new CA certificate.
func (SystemService) CreateCertificate ¶ added in v0.1.4
func (s SystemService) CreateCertificate( ctx context.Context, newCertificate CertificateCreateRequest, ) (*Certificate, error)
CreateCertificate generate or import new certificate.
func (SystemService) CreateTunable ¶
func (s SystemService) CreateTunable( ctx context.Context, newTunable TunableRequest, ) (*Tunable, error)
CreateTunable creates a new system tunable.
func (SystemService) DeleteArpEntry ¶
func (s SystemService) DeleteArpEntry(ctx context.Context, address string) error
DeleteArpEntry deletes a arp entry for an address from the arp table
func (SystemService) DeleteCACertificate ¶
func (s SystemService) DeleteCACertificate(ctx context.Context, refid string) error
DeleteCACertificate deletes a CA certificate installed on the system.
func (SystemService) DeleteCertificate ¶
func (s SystemService) DeleteCertificate(ctx context.Context, refid string) error
DeleteCertificate deletes a SSL/TLS certificate installed on the system.
func (SystemService) DeleteDNSServer ¶
func (s SystemService) DeleteDNSServer(ctx context.Context, dnsserver string) error
DeleteDNSServer deletes a system DNS server.
func (SystemService) DeleteTunable ¶
func (s SystemService) DeleteTunable(ctx context.Context, tunableID int) error
DeleteTunable deletes a system tunable.
func (SystemService) GetAPIConfiguration ¶
func (s SystemService) GetAPIConfiguration(ctx context.Context) (*APIConfiguration, error)
GetAPIConfiguration returns the API configuration
func (SystemService) GetAPIVersion ¶
func (s SystemService) GetAPIVersion(ctx context.Context) (*APIVersion, error)
GetAPIVersion returns the API versions
func (SystemService) GetDNSConfiguration ¶
func (s SystemService) GetDNSConfiguration(ctx context.Context) (*DNSConfiguration, error)
GetDNSConfiguration returns the system DNS configuration.
func (SystemService) GetEmailNotification ¶
func (s SystemService) GetEmailNotification(ctx context.Context) (*EmailNotification, error)
GetEmailNotification returns the system email notification configuration.
func (SystemService) GetErrorDefinitions ¶
func (s SystemService) GetErrorDefinitions(ctx context.Context) (map[string]*ErrorDefinition, error)
GetErrorDefinitions returns a map with the error code being the key and value being the error definition.
func (SystemService) GetHostname ¶
func (s SystemService) GetHostname(ctx context.Context) (*SystemHostname, error)
GetHostname returns the system hostname configuration.
func (SystemService) GetVersion ¶
func (s SystemService) GetVersion(ctx context.Context) (*Version, error)
GetVersion returns the system version.
func (SystemService) GetVersionUpgradeStatus ¶
func (s SystemService) GetVersionUpgradeStatus(ctx context.Context, useCache bool) (*VersionUpgradeStatus, error)
GetVersionUpgradeStatus checks if there is an version upgrade available, but does not perform the upgrade.
func (SystemService) Halt ¶
func (s SystemService) Halt(ctx context.Context) error
Halt shuts down the pfsense system.
func (SystemService) InstallPackage ¶
func (s SystemService) InstallPackage(ctx context.Context, name string) error
InstallPackage installs a new package on the system.
func (SystemService) ListArpTable ¶
func (s SystemService) ListArpTable(ctx context.Context) ([]*ArpEntry, error)
ListArpTable returns all the arp entries in the arp table.
func (SystemService) ListCACertificates ¶
func (s SystemService) ListCACertificates(ctx context.Context) ([]*CACertificate, error)
ListCACertificates returns all the CA certificates installed on the system.
func (SystemService) ListCertificates ¶
func (s SystemService) ListCertificates(ctx context.Context) ([]*Certificate, error)
ListCertificates returns all the SSL/TLS certificates installed on the system.
func (SystemService) ListPackages ¶
ListPackages returns a list of the packages. Passing the true to the all argument here includes all pfSense packages available, even packages that are not installed.
func (SystemService) ListTunables ¶
func (s SystemService) ListTunables(ctx context.Context) ([]*Tunable, error)
ListTunables returns a list of the system tunables.
func (SystemService) Reboot ¶
func (s SystemService) Reboot(ctx context.Context) error
Reboot initiates a system reboot.
func (SystemService) UninstallPackage ¶
func (s SystemService) UninstallPackage(ctx context.Context, name string) error
UninstallPackage uninstalls a package.
func (SystemService) UpdateAPIConfiguration ¶
func (s SystemService) UpdateAPIConfiguration(ctx context.Context, apiConfiguration APIConfigurationRequest) error
UpdateAPIConfiguration updates the API configuration
func (SystemService) UpdateCertificate ¶ added in v0.1.4
func (s SystemService) UpdateCertificate( ctx context.Context, refIDToUpdate string, newCertificateData CertificateUpdateRequest, ) (*Certificate, error)
UpdateCertificate modifies an existing certificate
func (SystemService) UpdateDNSConfiguration ¶
func (s SystemService) UpdateDNSConfiguration(ctx context.Context, dnsConfiguration DNSConfiguration) error
UpdateDNSConfiguration updates the DNS configuration
func (SystemService) UpdateEmailNotification ¶
func (s SystemService) UpdateEmailNotification(ctx context.Context, newConfig EmailNotificationRequest) error
UpdateEmailNotification updates the system email notification configuration.
func (SystemService) UpdateHostname ¶
func (s SystemService) UpdateHostname(ctx context.Context, newHostname SystemHostname) error
UpdateHostname updates the system hostname.
func (SystemService) UpdateTunable ¶
func (s SystemService) UpdateTunable( ctx context.Context, tunableToUpdate string, newTunable TunableRequest, ) (*Tunable, error)
UpdateTunable modifies an existing tunable.
type SystemStatus ¶
type SystemStatus struct { SystemPlatform string `json:"system_platform"` SystemSerial string `json:"system_serial"` SystemNetgateId string `json:"system_netgate_id"` BiosVendor string `json:"bios_vendor"` BiosVersion string `json:"bios_version"` BiosDate string `json:"bios_date"` CpuModel string `json:"cpu_model"` KernelPti bool `json:"kernel_pti"` MdsMitigation string `json:"mds_mitigation"` TempC int `json:"temp_c"` TempF float64 `json:"temp_f"` LoadAvg []float64 `json:"load_avg"` MbufUsage float64 `json:"mbuf_usage"` MemUsage float64 `json:"mem_usage"` SwapUsage int `json:"swap_usage"` DiskUsage float64 `json:"disk_usage"` }
type TokenService ¶
type TokenService service
TokenService provides Token API methods
func (TokenService) CreateAccessToken ¶
func (s TokenService) CreateAccessToken(ctx context.Context) (string, error)
CreateAccessToken creates a new AccessToken
type TrueIfPresent ¶ added in v1.1.0
type TrueIfPresent bool
TrueIfPresent is designed to unmarshal PFSense boolean values that can indicate truth by having an empty string as the value of the property
func (*TrueIfPresent) UnmarshalJSON ¶ added in v1.1.0
func (tip *TrueIfPresent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type Tunable ¶
type Tunable struct { Tunable string `json:"tunable"` Value string `json:"value"` Descr string `json:"descr"` Modified bool `json:"modified"` }
Tunable represents a single system tunable.
type TunableRequest ¶
type UnboundAliasesList ¶ added in v1.1.0
type UnboundAliasesList struct {
Items []*UnboundHostOverrideAlias `json:"item"`
}
func (*UnboundAliasesList) UnmarshalJSON ¶ added in v1.1.0
func (ual *UnboundAliasesList) UnmarshalJSON(data []byte) error
type UnboundHostOverride ¶ added in v1.1.0
type UnboundHostOverride struct { Aliases *UnboundAliasesList `json:"aliases,omitempty"` Description string `json:"descr"` Domain string `json:"domain"` Host string `json:"host"` IP StringArray `json:"ip"` }
Gateway represents a single routing gateway
type UnboundHostOverrideAlias ¶ added in v1.1.0
type UnboundService ¶ added in v1.1.0
type UnboundService service
Unbound provides Unbound API methods
func (UnboundService) CreateHostOverride ¶ added in v1.1.0
func (s UnboundService) CreateHostOverride( ctx context.Context, hostOverride *UnboundHostOverride, apply bool, ) (*UnboundHostOverride, error)
func (UnboundService) DeleteHostOverride ¶ added in v1.1.0
func (UnboundService) ListHostOverrides ¶ added in v1.1.0
func (s UnboundService) ListHostOverrides(ctx context.Context) ([]*UnboundHostOverride, error)
func (UnboundService) UpdateHostOverride ¶ added in v1.1.0
func (s UnboundService) UpdateHostOverride( ctx context.Context, hostOverride *UnboundHostOverride, apply bool, ) (*UnboundHostOverride, error)
type User ¶
type User struct { Scope string `json:"scope"` BcryptHash string `json:"bcrypt-hash"` Descr string `json:"descr"` Name string `json:"name"` Expires string `json:"expires"` Dashboardcolumns string `json:"dashboardcolumns"` AuthorizedKeys string `json:"authorizedkeys"` Ipsecpsk string `json:"ipsecpsk"` Webguicss string `json:"webguicss"` Cert []string `json:"cert"` Uid string `json:"uid"` GroupName string `json:"groupname"` Priv []string `json:"priv"` }
User represents a single user.
type UserRequest ¶
type UserRequest struct { AuthorizedKeys string `json:"authorizedkeys"` Cert []string `json:"cert"` Descr string `json:"descr"` Disabled bool `json:"disabled"` Expires string `json:"expires"` Ipsecpsk string `json:"ipsecpsk"` Password string `json:"password"` Priv []string `json:"priv"` Username string `json:"username"` }
type UserService ¶
type UserService service
UserService provides User API methods
func (UserService) AddPrivilegesToUser ¶
func (s UserService) AddPrivilegesToUser(ctx context.Context, username string, privileges []string) error
AddPrivilegesToUser adds existing privileges to a user.
func (UserService) AddUserToGroups ¶
AddUserToGroups adds a user to existing groups.
func (UserService) CreateGroup ¶
func (s UserService) CreateGroup( ctx context.Context, newGroup GroupRequest, ) (*Group, error)
CreateGroup creates a new Group.
func (UserService) CreateUser ¶
func (s UserService) CreateUser( ctx context.Context, newUser UserRequest, ) (*User, error)
CreateUser creates a new User.
func (UserService) DeleteGroup ¶
func (s UserService) DeleteGroup(ctx context.Context, groupname string) error
DeleteGroup deletes a group by group name.
func (UserService) DeleteUser ¶
func (s UserService) DeleteUser(ctx context.Context, username string) error
DeleteUser deletes a user by username.
func (UserService) ListGroups ¶
func (s UserService) ListGroups(ctx context.Context) ([]*Group, error)
ListGroups returns a list of the groups.
func (UserService) ListUsers ¶
func (s UserService) ListUsers(ctx context.Context) ([]*User, error)
ListUsers returns a list of the users.
func (UserService) RemovePrivilegeFromUser ¶
func (s UserService) RemovePrivilegeFromUser(ctx context.Context, username, privname string) error
RemovePrivilegeFromUser removes a privilege from a user.
func (UserService) RemoveUserFromGroup ¶
func (s UserService) RemoveUserFromGroup(ctx context.Context, username, groupname string) error
RemoveUserFromGroup removes a user from a group.
func (UserService) UpdateGroup ¶
func (s UserService) UpdateGroup( ctx context.Context, groupToUpdate string, newGroupData GroupRequest, ) (*Group, error)
UpdateGroup modifies an existing group.
func (UserService) UpdateUser ¶
func (s UserService) UpdateUser( ctx context.Context, userData UserRequest, ) (*User, error)
UpdateUser updates a user.
type VLAN ¶
type VLAN struct { If string `json:"if"` Tag JSONInt `json:"tag"` Pcp OptionalJSONInt `json:"pcp"` Descr string `json:"descr"` Vlanif string `json:"vlanif"` }
VLAN represents a single VLAN.
type VLANRequest ¶
type Version ¶
type Version struct { Version string `json:"version"` Base string `json:"base"` Patch string `json:"patch"` Buildtime string `json:"buildtime"` Lastcommit string `json:"lastcommit"` Program int `json:"program"` }
Version represents the system version.
type VersionUpgradeStatus ¶
type VersionUpgradeStatus struct { Version string `json:"version"` InstalledVersion string `json:"installed_version"` PkgVersionCompare string `json:"pkg_version_compare"` }
VersionUpgradeStatus represents the system version upgrade status.