-
-
Notifications
You must be signed in to change notification settings - Fork 161
/
clienttype.go
33 lines (25 loc) · 1.02 KB
/
clienttype.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
package request
// UserAgentNotifier used to distinguish between a regular client request and an internal cluster request when
// notifying other nodes of a cluster change.
const UserAgentNotifier = "incus-cluster-notifier"
// UserAgentJoiner used to distinguish between a regular client request and an internal cluster request when
// joining a node to a cluster.
const UserAgentJoiner = "incus-cluster-joiner"
// ClientType indicates which sort of client type is being used.
type ClientType string
// ClientTypeNotifier cluster notification client.
const ClientTypeNotifier ClientType = "notifier"
// ClientTypeJoiner cluster joiner client.
const ClientTypeJoiner ClientType = "joiner"
// ClientTypeNormal normal client.
const ClientTypeNormal ClientType = "normal"
// UserAgentClientType converts user agent to client type.
func UserAgentClientType(userAgent string) ClientType {
switch userAgent {
case UserAgentNotifier:
return ClientTypeNotifier
case UserAgentJoiner:
return ClientTypeJoiner
}
return ClientTypeNormal
}