-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
keygen.go
70 lines (52 loc) · 1.99 KB
/
keygen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package keygen
import (
"os"
"path/filepath"
"time"
"github.com/hashicorp/go-cleanhttp"
)
const (
// The current version of the SDK.
SDKVersion = "3.2.0"
)
var (
// APIURL is the URL of the API service backend.
APIURL = "https://api.keygen.sh"
// APIVersion is the currently supported API version.
APIVersion = "1.7"
// APIPrefix is the major version prefix included in all API URLs.
APIPrefix = "v1"
// Account is the Keygen account identifier used globally in the SDK.
Account string
// Product is the Keygen product identifier used globally in the SDK.
Product string
// Package is the Keygen package identifier used globally in the SDK.
Package string
// Environment is the Keygen environment identifier used globally in the SDK.
Environment string
// LicenseKey is the end-user's license key used in the SDK.
LicenseKey string
// Token is the end-user's API token used in the SDK.
Token string
// PublicKey is the Keygen public key used for verifying license keys
// and API response signatures.
PublicKey string
// UserAgent defines the user-agent string sent to the API backend,
// uniquely identifying an integration.
UserAgent string
// Logger is a leveled logger implementation used for printing debug,
// informational, warning, and error messages.
Logger LeveledLogger = NewLogger(LogLevelError)
// Program is the name of the current program, used when installing
// upgrades. Defaults to the current program name.
Program = filepath.Base(os.Args[0])
// MaxClockDrift is the maximum allowable difference between the
// server time Keygen's API sent a request or response and the
// current system time, to prevent clock-tampering and replay
// attacks. Set to -1 to disable.
MaxClockDrift = time.Duration(5) * time.Minute
// HTTPClient is the internal HTTP client used by the SDK for API
// requests. Set this to a custom HTTP client, to implement e.g.
// automatic retries, rate limiting checks, or for tests.
HTTPClient = cleanhttp.DefaultPooledClient()
)