Documentation
¶
Index ¶
- type ChallengeResult
- type Client
- func (c *Client) AssignDomain(ctx context.Context, domainID string, deviceIDs []string) ([]DomainAssignment, error)
- func (c *Client) CreateACMEChallenge(ctx context.Context, digest string) (*ChallengeResult, error)
- func (c *Client) DeleteACMEChallenge(ctx context.Context, id string) error
- func (c *Client) DeleteDomain(ctx context.Context, domainID string) error
- func (c *Client) DeviceID() string
- func (c *Client) Enroll(ctx context.Context) (*EnrollResult, error)
- func (c *Client) GetDeviceInfo(ctx context.Context) (*DeviceInfo, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) ListAssignments(ctx context.Context, domainID string) ([]DomainAssignment, error)
- func (c *Client) ListDomains(ctx context.Context) ([]DomainInfo, error)
- func (c *Client) Ready(ctx context.Context) error
- func (c *Client) RegisterDomain(ctx context.Context, domain string) (*DomainInfo, error)
- func (c *Client) RequestNexusToken(ctx context.Context, stage int, sessionNonce string) (string, error)
- func (c *Client) SetHostname(ctx context.Context, hostname string) error
- func (c *Client) UnassignDomain(ctx context.Context, domainID, deviceID string) error
- func (c *Client) VerifyDomain(ctx context.Context, domainID string) (*DomainInfo, error)
- func (c *Client) VerifyToken(ctx context.Context, token string) (*VerifyResult, error)
- type DeviceInfo
- type DomainAssignment
- type DomainInfo
- type EnrollResult
- type Option
- type VerifyResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChallengeResult ¶
ChallengeResult is returned from POST /acme/challenges.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for the namek server API.
func (*Client) AssignDomain ¶ added in v0.1.2
func (c *Client) AssignDomain(ctx context.Context, domainID string, deviceIDs []string) ([]DomainAssignment, error)
AssignDomain calls POST /api/v1/domains/:id/assignments (authenticated).
func (*Client) CreateACMEChallenge ¶
CreateACMEChallenge calls POST /api/v1/acme/challenges (authenticated).
func (*Client) DeleteACMEChallenge ¶
DeleteACMEChallenge calls DELETE /api/v1/acme/challenges/:id (authenticated).
func (*Client) DeleteDomain ¶ added in v0.1.2
DeleteDomain calls DELETE /api/v1/domains/:id (authenticated).
func (*Client) Enroll ¶
func (c *Client) Enroll(ctx context.Context) (*EnrollResult, error)
Enroll performs the 2-phase enrollment flow.
func (*Client) GetDeviceInfo ¶
func (c *Client) GetDeviceInfo(ctx context.Context) (*DeviceInfo, error)
GetDeviceInfo calls GET /api/v1/devices/me (authenticated).
func (*Client) ListAssignments ¶ added in v0.1.2
ListAssignments calls GET /api/v1/domains/:id/assignments (authenticated).
func (*Client) ListDomains ¶ added in v0.1.2
func (c *Client) ListDomains(ctx context.Context) ([]DomainInfo, error)
ListDomains calls GET /api/v1/domains (authenticated).
func (*Client) RegisterDomain ¶ added in v0.1.2
RegisterDomain calls POST /api/v1/domains (authenticated).
func (*Client) RequestNexusToken ¶
func (c *Client) RequestNexusToken(ctx context.Context, stage int, sessionNonce string) (string, error)
RequestNexusToken calls POST /api/v1/tokens/nexus (authenticated).
func (*Client) SetHostname ¶
SetHostname calls PATCH /api/v1/devices/me/hostname (authenticated).
func (*Client) UnassignDomain ¶ added in v0.1.2
UnassignDomain calls DELETE /api/v1/domains/:id/assignments/:device_id (authenticated).
func (*Client) VerifyDomain ¶ added in v0.1.2
VerifyDomain calls POST /api/v1/domains/:id/verify (authenticated).
func (*Client) VerifyToken ¶
VerifyToken calls POST /api/v1/tokens/verify (no auth).
type DeviceInfo ¶
type DeviceInfo struct {
DeviceID string `json:"device_id"`
Hostname string `json:"hostname"`
CustomHostname *string `json:"custom_hostname"`
Status string `json:"status"`
IdentityClass string `json:"identity_class"`
NexusEndpoints []string `json:"nexus_endpoints"`
AliasDomains []string `json:"alias_domains,omitempty"`
}
DeviceInfo is returned from GET /devices/me.
type DomainAssignment ¶ added in v0.1.2
type DomainAssignment struct {
DeviceID string `json:"device_id"`
Domain string `json:"domain"`
CreatedAt string `json:"created_at"`
}
DomainAssignment represents a device-to-domain assignment.
type DomainInfo ¶ added in v0.1.2
type DomainInfo struct {
ID string `json:"id"`
AccountID string `json:"account_id"`
Domain string `json:"domain"`
Status string `json:"status"` // "pending" or "verified"
CNAMETarget string `json:"cname_target"`
AssignedDevices []string `json:"assigned_devices,omitempty"`
CreatedAt string `json:"created_at"`
ExpiresAt string `json:"expires_at,omitempty"`
VerifiedAt string `json:"verified_at,omitempty"`
VerifiedByDeviceID string `json:"verified_by_device_id,omitempty"`
}
DomainInfo represents an alias domain registered with the namek server.
type EnrollResult ¶
type EnrollResult struct {
DeviceID string `json:"device_id"`
Hostname string `json:"hostname"`
IdentityClass string `json:"identity_class"`
NexusEndpoints []string `json:"nexus_endpoints"`
Reenrolled bool `json:"reenrolled,omitempty"`
}
EnrollResult is returned after successful enrollment.
type Option ¶
type Option func(*Client)
Option configures a Client.
func WithDeviceID ¶
WithDeviceID restores a previously-enrolled device ID, allowing the client to make authenticated requests without re-enrolling.
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client.
func WithInsecureSkipVerify ¶
func WithInsecureSkipVerify() Option
WithInsecureSkipVerify disables TLS certificate verification. Must be applied after WithHTTPClient if both are used.
type VerifyResult ¶
VerifyResult is returned from POST /tokens/verify.