mirror of
https://github.com/postmannen/ctrl.git
synced 2025-03-05 14:56:49 +00:00
todo comments
This commit is contained in:
parent
797953a3d6
commit
d249f58756
3 changed files with 14 additions and 2 deletions
File diff suppressed because one or more lines are too long
|
@ -313,6 +313,10 @@ func (s startup) pubREQPublicKeysGet(p process) {
|
||||||
ticker := time.NewTicker(time.Second * time.Duration(p.configuration.PublicKeysGetInterval))
|
ticker := time.NewTicker(time.Second * time.Duration(p.configuration.PublicKeysGetInterval))
|
||||||
for {
|
for {
|
||||||
|
|
||||||
|
// TODO: We could send with the hash of the currently stored keys,
|
||||||
|
// so we would know on the subscriber at central if it should send
|
||||||
|
// and update with new keys back.
|
||||||
|
|
||||||
m := Message{
|
m := Message{
|
||||||
FileName: "publickeysget.log",
|
FileName: "publickeysget.log",
|
||||||
Directory: "publickeysget",
|
Directory: "publickeysget",
|
||||||
|
|
11
requests.go
11
requests.go
|
@ -2061,6 +2061,11 @@ func (m methodREQPublicKeysGet) handler(proc process, message Message, node stri
|
||||||
// case out := <-outCh:
|
// case out := <-outCh:
|
||||||
case <-outCh:
|
case <-outCh:
|
||||||
proc.centralAuth.keys.nodePublicKeys.mu.Lock()
|
proc.centralAuth.keys.nodePublicKeys.mu.Lock()
|
||||||
|
// TODO: We should probably create a hash of the current map content,
|
||||||
|
// store it alongside the KeyMap, and send both the KeyMap and hash
|
||||||
|
// back. We can then later send that hash when asking for keys, compare
|
||||||
|
// it with the current one for the KeyMap, and know if we need to send
|
||||||
|
// and update back to the node who published the request to here.
|
||||||
b, err := json.Marshal(proc.centralAuth.keys.nodePublicKeys.KeyMap)
|
b, err := json.Marshal(proc.centralAuth.keys.nodePublicKeys.KeyMap)
|
||||||
proc.centralAuth.keys.nodePublicKeys.mu.Unlock()
|
proc.centralAuth.keys.nodePublicKeys.mu.Unlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2154,7 +2159,11 @@ func (m methodREQPublicKeysAllow) getKind() Event {
|
||||||
return m.event
|
return m.event
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handler to get all the public ed25519 keys from a central server.
|
// Handler to allow new public keys into the database on central auth.
|
||||||
|
// Nodes will send the public key in the REQHello messages. When they
|
||||||
|
// are recived on the central server they will be put into a temp key
|
||||||
|
// map, and we need to acknowledge them before they are moved into the
|
||||||
|
// main key map, and then allowed to be sent out to other nodes.
|
||||||
func (m methodREQPublicKeysAllow) handler(proc process, message Message, node string) ([]byte, error) {
|
func (m methodREQPublicKeysAllow) handler(proc process, message Message, node string) ([]byte, error) {
|
||||||
// Get a context with the timeout specified in message.MethodTimeout.
|
// Get a context with the timeout specified in message.MethodTimeout.
|
||||||
ctx, _ := getContextForMethodTimeout(proc.ctx, message)
|
ctx, _ := getContextForMethodTimeout(proc.ctx, message)
|
||||||
|
|
Loading…
Add table
Reference in a new issue