Documentation
¶
Index ¶
- Constants
- type API
- func (api *API) CreateDevice(ctx context.Context, params CreateDeviceParams) (Device, error)
- func (api *API) CreateProfile(ctx context.Context, params CreateProfileParams) ([]Profile, error)
- func (api *API) CreateProfileCustomRule(ctx context.Context, params CreateProfileCustomRuleParams) ([]CustomRule, error)
- func (api *API) CreateProfileRuleFolder(ctx context.Context, params CreateProfileRuleFolderParams) ([]Group, error)
- func (api *API) DeleteDevice(ctx context.Context, params DeleteDeviceParams) ([]any, error)
- func (api *API) DeleteLearnedIPs(ctx context.Context, params DeleteLearnedIPsParams) ([]any, error)
- func (api *API) DeleteProfile(ctx context.Context, params DeleteProfileParams) ([]any, error)
- func (api *API) DeleteProfileCustomRule(ctx context.Context, params DeleteProfileCustomRuleParams) (any, error)
- func (api *API) DeleteProfileRuleFolder(ctx context.Context, params DeleteProfileRuleFolderParams) (any, error)
- func (api *API) LearnNewIPs(ctx context.Context, params LearnNewIPsParams) ([]any, error)
- func (api *API) ListDeviceType(ctx context.Context) (DeviceTypes, error)
- func (api *API) ListDevices(ctx context.Context) ([]Device, error)
- func (api *API) ListIP(ctx context.Context) (IP, error)
- func (api *API) ListKnownIPs(ctx context.Context, params ListKnownIPsParams) ([]KnownIP, error)
- func (api *API) ListLogLevels(ctx context.Context) ([]LogLevel, error)
- func (api *API) ListNetwork(ctx context.Context) ([]Network, error)
- func (api *API) ListProfileCustomRules(ctx context.Context, params ListProfileCustomRulesParams) ([]Rule, error)
- func (api *API) ListProfileDefaultRule(ctx context.Context, params ListProfileDefaultRuleParams) (DefaultRule, error)
- func (api *API) ListProfileExternalFilters(ctx context.Context, params ListProfileFiltersParams) ([]Filter, error)
- func (api *API) ListProfileNativeFilters(ctx context.Context, params ListProfileFiltersParams) ([]Filter, error)
- func (api *API) ListProfileRuleFolders(ctx context.Context, params ListProfileRuleFoldersParams) ([]Group, error)
- func (api *API) ListProfileServices(ctx context.Context, params ListProfileServicesParams) ([]ProfileService, error)
- func (api *API) ListProfiles(ctx context.Context) ([]Profile, error)
- func (api *API) ListProfilesOptions(ctx context.Context) ([]ProfilesOption, error)
- func (api *API) ListServiceCategories(ctx context.Context) ([]Category, error)
- func (api *API) ListServices(ctx context.Context, params ListServicesParams) ([]Service, error)
- func (api *API) ListStorageRegions(ctx context.Context) ([]Endpoint, error)
- func (api *API) ListUser(ctx context.Context) (User, error)
- func (api *API) Raw(ctx context.Context, method, endpoint string, data interface{}, ...) (RawResponse, error)
- func (api *API) UpdateDevice(ctx context.Context, params UpdateDeviceParams) (Device, error)
- func (api *API) UpdateProfile(ctx context.Context, params UpdateProfileParams) ([]Profile, error)
- func (api *API) UpdateProfileCustomRule(ctx context.Context, params UpdateProfileCustomRuleParams) ([]CustomRule, error)
- func (api *API) UpdateProfileDefaultRule(ctx context.Context, params UpdateProfileDefaultRuleParams) (DefaultRule, error)
- func (api *API) UpdateProfileFilter(ctx context.Context, params UpdateProfileFilterParams) (any, error)
- func (api *API) UpdateProfileRuleFolder(ctx context.Context, params UpdateProfileRuleFolderParams) ([]Group, error)
- func (api *API) UpdateProfileService(ctx context.Context, params UpdateProfileServiceParams) ([]Action, error)
- func (api *API) UpdateProfilesOption(ctx context.Context, params UpdateProfilesOption) (any, error)
- type APIResponse
- type Action
- type AnalyticsLevel
- type AuthenticationError
- type AuthorizationError
- type Browser
- type BrowserIcons
- type Category
- type CreateDeviceParams
- type CreateDeviceResponse
- type CreateProfileBody
- type CreateProfileCustomRuleBody
- type CreateProfileCustomRuleParams
- type CreateProfileCustomRuleResponse
- type CreateProfileParams
- type CreateProfileResponse
- type CreateProfileRuleFolderBody
- type CreateProfileRuleFolderParams
- type CreateProfileRuleFolderResponse
- type CustomRule
- type DDNS
- type DDNSExt
- type Date
- type DateTime
- type DefaultRule
- type DeleteDeviceParams
- type DeleteDeviceResponse
- type DeleteLearnedIPsParams
- type DeleteLearnedIPsResponse
- type DeleteProfileCustomRuleParams
- type DeleteProfileCustomRuleResponse
- type DeleteProfileParams
- type DeleteProfileResponse
- type DeleteProfileRuleFolderParams
- type DeleteProfileRuleFolderResponse
- type DeleteProfileServiceBody
- type DeleteProfileServiceParams
- type DeleteProfileServiceResponse
- type Device
- type DeviceStatus
- type DeviceTypes
- type DoType
- type Endpoint
- type Error
- type ErrorType
- type Filter
- type FilterLevel
- type FilterResolvers
- type Group
- type GroupAction
- type IP
- type Icon
- type IconName
- type IntBool
- type KnownIP
- type LearnNewIPsParams
- type LearnNewIPsResponse
- type LegacyIPv4
- type ListDeviceTypesBody
- type ListDeviceTypesResponse
- type ListDevicesBody
- type ListDevicesResponse
- type ListIPResponse
- type ListKnownIPsBody
- type ListKnownIPsParams
- type ListKnownIPsResponse
- type ListLogLevelsBody
- type ListLogLevelsResponse
- type ListNetworkBody
- type ListNetworkResponse
- type ListProfileCustomRulesBody
- type ListProfileCustomRulesParams
- type ListProfileCustomRulesResponse
- type ListProfileDefaultRuleBody
- type ListProfileDefaultRuleParams
- type ListProfileDefaultRuleResponse
- type ListProfileFiltersBody
- type ListProfileFiltersParams
- type ListProfileFiltersResponse
- type ListProfileRuleFoldersBody
- type ListProfileRuleFoldersParams
- type ListProfileRuleFoldersResponse
- type ListProfileServicesBody
- type ListProfileServicesParams
- type ListProfileServicesResponse
- type ListProfilesBody
- type ListProfilesOptionsBody
- type ListProfilesOptionsResponse
- type ListProfilesResponse
- type ListServiceCategoriesBody
- type ListServiceCategoriesResponse
- type ListServicesBody
- type ListServicesParams
- type ListServicesResponse
- type ListStorageRegionsBody
- type ListStorageRegionsResponse
- type ListUserResponse
- type Location
- type LogLevel
- type Logger
- type Network
- type NotFoundError
- type OS
- type OSIcons
- type Opt
- type Option
- func BaseURL(baseURL string) Option
- func Debug(debug bool) Option
- func HTTPClient(client *http.Client) Option
- func Headers(headers http.Header) Option
- func UserAgent(userAgent string) Option
- func UsingLogger(logger Logger) Option
- func UsingRateLimit(rps float64) Option
- func UsingRetryPolicy(maxRetries int, minRetryDelaySecs int, maxRetryDelaySecs int) Option
- type Profile
- type ProfileOptionType
- type ProfileService
- type ProfilesOption
- type RatelimitError
- type RawResponse
- type ReqOption
- type RequestError
- type Resolvers
- type Response
- type ResponseInfo
- type RetryPolicy
- type Router
- type RouterIcons
- type Rule
- type Service
- type ServiceError
- type Status
- type TV
- type TVIcons
- type UnixTime
- type UpdateDeviceParams
- type UpdateDeviceResponse
- type UpdateProfileBody
- type UpdateProfileCustomRuleBody
- type UpdateProfileCustomRuleParams
- type UpdateProfileCustomRuleResponse
- type UpdateProfileDefaultRuleBody
- type UpdateProfileDefaultRuleParams
- type UpdateProfileDefaultRuleResponse
- type UpdateProfileFilterBody
- type UpdateProfileFilterParams
- type UpdateProfileFilterResponse
- type UpdateProfileParams
- type UpdateProfileResponse
- type UpdateProfileRuleFolderBody
- type UpdateProfileRuleFolderParams
- type UpdateProfileRuleFolderResponse
- type UpdateProfileServiceBody
- type UpdateProfileServiceParams
- type UpdateProfileServiceResponse
- type UpdateProfilesOption
- type UpdateProfilesOptionBody
- type UpdateProfilesOptionResponse
- type User
Constants ¶
const ( Pending = 0 Active = 1 SoftDisabled = 2 HardDisabled = 3 )
const ( Block = 0 Bypass = 1 Spoof = 2 Redirect = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { APIToken string BaseURL string UserAgent string Debug bool // contains filtered or unexported fields }
API holds the configuration for the current API client. A client should not be modified concurrently.
func (*API) CreateDevice ¶
func (*API) CreateProfile ¶
func (*API) CreateProfileCustomRule ¶
func (api *API) CreateProfileCustomRule(ctx context.Context, params CreateProfileCustomRuleParams) ([]CustomRule, error)
func (*API) CreateProfileRuleFolder ¶
func (*API) DeleteDevice ¶
func (*API) DeleteLearnedIPs ¶
func (*API) DeleteProfile ¶
func (*API) DeleteProfileCustomRule ¶
func (*API) DeleteProfileRuleFolder ¶
func (*API) LearnNewIPs ¶
func (*API) ListDeviceType ¶
func (api *API) ListDeviceType(ctx context.Context) (DeviceTypes, error)
func (*API) ListKnownIPs ¶
func (*API) ListProfileCustomRules ¶
func (*API) ListProfileDefaultRule ¶
func (api *API) ListProfileDefaultRule(ctx context.Context, params ListProfileDefaultRuleParams) (DefaultRule, error)
func (*API) ListProfileExternalFilters ¶
func (*API) ListProfileNativeFilters ¶
func (*API) ListProfileRuleFolders ¶
func (*API) ListProfileServices ¶
func (api *API) ListProfileServices(ctx context.Context, params ListProfileServicesParams) ([]ProfileService, error)
func (*API) ListProfilesOptions ¶
func (api *API) ListProfilesOptions(ctx context.Context) ([]ProfilesOption, error)
func (*API) ListServiceCategories ¶
func (*API) ListServices ¶
func (*API) ListStorageRegions ¶
func (*API) Raw ¶
func (api *API) Raw(ctx context.Context, method, endpoint string, data interface{}, headers http.Header) (RawResponse, error)
Raw makes an HTTP request with user provided params and returns the result as a RawResponse, which contains the untouched JSON result.
func (*API) UpdateDevice ¶
func (*API) UpdateProfile ¶
func (*API) UpdateProfileCustomRule ¶
func (api *API) UpdateProfileCustomRule(ctx context.Context, params UpdateProfileCustomRuleParams) ([]CustomRule, error)
func (*API) UpdateProfileDefaultRule ¶
func (api *API) UpdateProfileDefaultRule(ctx context.Context, params UpdateProfileDefaultRuleParams) (DefaultRule, error)
func (*API) UpdateProfileFilter ¶
func (*API) UpdateProfileRuleFolder ¶
func (*API) UpdateProfileService ¶
func (*API) UpdateProfilesOption ¶
type APIResponse ¶
APIResponse holds the structure for a response from the API. It looks alot like `http.Response` however, uses a `[]byte` for the `Body` instead of a `io.ReadCloser`.
This may go away in the experimental client in favour of `http.Response`.
type AnalyticsLevel ¶
type AnalyticsLevel int
const ( Off AnalyticsLevel = 0 Basic AnalyticsLevel = 1 Full AnalyticsLevel = 2 )
type AuthenticationError ¶
type AuthenticationError struct {
// contains filtered or unexported fields
}
AuthenticationError is for HTTP 401 responses.
func NewAuthenticationError ¶
func NewAuthenticationError(e *Error) AuthenticationError
func (AuthenticationError) Error ¶
func (e AuthenticationError) Error() string
func (AuthenticationError) InternalErrorCodeIs ¶
func (e AuthenticationError) InternalErrorCodeIs(code int) bool
func (AuthenticationError) Type ¶
func (e AuthenticationError) Type() ErrorType
type AuthorizationError ¶
type AuthorizationError struct {
// contains filtered or unexported fields
}
AuthorizationError is for HTTP 403 responses.
func NewAuthorizationError ¶
func NewAuthorizationError(e *Error) AuthorizationError
func (AuthorizationError) Error ¶
func (e AuthorizationError) Error() string
func (AuthorizationError) InternalErrorCodeIs ¶
func (e AuthorizationError) InternalErrorCodeIs(code int) bool
func (AuthorizationError) Type ¶
func (e AuthorizationError) Type() ErrorType
type BrowserIcons ¶
type CreateDeviceParams ¶
type CreateDeviceParams struct { Name string `json:"name"` ProfileID string `json:"profile_id"` ProfileID2 *string `json:"profile_id2,omitempty"` Icon IconName `json:"icon"` Stats *AnalyticsLevel `json:"stats,omitempty"` LegacyIPv4Status *IntBool `json:"legacy_ipv4_status,omitempty"` LearnIP *IntBool `json:"learn_ip,omitempty"` Restricted *IntBool `json:"restricted,omitempty"` Desc *string `json:"desc,omitempty"` DDNSStatus *IntBool `json:"ddns_status,omitempty"` DDNSSubdomain *string `json:"ddns_subdomain,omitempty"` DDNSExtStatus *IntBool `json:"ddns_ext_host,omitempty"` DDNSExtHost *string `json:"ddns_ext_status,omitempty"` RemapDeviceID *string `json:"remap_device_id,omitempty"` RemapClientID *string `json:"remap_client_id,omitempty"` }
type CreateDeviceResponse ¶
type CreateProfileBody ¶
type CreateProfileBody struct {
Profiles []Profile `json:"profiles"`
}
type CreateProfileCustomRuleBody ¶
type CreateProfileCustomRuleBody struct {
Rules []CustomRule `json:"rules"`
}
type CreateProfileCustomRuleResponse ¶
type CreateProfileCustomRuleResponse struct { Body CreateProfileCustomRuleBody `json:"body"` Response }
type CreateProfileParams ¶
type CreateProfileResponse ¶
type CreateProfileResponse struct { Body ListProfilesBody `json:"body"` Response }
type CreateProfileRuleFolderBody ¶
type CreateProfileRuleFolderBody struct {
Groups []Group `json:"groups"`
}
type CreateProfileRuleFolderResponse ¶
type CreateProfileRuleFolderResponse struct { Body CreateProfileRuleFolderBody `json:"body"` Response }
type CustomRule ¶
type CustomRule Action
type DefaultRule ¶
type DefaultRule Action
type DeleteDeviceParams ¶
type DeleteDeviceParams struct {
DeviceID string `json:"device-id"`
}
type DeleteDeviceResponse ¶
type DeleteLearnedIPsParams ¶
type DeleteProfileParams ¶
type DeleteProfileParams struct {
ProfileID string `json:"profile_id"`
}
type DeleteProfileResponse ¶
type DeleteProfileServiceBody ¶
type DeleteProfileServiceBody struct {
Services []Action `json:"services"`
}
type DeleteProfileServiceResponse ¶
type DeleteProfileServiceResponse struct { Body DeleteProfileServiceBody `json:"body"` Response }
type Device ¶
type Device struct { PK string `json:"PK"` Ts UnixTime `json:"ts"` Name string `json:"name"` User string `json:"user"` Stats *AnalyticsLevel `json:"stats,omitempty"` DeviceID string `json:"device_id"` Status DeviceStatus `json:"status"` Restricted *IntBool `json:"restricted,omitempty"` LearnIP IntBool `json:"learn_ip"` Desc string `json:"desc"` DDNS *DDNS `json:"ddns,omitempty"` Resolvers Resolvers `json:"resolvers"` LegacyIPv4 LegacyIPv4 `json:"legacy_ipv4"` Profile Profile `json:"profile"` Icon *IconName `json:"icon"` }
type DeviceStatus ¶
type DeviceStatus int
type DeviceTypes ¶
type Error ¶
type Error struct { // The classification of error encountered. Type ErrorType // StatusCode is the HTTP status code from the response. StatusCode int // Errors is all of the error messages and codes, combined. Error ResponseInfo }
func (*Error) ClientError ¶
ClientError returns a boolean whether or not the raised error was caused by something client side.
func (*Error) ClientRateLimited ¶
ClientRateLimited returns a boolean whether or not the raised error was caused by too many requests from the client.
func (*Error) InternalErrorCodeIs ¶
InternalErrorCodeIs returns a boolean whether or not the desired internal error code is present in `e.InternalErrorCodes`.
type Filter ¶
type Filter struct { PK string `json:"PK"` Name string `json:"name"` Description string `json:"description"` Additional *string `json:"additional,omitempty"` Sources []string `json:"sources"` Levels []FilterLevel `json:"levels,omitempty"` Status IntBool `json:"status"` Resolvers *FilterResolvers `json:"resolvers,omitempty"` }
type FilterLevel ¶
type FilterResolvers ¶
type Group ¶
type Group struct { PK int `json:"PK"` Group string `json:"group"` Action GroupAction `json:"action"` Count int `json:"count"` }
type GroupAction ¶
type IconName ¶
type IconName string
const ( DesktopWindows IconName = "desktop-windows" DesktopMac IconName = "desktop-mac" DesktopLinux IconName = "desktop-linux" MobileIOS IconName = "mobile-ios" MobileAndroid IconName = "mobile-android" BrowserChrome IconName = "browser-chrome" BrowserFirefox IconName = "browser-firefox" BrowserEdge IconName = "browser-edge" BrowserBrave IconName = "browser-brave" BrowserOther IconName = "browser-other" TVApple IconName = "tv-apple" TVAndroid IconName = "tv-android" TVFireTV IconName = "tv-firetv" TVSamsung IconName = "tv-samsung" TVOther IconName = "tv" RouterAsus IconName = "router-asus" RouterDDWRT IconName = "router-ddwrt" RouterFirewalla IconName = "router-firewalla" RouterFreshTomato IconName = "router-freshtomato" RouterGLiNET IconName = "router-glinet" RouterOpenWRT IconName = "router-openwrt" RouterOPNsense IconName = "router-opnsense" RouterPfSense IconName = "router-pfsense" RouterSynology IconName = "router-synology" RouterUbiquiti IconName = "router-ubiquiti" RouterWindows IconName = "router-windows" RouterLinux IconName = "router-linux" RouterOther IconName = "router" )
type IntBool ¶
type IntBool struct {
// contains filtered or unexported fields
}
func (IntBool) MarshalJSON ¶
func (*IntBool) UnmarshalJSON ¶
type LearnNewIPsParams ¶
type LearnNewIPsResponse ¶
type LegacyIPv4 ¶
type ListDeviceTypesBody ¶
type ListDeviceTypesBody struct {
Types DeviceTypes `json:"types"`
}
type ListDeviceTypesResponse ¶
type ListDeviceTypesResponse struct { Body ListDeviceTypesBody `json:"body"` Response }
type ListDevicesBody ¶
type ListDevicesBody struct {
Devices []Device `json:"devices"`
}
type ListDevicesResponse ¶
type ListDevicesResponse struct { Body ListDevicesBody `json:"body"` Response }
type ListIPResponse ¶
type ListKnownIPsBody ¶
type ListKnownIPsBody struct {
IPs []KnownIP `json:"ips"`
}
type ListKnownIPsParams ¶
type ListKnownIPsParams struct {
DeviceID string `json:"device_id"`
}
type ListKnownIPsResponse ¶
type ListKnownIPsResponse struct { Body ListKnownIPsBody `json:"body"` Response }
type ListLogLevelsBody ¶
type ListLogLevelsBody struct {
Levels []LogLevel `json:"levels"`
}
type ListLogLevelsResponse ¶
type ListLogLevelsResponse struct { Body ListLogLevelsBody `json:"body"` Response }
type ListNetworkBody ¶
type ListNetworkResponse ¶
type ListNetworkResponse struct { Body ListNetworkBody `json:"body"` Response }
type ListProfileCustomRulesBody ¶
type ListProfileCustomRulesBody struct {
Rules []Rule `json:"rules"`
}
type ListProfileCustomRulesResponse ¶
type ListProfileCustomRulesResponse struct { Body ListProfileCustomRulesBody `json:"body"` Response }
type ListProfileDefaultRuleBody ¶
type ListProfileDefaultRuleBody struct {
Default any `json:"default"`
}
type ListProfileDefaultRuleParams ¶
type ListProfileDefaultRuleParams struct {
ProfileID string `json:"profile_id"`
}
type ListProfileDefaultRuleResponse ¶
type ListProfileDefaultRuleResponse struct { Body ListProfileDefaultRuleBody `json:"body"` Response }
type ListProfileFiltersBody ¶
type ListProfileFiltersBody struct {
Filters []Filter `json:"filters"`
}
type ListProfileFiltersParams ¶
type ListProfileFiltersParams struct {
ProfileID string `json:"profile_id"`
}
type ListProfileFiltersResponse ¶
type ListProfileFiltersResponse struct { Body ListProfileFiltersBody `json:"body"` Response }
type ListProfileRuleFoldersBody ¶
type ListProfileRuleFoldersBody struct {
Groups []Group `json:"groups"`
}
type ListProfileRuleFoldersParams ¶
type ListProfileRuleFoldersParams struct {
ProfileID string `json:"profile_id"`
}
type ListProfileRuleFoldersResponse ¶
type ListProfileRuleFoldersResponse struct { Body ListProfileRuleFoldersBody `json:"body"` Response }
type ListProfileServicesBody ¶
type ListProfileServicesBody struct {
Services []ProfileService `json:"services"`
}
type ListProfileServicesParams ¶
type ListProfileServicesParams struct {
ProfileID string `json:"profile_id"`
}
type ListProfileServicesResponse ¶
type ListProfileServicesResponse struct { Body ListProfileServicesBody `json:"body"` Response }
type ListProfilesBody ¶
type ListProfilesBody struct {
Profiles []Profile `json:"profiles"`
}
type ListProfilesOptionsBody ¶
type ListProfilesOptionsBody struct {
Options []ProfilesOption `json:"options"`
}
type ListProfilesOptionsResponse ¶
type ListProfilesOptionsResponse struct { Body ListProfilesOptionsBody `json:"body"` Response }
type ListProfilesResponse ¶
type ListProfilesResponse struct { Body ListProfilesBody `json:"body"` Response }
type ListServiceCategoriesBody ¶
type ListServiceCategoriesBody struct {
Categories []Category `json:"categories"`
}
type ListServiceCategoriesResponse ¶
type ListServiceCategoriesResponse struct { Body ListServiceCategoriesBody `json:"body"` Response }
type ListServicesBody ¶
type ListServicesBody struct {
Services []Service `json:"services"`
}
type ListServicesParams ¶
type ListServicesParams struct {
Category string `json:"category"`
}
type ListServicesResponse ¶
type ListServicesResponse struct { Body ListServicesBody `json:"body"` Response }
type ListStorageRegionsBody ¶
type ListStorageRegionsBody struct {
Endpoint []Endpoint `json:"endpoints"`
}
type ListStorageRegionsResponse ¶
type ListStorageRegionsResponse struct { Body ListStorageRegionsBody `json:"body"` Response }
type ListUserResponse ¶
type LogLevel ¶
type LogLevel struct { PK AnalyticsLevel `json:"PK"` Title string `json:"title"` }
type Logger ¶
type Logger interface {
Printf(format string, v ...interface{})
}
Logger defines the interface this library needs to use logging This is a subset of the methods implemented in the log package.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is for HTTP 404 responses.
func NewNotFoundError ¶
func NewNotFoundError(e *Error) NotFoundError
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
func (NotFoundError) InternalErrorCodeIs ¶
func (e NotFoundError) InternalErrorCodeIs(code int) bool
func (NotFoundError) Type ¶
func (e NotFoundError) Type() ErrorType
type Option ¶
Option is a functional option for configuring the API client.
func HTTPClient ¶
HTTPClient accepts a custom *http.Client for making API calls.
func Headers ¶
Headers allows you to set custom HTTP headers when making API calls (e.g. for satisfying HTTP proxies, or for debugging).
func UserAgent ¶
UserAgent can be set if you want to send a software name and version for HTTP access logs. It is recommended to set it in order to help future Customer Support diagnostics and prevent collateral damage by sharing generic User-Agent string with abusive users. E.g. "my-software/1.2.3". By default generic Go User-Agent is used.
func UsingLogger ¶
UsingLogger can be set if you want to get log output from this API instance By default no log output is emitted.
func UsingRateLimit ¶
UsingRateLimit applies a non-default rate limit to client API requests If not specified the default of 4rps will be applied.
type ProfileOptionType ¶
type ProfileOptionType string
const ( Dropdown ProfileOptionType = "dropdown" Field ProfileOptionType = "field" Toggle ProfileOptionType = "toggle" )
type ProfileService ¶
type ProfilesOption ¶
type RatelimitError ¶
type RatelimitError struct {
// contains filtered or unexported fields
}
RatelimitError is for HTTP 429s where the service is telling the client to slow down.
func NewRatelimitError ¶
func NewRatelimitError(e *Error) RatelimitError
func (RatelimitError) Error ¶
func (e RatelimitError) Error() string
func (RatelimitError) InternalErrorCodeIs ¶
func (e RatelimitError) InternalErrorCodeIs(code int) bool
func (RatelimitError) Type ¶
func (e RatelimitError) Type() ErrorType
type RawResponse ¶
type RawResponse struct { Response Body json.RawMessage `json:"body"` }
RawResponse keeps the result as JSON form.
type ReqOption ¶
type ReqOption func(opt *reqOption)
ReqOption is a functional option for configuring API requests.
type RequestError ¶
type RequestError struct {
// contains filtered or unexported fields
}
RequestError is for 4xx errors that we encounter not covered elsewhere (generally bad payloads).
func NewRequestError ¶
func NewRequestError(e *Error) RequestError
func (RequestError) Error ¶
func (e RequestError) Error() string
func (RequestError) InternalErrorCodeIs ¶
func (e RequestError) InternalErrorCodeIs(code int) bool
func (RequestError) Type ¶
func (e RequestError) Type() ErrorType
type Response ¶
type Response struct { Success bool `json:"success"` Error ResponseInfo `json:"error"` }
Response is a template. There will also be a result struct. There will be a unique response type for each response, which will include this type.
type ResponseInfo ¶
type ResponseInfo struct { Date DateTime `json:"date"` Message string `json:"message"` Code int `json:"code"` }
ResponseInfo contains a code and message returned by the API as errors or informational messages inside the response.
type RetryPolicy ¶
RetryPolicy specifies number of retries and min/max retry delays This config is used when the client exponentially backs off after errored requests.
type Router ¶
type Router struct { Name string `json:"name"` Icons RouterIcons `json:"icons"` SetupURL string `json:"setup_url"` }
type RouterIcons ¶
type ServiceError ¶
type ServiceError struct {
// contains filtered or unexported fields
}
ServiceError is a handler for 5xx errors returned to the client.
func NewServiceError ¶
func NewServiceError(e *Error) ServiceError
func (ServiceError) Error ¶
func (e ServiceError) Error() string
func (ServiceError) InternalErrorCodeIs ¶
func (e ServiceError) InternalErrorCodeIs(code int) bool
func (ServiceError) Type ¶
func (e ServiceError) Type() ErrorType
type UpdateDeviceParams ¶
type UpdateDeviceParams struct { DeviceID string `json:"id"` Name *string `json:"name,omitempty"` ProfileID *string `json:"profile_id,omitempty"` ProfileID2 *string `json:"profile_id2,omitempty"` Stats *AnalyticsLevel `json:"stats,omitempty"` LegacyIPv4Status *IntBool `json:"legacy_ipv4_status,omitempty"` LearnIP *IntBool `json:"learn_ip,omitempty"` Restricted *IntBool `json:"restricted,omitempty"` BumpTLS *IntBool `json:"bump_tls,omitempty"` Desc *string `json:"desc,omitempty"` DDNSStatus *IntBool `json:"ddns_status,omitempty"` DDNSSubdomain *string `json:"ddns_subdomain,omitempty"` DDNSExtHost *string `json:"ddns_ext_host,omitempty"` DDNSExtStatus *IntBool `json:"ddns_ext_status,omitempty"` Status *DeviceStatus `json:"status,omitempty"` CtrldCustomConfig *string `json:"ctrld_custom_config,omitempty"` }
type UpdateDeviceResponse ¶
type UpdateProfileBody ¶
type UpdateProfileBody struct {
Profiles []Profile `json:"profiles"`
}
type UpdateProfileCustomRuleBody ¶
type UpdateProfileCustomRuleBody struct {
Rules []CustomRule `json:"rules"`
}
type UpdateProfileCustomRuleResponse ¶
type UpdateProfileCustomRuleResponse struct { Body UpdateProfileCustomRuleBody `json:"body"` Response }
type UpdateProfileDefaultRuleBody ¶
type UpdateProfileDefaultRuleBody struct {
Default DefaultRule `json:"default"`
}
type UpdateProfileDefaultRuleResponse ¶
type UpdateProfileDefaultRuleResponse struct { Body UpdateProfileDefaultRuleBody `json:"body"` Response }
type UpdateProfileFilterBody ¶
type UpdateProfileFilterBody struct {
Filters any `json:"filters"`
}
type UpdateProfileFilterResponse ¶
type UpdateProfileFilterResponse struct { Body UpdateProfileFilterBody `json:"body"` Response }
type UpdateProfileParams ¶
type UpdateProfileResponse ¶
type UpdateProfileResponse struct { Body ListProfilesBody `json:"body"` Response }
type UpdateProfileRuleFolderBody ¶
type UpdateProfileRuleFolderBody struct {
Groups []Group `json:"groups"`
}
type UpdateProfileRuleFolderResponse ¶
type UpdateProfileRuleFolderResponse struct { Body CreateProfileRuleFolderBody `json:"body"` Response }
type UpdateProfileServiceBody ¶
type UpdateProfileServiceBody struct {
Services []Action `json:"services"`
}
type UpdateProfileServiceResponse ¶
type UpdateProfileServiceResponse struct { Body UpdateProfileServiceBody `json:"body"` Response }
type UpdateProfilesOption ¶
type UpdateProfilesOptionResponse ¶
type UpdateProfilesOptionResponse struct { Body UpdateProfilesOptionBody `json:"body"` Response }
type User ¶
type User struct { PK string `json:"PK"` ResolverIP net.IP `json:"resolver_ip"` EmailStatus IntBool `json:"email_status"` Tutorials IntBool `json:"tutorials"` V int `json:"v"` ResolverStatus IntBool `json:"resolver_status"` RuleProfile string `json:"rule_profile"` Date Date `json:"date"` Status IntBool `json:"status"` Email string `json:"email"` ResolverUid string `json:"resolver_uid"` ProxyAccess IntBool `json:"proxy_access"` StatsEndpoint string `json:"stats_endpoint"` LastActive UnixTime `json:"last_active"` Twofa IntBool `json:"twofa"` Debug []any `json:"debug"` }