MCPcopy Create free account
hub / github.com/koding/kite / Kontrol

Struct Kontrol

kontrol/kontrol.go:57–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55)
56
57type Kontrol struct {
58 Kite *kite.Kite
59
60 // MachineAuthenticate is used to authenticate the request in the
61 // "handleMachine" method. The reason for a separate auth function is, the
62 // request must not be authenticated because clients do not have a kite.key
63 // before they register to this machine. Also the requester can send a
64 // authType argument which can be used to distinguish between several
65 // authentication methods
66 MachineAuthenticate func(authType string, r *kite.Request) error
67
68 // MachineKeyPicker is used to choose the key pair to generate a valid
69 // kite.key file for the "handleMachine" method. This overrides the default
70 // last keypair added with kontrol.AddKeyPair method.
71 MachineKeyPicker func(r *kite.Request) (*KeyPair, error)
72
73 // TokenTTL describes default TTL for a token issued by the kontrol.
74 //
75 // If TokenTTL is 0, default global TokenTTL is used.
76 TokenTTL time.Duration
77
78 // TokenLeeway describes time difference to gracefully handle clock
79 // skew between client and server.
80 //
81 // If TokenLeeway is 0, default global TokenLeeway is used.
82 TokenLeeway time.Duration
83
84 // TokenNoNBF when true does not set nbf field for generated JWT tokens.
85 TokenNoNBF bool
86
87 clientLocks *IdLock
88
89 heartbeats map[string]*heartbeat
90 heartbeatsMu sync.Mutex // protects each clients heartbeat timer
91
92 tokenCache map[string]cachedToken
93 tokenCacheMu sync.Mutex
94
95 // closed notifies goroutines started by kontrol that it got closed
96 closed chan struct{}
97
98 // keyPair defines the storage of keypairs
99 keyPair KeyPairStorage
100
101 // ids, lastPublic and lastPrivate are used to store the last added keys
102 // for convinience
103 lastIDs []string
104 lastPublic []string
105 lastPrivate []string
106
107 // storage defines the storage of the kites.
108 storage Storage
109
110 // selfKeyPair is a key pair used to sign Kontrol's kite key.
111 selfKeyPair *KeyPair
112
113 // RegisterURL defines the URL that is used to self register when adding
114 // itself to the storage backend

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected