controld

package
v1.5.6 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InvalidConfigCode = 40402
)

Variables

This section is empty.

Functions

func DoWithFallbackForTest added in v1.5.6

func DoWithFallbackForTest(client *http.Client, req *http.Request, apiIp string) (*http.Response, error)

DoWithFallbackForTest exposes doWithFallback so tests outside this package can drive the real two-attempt composition through the real retry predicate, rather than asserting a copy of this error shape against another copy of it.

func ParseRawUID added in v1.3.0

func ParseRawUID(rawUID string) (string, string)

ParseRawUID parse the input raw UID, returning real UID and ClientID. The raw UID can have 2 forms:

- <uid> - <uid>/<client_id>

func SendLogs added in v1.4.0

func SendLogs(ctx context.Context, lr *LogsRequest, cdDev bool) error

SendLogs sends runtime log to ControlD API.

Types

type ErrorResponse added in v1.4.0

type ErrorResponse struct {
	ErrorField struct {
		Message string `json:"message"`
		Code    int    `json:"code"`
	} `json:"error"`
	// StatusCode is the HTTP status the API answered with. It is not part of the JSON
	// body: this type is built for *any* non-200 whose body decodes, so the body alone
	// cannot tell a permanent rejection of the request from a transient server-side
	// failure, and callers that act differently on the two need the status to tell them
	// apart. Zero means the status was not recorded.
	StatusCode int `json:"-"`
}

func (ErrorResponse) Error added in v1.4.0

func (u ErrorResponse) Error() string

type LogsRequest added in v1.4.0

type LogsRequest struct {
	UID  string        `json:"uid"`
	Data io.ReadCloser `json:"-"`
}

LogsRequest contains request data for sending runtime logs to API.

type ResolverConfig

type ResolverConfig struct {
	DOH   string `json:"doh"`
	Ctrld struct {
		CustomConfig     string `json:"custom_config"`
		CustomLastUpdate int64  `json:"custom_last_update"`
		VersionTarget    string `json:"version_target"`
	} `json:"ctrld"`
	Exclude         []string `json:"exclude"`
	UID             string   `json:"uid"`
	DeactivationPin *int64   `json:"deactivation_pin,omitempty"`
}

ResolverConfig represents Control D resolver data.

func FetchResolverConfig

func FetchResolverConfig(ctx context.Context, req *ResolverConfigRequest, cdDev bool) (*ResolverConfig, error)

FetchResolverConfig fetch Control D config for given uid.

func FetchResolverUID added in v1.3.0

func FetchResolverUID(ctx context.Context, req *UtilityOrgRequest, version string, cdDev bool) (*ResolverConfig, error)

FetchResolverUID fetch resolver uid from a given request.

func UpdateCustomLastFailed added in v1.3.8

func UpdateCustomLastFailed(ctx context.Context, rawUID, version string, cdDev, lastUpdatedFailed bool) (*ResolverConfig, error)

UpdateCustomLastFailed calls API to mark custom config is bad.

type ResolverConfigRequest added in v1.4.9

type ResolverConfigRequest struct {
	RawUID   string
	Version  string
	Metadata map[string]string
}

ResolverConfigRequest contains request data for fetching resolver config.

type UtilityOrgRequest added in v1.3.10

type UtilityOrgRequest struct {
	ProvToken string            `json:"prov_token"`
	Hostname  string            `json:"hostname"`
	Metadata  map[string]string `json:"metadata"`
}

UtilityOrgRequest contains request data for calling Org API.

Jump to

Keyboard shortcuts

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