Documentation
¶
Index ¶
- Constants
- func DefaultConfigPath() (string, error)
- func DeleteConfig(path string) error
- func SaveConfig(path string, config Config) error
- type AccountUpload
- type Client
- func (c *Client) DeleteAccount(ctx context.Context, accountID string) error
- func (c *Client) InvalidateLease(leaseID string)
- func (c *Client) Lease(ctx context.Context, input LeaseRequest) (Lease, error)
- func (c *Client) ListAccounts(ctx context.Context) ([]SharedAccount, error)
- func (c *Client) ListTeams(ctx context.Context) ([]Team, string, error)
- func (c *Client) RepairAccount(ctx context.Context, accountID string, input AccountUpload) (SharedAccount, error)
- func (c *Client) Report(ctx context.Context, leaseID string, report LeaseReport) error
- func (c *Client) UploadAccount(ctx context.Context, input AccountUpload) (SharedAccount, error)
- func (c *Client) UsageStatuses(ctx context.Context) ([]UsageStatus, error)
- type Config
- func (c Config) EffectiveCredentialSource() CredentialSource
- func (c Config) HostedReady() bool
- func (c Config) LoggedIn() bool
- func (c Config) Normalized() Config
- func (c Config) Ready() bool
- func (c Config) TeamModeReady() bool
- func (c Config) UsesLegacyServer() bool
- func (c Config) UsesLocalCredentials() bool
- func (c Config) Validate() error
- type CredentialSource
- type Lease
- type LeaseCooldownScope
- type LeaseOutcome
- type LeaseReport
- type LeaseRequest
- type SharedAccount
- type Team
- type UsageStatus
Constants ¶
View Source
const DefaultBaseURL = "https://cmux.com"
Variables ¶
This section is empty.
Functions ¶
func DefaultConfigPath ¶
func DeleteConfig ¶
func SaveConfig ¶
Types ¶
type AccountUpload ¶
type Client ¶
type Client struct {
Config Config
HTTPClient *http.Client
// contains filtered or unexported fields
}
func (*Client) DeleteAccount ¶
func (*Client) InvalidateLease ¶
InvalidateLease removes an access lease from memory before an asynchronous outcome report reaches cmux.com. This closes the window where a second local request could reuse a credential that just returned 401 or 429.
func (*Client) ListAccounts ¶
func (c *Client) ListAccounts(ctx context.Context) ([]SharedAccount, error)
func (*Client) RepairAccount ¶
func (c *Client) RepairAccount( ctx context.Context, accountID string, input AccountUpload, ) (SharedAccount, error)
func (*Client) UploadAccount ¶
func (c *Client) UploadAccount(ctx context.Context, input AccountUpload) (SharedAccount, error)
func (*Client) UsageStatuses ¶ added in v0.1.60
func (c *Client) UsageStatuses(ctx context.Context) ([]UsageStatus, error)
type Config ¶
type Config struct {
Version int `json:"version"`
BaseURL string `json:"baseUrl"`
AccessToken string `json:"accessToken"`
RefreshToken string `json:"refreshToken"`
LocalProxyToken string `json:"localProxyToken,omitempty"`
TeamID string `json:"teamId,omitempty"`
TeamName string `json:"teamName,omitempty"`
CredentialSource CredentialSource `json:"credentialSource,omitempty"`
HostedURL string `json:"hostedUrl,omitempty"`
HostedExchangeURL string `json:"hostedExchangeUrl,omitempty"`
TenantKey string `json:"tenantKey,omitempty"`
TenantCapabilities []string `json:"tenantCapabilities,omitempty"`
StackAPIURL string `json:"stackApiUrl,omitempty"`
StackProjectID string `json:"stackProjectId,omitempty"`
StackPublishable string `json:"stackPublishableClientKey,omitempty"`
}
func LoadConfig ¶
func (Config) EffectiveCredentialSource ¶
func (c Config) EffectiveCredentialSource() CredentialSource
EffectiveCredentialSource keeps existing installations compatible. A pre-source config with a complete cmux.com login was the old signal for team mode; a machine without that config keeps its legacy server behavior.
func (Config) HostedReady ¶ added in v0.1.52
func (Config) Normalized ¶
func (Config) TeamModeReady ¶
func (Config) UsesLegacyServer ¶
func (Config) UsesLocalCredentials ¶
type CredentialSource ¶
type CredentialSource string
const ( CredentialSourceTeam CredentialSource = "team" CredentialSourceLocal CredentialSource = "local" CredentialSourceLegacy CredentialSource = "legacy" CredentialSourceHosted CredentialSource = "hosted" )
type LeaseCooldownScope ¶
type LeaseCooldownScope string
const ( LeaseCooldownAccount LeaseCooldownScope = "account" LeaseCooldownQuota LeaseCooldownScope = "quota" )
type LeaseOutcome ¶
type LeaseOutcome string
const ( LeaseSuccess LeaseOutcome = "success" LeaseForbidden LeaseOutcome = "forbidden" LeaseRateLimited LeaseOutcome = "rate_limited" LeaseProviderError LeaseOutcome = "provider_error" )
type LeaseReport ¶
type LeaseReport struct {
Outcome LeaseOutcome
StatusCode int
CooldownScope LeaseCooldownScope
RetryAt time.Time
}
type LeaseRequest ¶
type SharedAccount ¶
type UsageStatus ¶ added in v0.1.60
type UsageStatus struct {
ID string `json:"id"`
Provider accounts.Provider `json:"provider"`
AuthMode accounts.AuthMode `json:"auth_mode"`
Email string `json:"email,omitempty"`
Source string `json:"source"`
AuthChecked bool `json:"auth_checked"`
AuthValid bool `json:"auth_valid"`
Refreshed bool `json:"refreshed,omitempty"`
Error string `json:"error,omitempty"`
Active bool `json:"active,omitempty"`
PlanType string `json:"plan_type,omitempty"`
Windows []accounts.UsageWindow `json:"windows,omitempty"`
Credits *accounts.CreditsInfo `json:"credits,omitempty"`
ComplimentaryReset *accounts.ComplimentaryResetInfo `json:"complimentary_reset,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.